mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-11-10 23:00:57 +00:00
Merge pull request #555 from orozery/dont_sign_empty_headers
don't sign empty headers (as they are discarded by libcurl)
This commit is contained in:
commit
edcf4c6218
12
src/curl.cpp
12
src/curl.cpp
@ -4073,6 +4073,10 @@ string get_sorted_header_keys(const struct curl_slist* list)
|
|||||||
string strkey = list->data;
|
string strkey = list->data;
|
||||||
size_t pos;
|
size_t pos;
|
||||||
if(string::npos != (pos = strkey.find(':', 0))){
|
if(string::npos != (pos = strkey.find(':', 0))){
|
||||||
|
if (trim(strkey.substr(pos + 1)).empty()) {
|
||||||
|
// skip empty-value headers (as they are discarded by libcurl)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
strkey = strkey.substr(0, pos);
|
strkey = strkey.substr(0, pos);
|
||||||
}
|
}
|
||||||
if(0 < sorted_headers.length()){
|
if(0 < sorted_headers.length()){
|
||||||
@ -4099,6 +4103,10 @@ string get_canonical_headers(const struct curl_slist* list)
|
|||||||
if(string::npos != (pos = strhead.find(':', 0))){
|
if(string::npos != (pos = strhead.find(':', 0))){
|
||||||
string strkey = trim(lower(strhead.substr(0, pos)));
|
string strkey = trim(lower(strhead.substr(0, pos)));
|
||||||
string strval = trim(strhead.substr(pos + 1));
|
string strval = trim(strhead.substr(pos + 1));
|
||||||
|
if (strval.empty()) {
|
||||||
|
// skip empty-value headers (as they are discarded by libcurl)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
strhead = strkey + string(":") + strval;
|
strhead = strkey + string(":") + strval;
|
||||||
}else{
|
}else{
|
||||||
strhead = trim(lower(strhead));
|
strhead = trim(lower(strhead));
|
||||||
@ -4124,6 +4132,10 @@ string get_canonical_headers(const struct curl_slist* list, bool only_amz)
|
|||||||
if(string::npos != (pos = strhead.find(':', 0))){
|
if(string::npos != (pos = strhead.find(':', 0))){
|
||||||
string strkey = trim(lower(strhead.substr(0, pos)));
|
string strkey = trim(lower(strhead.substr(0, pos)));
|
||||||
string strval = trim(strhead.substr(pos + 1));
|
string strval = trim(strhead.substr(pos + 1));
|
||||||
|
if (strval.empty()) {
|
||||||
|
// skip empty-value headers (as they are discarded by libcurl)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
strhead = strkey + string(":") + strval;
|
strhead = strkey + string(":") + strval;
|
||||||
}else{
|
}else{
|
||||||
strhead = trim(lower(strhead));
|
strhead = trim(lower(strhead));
|
||||||
|
Loading…
Reference in New Issue
Block a user