diff --git a/lib/url.c b/lib/url.c
index b0a348b887..b715e998fc 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.
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 93709741f6..6c8718e814 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -68,7 +68,7 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
test1108 test1109 test1110 test1111 test1112 test129 test567 test568 \
test569 test570 test571 test572 test804 test805 test806 test807 test573 \
test313 test1115 test578 test579 test1116 test1200 test1201 test1202 \
- test1203 test1117
+ test1203 test1117 test1118
filecheck:
@mkdir test-place; \
diff --git a/tests/data/test1118 b/tests/data/test1118
new file mode 100644
index 0000000000..bc776aff6c
--- /dev/null
+++ b/tests/data/test1118
@@ -0,0 +1,55 @@
+
+
+
+HTTP
+HTTP GET
+
+
+
+#
+# Server-side
+
+
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
+ETag: "21025-dc7-39462498"
+Accept-Ranges: bytes
+Content-Length: 6
+Connection: close
+Content-Type: text/html
+Funny-head: yesyes
+
+-foo-
+
+
+
+#
+# Client-side
+
+
+http
+
+
+URL without slash and @-letter in query
+
+
+http://%HOSTIP:%HTTPPORT?email=name@example.com/1118
+
+
+
+#
+# Verify data after the test has been "shot"
+
+
+^User-Agent:.*
+
+
+GET /?email=name@example.com/1118 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+
+
+
diff --git a/tests/data/test191 b/tests/data/test191
index 090d4c5b69..2c56cc82eb 100644
--- a/tests/data/test191
+++ b/tests/data/test191
@@ -15,7 +15,7 @@ ftp
FTP URL with ?-letters in username and password
-"ftp://use?r:pass?word@%HOSTIP:%FTPPORT/191"
+"ftp://use%3fr:pass%3fword@%HOSTIP:%FTPPORT/191"