[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 89/222: urlapi: question mark within fragment is still fragment
From: |
gnunet |
Subject: |
[gnurl] 89/222: urlapi: question mark within fragment is still fragment |
Date: |
Thu, 07 Nov 2019 00:09:45 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 6e7733f7884e82e486971260f078f6cbcbeac552
Author: Daniel Stenberg <address@hidden>
AuthorDate: Tue Sep 24 14:45:27 2019 +0200
urlapi: question mark within fragment is still fragment
The parser would check for a query part before fragment, which caused it
to do wrong when the fragment contains a question mark.
Extended test 1560 to verify.
Reported-by: Alex Konev
Fixes #4412
Closes #4413
---
lib/urlapi.c | 8 ++++----
tests/libtest/lib1560.c | 20 ++++++++++++++++++++
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/lib/urlapi.c b/lib/urlapi.c
index 1334236b2..a51428404 100644
--- a/lib/urlapi.c
+++ b/lib/urlapi.c
@@ -849,14 +849,14 @@ static CURLUcode seturl(const char *url, CURLU *u,
unsigned int flags)
if(junkscan(path))
return CURLUE_MALFORMED_INPUT;
+ fragment = strchr(path, '#');
+ if(fragment)
+ *fragment++ = 0;
+
query = strchr(path, '?');
if(query)
*query++ = 0;
- fragment = strchr(query?query:path, '#');
- if(fragment)
- *fragment++ = 0;
-
if(!path[0])
/* if there's no path set, unset */
path = NULL;
diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c
index d161423e3..7f8accc7d 100644
--- a/tests/libtest/lib1560.c
+++ b/tests/libtest/lib1560.c
@@ -140,6 +140,26 @@ static struct testcase get_parts_list[] ={
"file | [11] | [12] | [13] | [14] | [15] | C:\\programs\\foo | [16] | [17]",
CURLU_DEFAULT_SCHEME, 0, CURLUE_OK},
#endif
+ {"https://example.com/color/#green?no-black",
+ "https | [11] | [12] | [13] | example.com | [15] | /color/ | [16] | "
+ "green?no-black",
+ CURLU_DEFAULT_SCHEME, 0, CURLUE_OK },
+ {"https://example.com/color/#green#no-black",
+ "https | [11] | [12] | [13] | example.com | [15] | /color/ | [16] | "
+ "green#no-black",
+ CURLU_DEFAULT_SCHEME, 0, CURLUE_OK },
+ {"https://example.com/color/?green#no-black",
+ "https | [11] | [12] | [13] | example.com | [15] | /color/ | green | "
+ "no-black",
+ CURLU_DEFAULT_SCHEME, 0, CURLUE_OK },
+ {"https://example.com/#color/?green#no-black",
+ "https | [11] | [12] | [13] | example.com | [15] | / | [16] | "
+ "color/?green#no-black",
+ CURLU_DEFAULT_SCHEME, 0, CURLUE_OK },
+ {"https://example.#com/color/?green#no-black",
+ "https | [11] | [12] | [13] | example. | [15] | / | [16] | "
+ "com/color/?green#no-black",
+ CURLU_DEFAULT_SCHEME, 0, CURLUE_OK },
{"http://[ab.be:1]/x", "",
CURLU_DEFAULT_SCHEME, 0, CURLUE_MALFORMED_INPUT},
{"http://[ab.be]/x", "",
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] 77/222: doh: return early if there is no time left, (continued)
- [gnurl] 77/222: doh: return early if there is no time left, gnunet, 2019/11/06
- [gnurl] 90/222: altsvc: save h3 as h3-23, gnunet, 2019/11/06
- [gnurl] 102/222: quiche: set 'drain' when returning without having drained the queues, gnunet, 2019/11/06
- [gnurl] 92/222: travis: move the go install to linux-only, gnunet, 2019/11/06
- [gnurl] 100/222: HTTP3: merged and simplified the two 'running' sections, gnunet, 2019/11/06
- [gnurl] 87/222: os400: getpeername() and getsockname() return ebcdic AF_UNIX sockaddr,, gnunet, 2019/11/06
- [gnurl] 91/222: altsvc: correct the #ifdef for the ngtcp2 backend, gnunet, 2019/11/06
- [gnurl] 94/222: ngtcp2: remove fprintf() calls, gnunet, 2019/11/06
- [gnurl] 88/222: HTTP3.md: move -p for mkdir, remove -j for make, gnunet, 2019/11/06
- [gnurl] 108/222: FTP: url-decode path before evaluation, gnunet, 2019/11/06
- [gnurl] 89/222: urlapi: question mark within fragment is still fragment,
gnunet <=
- [gnurl] 93/222: url: fix the NULL hostname compiler warning case, gnunet, 2019/11/06
- [gnurl] 97/222: openssl: use strerror on SSL_ERROR_SYSCALL, gnunet, 2019/11/06
- [gnurl] 109/222: FTP: add test for FTPFILE_NOCWD: Avoid redundant CWDs, gnunet, 2019/11/06
- [gnurl] 127/222: chunked-encoding: stop hiding the CURLE_BAD_CONTENT_ENCODING error, gnunet, 2019/11/06
- [gnurl] 95/222: url: don't set appconnect time for non-ssl/non-ssh connections, gnunet, 2019/11/06
- [gnurl] 121/222: git: add tests/server/disabled to .gitignore, gnunet, 2019/11/06
- [gnurl] 122/222: AppVeyor: remove MSYS2_ARG_CONV_EXCL for winbuild, gnunet, 2019/11/06
- [gnurl] 125/222: urlapi: fix unused variable warning, gnunet, 2019/11/06
- [gnurl] 123/222: AppVeyor: add 32-bit MinGW-w64 build, gnunet, 2019/11/06
- [gnurl] 130/222: tool_operate: rename functions to make more sense, gnunet, 2019/11/06