diff options
author | Marton Balint <cus@passwd.hu> | 2020-02-03 01:32:00 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2020-02-15 18:41:36 +0100 |
commit | 554576b6cfe79a91d37e14d3617ca417562085db (patch) | |
tree | 5d85a565eb2cdd02f2fdd1be9d89beb0f62f29fd /libavformat/utils.c | |
parent | 365b817b51630447305f49a4e2f79ab8ad842473 (diff) |
avformat/utils: make av_url_split search for hashmark as well to separate hostname
RFC 3986 states that the generic syntax uses the slash ("/"), question mark
("?"), and number sign ("#") characters to delimit components that are
significant to the generic parser's hierarchical interpretation of an
identifier.
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index b3fbbd1942..7ff5ea9702 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4786,7 +4786,7 @@ void av_url_split(char *proto, int proto_size, char *hostname, int hostname_size, int *port_ptr, char *path, int path_size, const char *url) { - const char *p, *ls, *ls2, *at, *at2, *col, *brk; + const char *p, *ls, *at, *at2, *col, *brk; if (port_ptr) *port_ptr = -1; @@ -4814,16 +4814,8 @@ void av_url_split(char *proto, int proto_size, } /* separate path from hostname */ - ls = strchr(p, '/'); - ls2 = strchr(p, '?'); - if (!ls) - ls = ls2; - else if (ls && ls2) - ls = FFMIN(ls, ls2); - if (ls) - av_strlcpy(path, ls, path_size); - else - ls = &p[strlen(p)]; // XXX + ls = p + strcspn(p, "/?#"); + av_strlcpy(path, ls, path_size); /* the rest is hostname, use that to parse auth/port */ if (ls != p) { |