diff options
author | George Hazan <george.hazan@gmail.com> | 2024-01-05 21:45:35 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-01-05 21:45:35 +0300 |
commit | 4613d35d01e7035db70e91ef119bf49271b8f108 (patch) | |
tree | f00644fbdeb47cf924a254cc4998dfd4786352b8 /src/mir_app | |
parent | 354817476c28ca7a1d1c1343037ceb86bdc6d830 (diff) |
minor fixes for HTTP headers' processing
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/MHttpHeaders.cpp | 14 | ||||
-rw-r--r-- | src/mir_app/src/netlib_http.cpp | 2 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/mir_app/src/MHttpHeaders.cpp b/src/mir_app/src/MHttpHeaders.cpp index 7681f2aa1b..8fad0a1768 100644 --- a/src/mir_app/src/MHttpHeaders.cpp +++ b/src/mir_app/src/MHttpHeaders.cpp @@ -70,13 +70,17 @@ CMStringA MHttpHeaders::GetCookies() const if (mir_strcmpi(it->szName, "Set-Cookie")) continue; - if (!ret.IsEmpty()) - ret.Append("; "); - + CMStringA szCookie; if (const char *p = strchr(it->szValue, ';')) - ret.Append(it->szValue, p - it->szValue.get()); + szCookie.Append(it->szValue, p - it->szValue.get()); else - ret.Append(it->szValue); + szCookie = it->szValue; + + szCookie.TrimRight(); + + if (!ret.IsEmpty()) + ret.Append("; "); + ret += szCookie; } return ret; } diff --git a/src/mir_app/src/netlib_http.cpp b/src/mir_app/src/netlib_http.cpp index 41951bd126..259b6aa670 100644 --- a/src/mir_app/src/netlib_http.cpp +++ b/src/mir_app/src/netlib_http.cpp @@ -461,7 +461,7 @@ static MHttpResponse* Netlib_RecvHttpHeaders(NetlibConnection *nlc, int flags) }
*pColon = 0;
- nlhr->AddHeader(rtrim(pbuffer), lrtrimp(pColon + 1));
+ nlhr->insert(new MHttpHeader(rtrim(pbuffer), lrtrimp(pColon + 1)));
pbuffer = peol + 1;
}
|