aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2010-10-19 20:20:06 +0200
committerDaniel Stenberg <daniel@haxx.se>2010-10-19 20:20:06 +0200
commit98d9dc78407eff15ebf566fe08df2e1b4fd18baf (patch)
treefe345807566d5b03303b7cbf8c9764c2c61859e3 /lib/url.c
parent6164d40fce532a6aa45b09789b28eae8ca7acf2a (diff)
URL-parsing: consider ? a divider
The URL parser got a little stricter as it now considers a ? to be a host name divider so that the slightly sloppier URLs work too. The problem that made me do this change was the reported problem with an URL like: www.example.com?email=name@example.com This form of URL is not really a legal URL (due to the missing slash after the host name) but is widely accepted by all major browsers and libcurl also already accepted it, it was just the '@' letter that triggered the problem now. The side-effect of this change is that now libcurl no longer accepts the ? letter as part of user-name or password when given in the URL, which it used to accept (and is tested in test 191). That letter is however mentioned in RFC3986 to be required to be percent encoded since it is used as a divider. Bug: http://curl.haxx.se/bug/view.cgi?id=3090268
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/url.c b/lib/url.c
index b0a348b88..b715e998f 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -3597,7 +3597,7 @@ static CURLcode parseurlandfillconn(struct SessionHandle *data,
path[0]=0;
if(2 > sscanf(data->change.url,
- "%15[^\n:]://%[^\n/]%[^\n]",
+ "%15[^\n:]://%[^\n/?]%[^\n]",
protobuf,
conn->host.name, path)) {
@@ -3605,7 +3605,7 @@ static CURLcode parseurlandfillconn(struct SessionHandle *data,
* The URL was badly formatted, let's try the browser-style _without_
* protocol specified like 'http://'.
*/
- rc = sscanf(data->change.url, "%[^\n/]%[^\n]", conn->host.name, path);
+ rc = sscanf(data->change.url, "%[^\n/?]%[^\n]", conn->host.name, path);
if(1 > rc) {
/*
* We couldn't even get this format.