}
/* "//" host [ ":" port ] */
- if ((ret = uri_parse_authority(parser, &auth)) < 0)
+ if ((ret = uri_parse_slashslash_authority(parser, &auth)) < 0)
return FALSE;
if (ret > 0) {
if (auth.enc_userinfo != NULL) {
*/
/* "//" iserver */
- if ((ret = uri_parse_authority(parser, &auth)) <= 0)
+ if ((ret = uri_parse_slashslash_authority(parser, &auth)) <= 0)
return ret;
/* iuserinfo = enc-user [iauth] / [enc-user] iauth */
return 0;
}
-int uri_parse_authority(struct uri_parser *parser, struct uri_authority *auth)
+int uri_parse_authority(struct uri_parser *parser,
+ struct uri_authority *auth)
{
const unsigned char *p;
int ret;
- /* hier-part = "//" authority {...}
- * relative-part = "//" authority {...}
+ /*
* authority = [ userinfo "@" ] host [ ":" port ]
*/
- /* Parse "//" as part of authority */
- if ((parser->end - parser->cur) <= 2 || parser->cur[0] != '/' ||
- parser->cur[1] != '/')
- return 0;
- parser->cur += 2;
-
if (auth != NULL)
memset(auth, 0, sizeof(*auth));
return 1;
}
+int uri_parse_slashslash_authority(struct uri_parser *parser,
+ struct uri_authority *auth)
+{
+ /* "//" authority */
+
+ if ((parser->end - parser->cur) <= 2 || parser->cur[0] != '/' ||
+ parser->cur[1] != '/')
+ return 0;
+
+ return uri_parse_authority(parser, auth);
+}
+
int uri_parse_path_segment(struct uri_parser *parser, const char **segment_r)
{
const unsigned char *p = parser->cur;
int uri_cut_scheme(const char **uri_p, const char **scheme_r);
int uri_parse_scheme(struct uri_parser *parser, const char **scheme_r);
-int uri_parse_authority(struct uri_parser *parser, struct uri_authority *auth);
+int uri_parse_authority(struct uri_parser *parser,
+ struct uri_authority *auth);
+int uri_parse_slashslash_authority(struct uri_parser *parser,
+ struct uri_authority *auth);
int uri_parse_path_segment(struct uri_parser *parser, const char **segment_r);
int uri_parse_path(struct uri_parser *parser, int *relative_r,