mirror of
https://github.com/curl/curl.git
synced 2026-05-16 21:26:22 +03:00
url: keep the question mark for empty queries
Reported-by: Bill Mill Fixes #21544 Verified by test 1721 Closes #21584
This commit is contained in:
parent
11df1251e5
commit
b079595f2e
3 changed files with 49 additions and 3 deletions
|
|
@ -1543,7 +1543,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
|
|||
}
|
||||
|
||||
/* after it was parsed, get the generated normalized version */
|
||||
uc = curl_url_get(uh, CURLUPART_URL, &newurl, 0);
|
||||
uc = curl_url_get(uh, CURLUPART_URL, &newurl, CURLU_GET_EMPTY);
|
||||
if(uc) {
|
||||
result = Curl_uc_to_curlcode(uc);
|
||||
goto out;
|
||||
|
|
@ -1600,7 +1600,8 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
|
|||
goto out;
|
||||
}
|
||||
|
||||
uc = curl_url_get(uh, CURLUPART_QUERY, &data->state.up.query, 0);
|
||||
uc = curl_url_get(uh, CURLUPART_QUERY, &data->state.up.query,
|
||||
CURLU_GET_EMPTY);
|
||||
if(uc && (uc != CURLUE_NO_QUERY)) {
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
goto out;
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ test1680 test1681 test1682 test1683 test1684 test1685 \
|
|||
\
|
||||
test1700 test1701 test1702 test1703 test1704 test1705 test1706 test1707 \
|
||||
test1708 test1709 test1710 test1711 test1712 test1713 test1714 test1715 \
|
||||
test1720 \
|
||||
test1720 test1721 \
|
||||
\
|
||||
test1800 test1801 test1802 test1847 test1848 test1849 test1850 test1851 \
|
||||
\
|
||||
|
|
|
|||
45
tests/data/test1721
Normal file
45
tests/data/test1721
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="US-ASCII"?>
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
HTTP GET
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
<reply>
|
||||
<data crlf="headers">
|
||||
HTTP/1.1 200 OK
|
||||
Content-Length: 6
|
||||
Content-Type: text/html
|
||||
|
||||
-foo-
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
Keep question mark for empty query
|
||||
</name>
|
||||
<command>
|
||||
"http://%HOSTIP:%HTTPPORT/hello?" -w '%output{%LOGDIR/out%TESTNUMBER}%{url_effective}'
|
||||
</command>
|
||||
</client>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<file nonewline="yes" name="%LOGDIR/out%TESTNUMBER">
|
||||
http://%HOSTIP:%HTTPPORT/hello?
|
||||
</file>
|
||||
<protocol crlf="headers">
|
||||
GET /hello? HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
||||
Loading…
Add table
Add a link
Reference in a new issue