mirror of
https://github.com/curl/curl.git
synced 2026-07-24 13:17:15 +03:00
http: look for trailing 'type=' in ftp:// without strstr
- it could find a wrong string - this is faster Closes #19065
This commit is contained in:
parent
97ae9ec8ef
commit
9441127394
1 changed files with 18 additions and 19 deletions
37
lib/http.c
37
lib/http.c
|
|
@ -2040,27 +2040,26 @@ static CURLcode http_target(struct Curl_easy *data,
|
|||
if(result)
|
||||
return result;
|
||||
|
||||
if(curl_strequal("ftp", data->state.up.scheme)) {
|
||||
if(data->set.proxy_transfer_mode) {
|
||||
/* when doing ftp, append ;type=<a|i> if not present */
|
||||
char *type = strstr(path, ";type=");
|
||||
if(type && type[6] && type[7] == 0) {
|
||||
switch(Curl_raw_toupper(type[6])) {
|
||||
case 'A':
|
||||
case 'D':
|
||||
case 'I':
|
||||
break;
|
||||
default:
|
||||
type = NULL;
|
||||
}
|
||||
}
|
||||
if(!type) {
|
||||
result = curlx_dyn_addf(r, ";type=%c",
|
||||
data->state.prefer_ascii ? 'a' : 'i');
|
||||
if(result)
|
||||
return result;
|
||||
if(curl_strequal("ftp", data->state.up.scheme) &&
|
||||
data->set.proxy_transfer_mode) {
|
||||
/* when doing ftp, append ;type=<a|i> if not present */
|
||||
size_t len = strlen(path);
|
||||
bool type_present = FALSE;
|
||||
if((len >= 7) && !memcmp(&path[len - 7], ";type=", 6)) {
|
||||
switch(Curl_raw_toupper(path[len - 1])) {
|
||||
case 'A':
|
||||
case 'D':
|
||||
case 'I':
|
||||
type_present = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!type_present) {
|
||||
result = curlx_dyn_addf(r, ";type=%c",
|
||||
data->state.prefer_ascii ? 'a' : 'i');
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue