URL parser: cut off '#' fragments from URLs (better)
The existing logic only cut off the fragment from the separate 'path' buffer which is used when sending HTTP to hosts. The buffer that held the full URL used for proxies were not dealt with. It is now. Test case 5 was updated to use a fragment on a URL over a proxy. Bug: http://curl.haxx.se/bug/view.cgi?id=3579813
This commit is contained in:
parent
3f20303702
commit
473003fbdf
10
lib/url.c
10
lib/url.c
@ -3987,9 +3987,17 @@ static CURLcode parseurlandfillconn(struct SessionHandle *data,
|
|||||||
last part of the URI. We are looking for the first '#' so that we deal
|
last part of the URI. We are looking for the first '#' so that we deal
|
||||||
gracefully with non conformant URI such as http://example.com#foo#bar. */
|
gracefully with non conformant URI such as http://example.com#foo#bar. */
|
||||||
fragment = strchr(path, '#');
|
fragment = strchr(path, '#');
|
||||||
if(fragment)
|
if(fragment) {
|
||||||
*fragment = 0;
|
*fragment = 0;
|
||||||
|
|
||||||
|
/* we know the path part ended with a fragment, so we know the full URL
|
||||||
|
string does too and we need to cut it off from there so it isn't used
|
||||||
|
over proxy */
|
||||||
|
fragment = strchr(data->change.url, '#');
|
||||||
|
if(fragment)
|
||||||
|
*fragment = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* So if the URL was A://B/C#D,
|
* So if the URL was A://B/C#D,
|
||||||
* protop is A
|
* protop is A
|
||||||
|
@ -29,7 +29,7 @@ http
|
|||||||
HTTP over proxy
|
HTTP over proxy
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
http://%HOSTIP:%HTTPPORT/we/want/that/page/5 -x %HOSTIP:%HTTPPORT
|
http://%HOSTIP:%HTTPPORT/we/want/that/page/5#5 -x %HOSTIP:%HTTPPORT
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user