query-part: ignore the URI part for given protocols
By setting PROTOPT_NOURLQUERY in the protocol handler struct, the protocol will get the "query part" of the URL cut off before the data is handled by the protocol-specific code. This makes libcurl adhere to RFC3986 section 2.2. Test 1220 is added to verify a file:// URL with query-part.
This commit is contained in:
committed by
Daniel Stenberg
parent
4403e82f32
commit
2c905fd1f8
19
lib/url.c
19
lib/url.c
@@ -4824,6 +4824,25 @@ static CURLcode create_conn(struct SessionHandle *data,
|
||||
if(result != CURLE_OK)
|
||||
return result;
|
||||
|
||||
|
||||
/*************************************************************
|
||||
* If the protocol can't handle url query strings, then cut
|
||||
* of the unhandable part
|
||||
*************************************************************/
|
||||
if((conn->given->flags&PROTOPT_NOURLQUERY)) {
|
||||
char *path_q_sep = strchr(conn->data->state.path, '?');
|
||||
if(path_q_sep) {
|
||||
/* according to rfc3986, allow the query (?foo=bar)
|
||||
also on protocols that can't handle it.
|
||||
|
||||
cut the string-part after '?'
|
||||
*/
|
||||
|
||||
/* terminate the string */
|
||||
path_q_sep[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
/*************************************************************
|
||||
* Extract the user and password from the authentication string
|
||||
|
||||
Reference in New Issue
Block a user