Url syntax extended. If scheme: is not followed by a "//", then the rest
of the line is returned as the path. Also a bare scheme is now legal.
Showing
2 changed files
with
12 additions
and
5 deletions
... | @@ -111,13 +111,13 @@ of RFC 2384 (for POP) and RFC 2192 (for IMAP) is: | ... | @@ -111,13 +111,13 @@ of RFC 2384 (for POP) and RFC 2192 (for IMAP) is: |
111 | 111 | ||
112 | @example | 112 | @example |
113 | url = | 113 | url = |
114 | scheme ":" = "//" | 114 | scheme ":" [ "//" |
115 | 115 | ||
116 | [ user [ ( ":" password ) | ( ";auth=" auth ) ] "@" ] | 116 | [ user [ ( ":" password ) | ( ";auth=" auth ) ] "@" ] |
117 | 117 | ||
118 | host [ ":" port ] | 118 | host [ ":" port ] |
119 | 119 | ||
120 | [ ( "/" urlpath ) | ( "?" query ) ] | 120 | [ ( "/" urlpath ) | ( "?" query ) ] ] |
121 | @end example | 121 | @end example |
122 | 122 | ||
123 | This is a generalized URL syntax, and may not be exactly appropriate | 123 | This is a generalized URL syntax, and may not be exactly appropriate | ... | ... |
... | @@ -218,13 +218,13 @@ Syntax, condensed from RFC 1738, and extended with the ;auth= | ... | @@ -218,13 +218,13 @@ Syntax, condensed from RFC 1738, and extended with the ;auth= |
218 | of RFC 2384 (for POP) and RFC 2192 (for IMAP): | 218 | of RFC 2384 (for POP) and RFC 2192 (for IMAP): |
219 | 219 | ||
220 | url = | 220 | url = |
221 | scheme ":" = "//" | 221 | scheme ":" [ "//" |
222 | 222 | ||
223 | [ user [ ( ":" password ) | ( ";auth=" auth ) ] "@" ] | 223 | [ user [ ( ":" password ) | ( ";auth=" auth ) ] "@" ] |
224 | 224 | ||
225 | host [ ":" port ] | 225 | host [ ":" port ] |
226 | 226 | ||
227 | [ ( "/" urlpath ) | ( "?" query ) ] | 227 | [ ( "/" urlpath ) | ( "?" query ) ] ] |
228 | 228 | ||
229 | All hell will break loose in this parser if the user/pass/auth | 229 | All hell will break loose in this parser if the user/pass/auth |
230 | portion is missing, and the urlpath has any @ or : characters | 230 | portion is missing, and the urlpath has any @ or : characters |
... | @@ -263,8 +263,15 @@ url_parse0 (url_t u, char *name) | ... | @@ -263,8 +263,15 @@ url_parse0 (url_t u, char *name) |
263 | 263 | ||
264 | name = p; | 264 | name = p; |
265 | 265 | ||
266 | /* Check for nothing following the scheme. */ | ||
267 | if(!*name) | ||
268 | return 0; | ||
269 | |||
266 | if (strncmp (name, "//", 2) != 0) | 270 | if (strncmp (name, "//", 2) != 0) |
267 | return EPARSE; | 271 | { |
272 | u->path = name; | ||
273 | return 0; | ||
274 | } | ||
268 | 275 | ||
269 | name += 2; | 276 | name += 2; |
270 | 277 | ... | ... |
-
Please register or sign in to post a comment