You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1997/03/04 23:09:07 UTC
Re: [PATCH] PR#146,187 is_url() not HTTP/1.1 conformant
+1
Dean
On Thu, 27 Feb 1997, Rodent of Unusual Size wrote:
> Both PR#146 and #187 complain that is_url() is being fascistic about
> what constitutes a valid URL. Currently it requires "[a-zA-Z]*://",
> but RFC2068 says it should be "[-.+a-zA-Z0-9]+:". (That is, if
> is_url() is supposed to be checking for an absoluteURI syntax.)
>
> This patch makes is_url() compliant with RFC2068 section 3.2. The
> `if' statement is a little clunky, but..
>
> #ken :-)}
>
> Index: util.c
> ===================================================================
> RCS file: /usr/users/coar/myApache/repository/apache/src/util.c,v
> retrieving revision 1.43
> diff -c -r1.43 util.c
> *** 1.43 1997/02/18 16:27:26
> --- util.c 1997/02/27 18:23:23
> ***************
> *** 903,918 ****
> else return pstrcat (a, src1, src2, NULL);
> }
>
> int is_url(const char *u) {
> register int x;
>
> ! for(x=0;u[x] != ':';x++)
> ! if((!u[x]) || (!isalpha(u[x])))
> return 0;
>
> ! if((u[x+1] == '/') && (u[x+2] == '/'))
> ! return 1;
> ! else return 0;
> }
>
> int can_exec(const struct stat *finfo) {
> --- 903,923 ----
> else return pstrcat (a, src1, src2, NULL);
> }
>
> + /*
> + * Check for an absoluteURI syntax (see section 3.2 in RFC2068).
> + */
> int is_url(const char *u) {
> register int x;
>
> ! for (x = 0; u[x] != ':'; x++) {
> ! if ((! u[x]) ||
> ! ((! isalpha(u[x])) && (! isdigit(u[x])) &&
> ! (u[x] != '+') && (u[x] != '-') && (u[x] != '.'))) {
> return 0;
> + }
> + }
>
> ! return (x ? 1 : 0); /* If the first character is ':', it's broken, too */
> }
>
> int can_exec(const struct stat *finfo) {
>