microsoft/cpprestsdk
Multiple Set-Cookie headers in CPPRESTSDK
Aberta
#210 aberto em 29 de jul. de 2016
bughelp wanted
Métricas do repositório
- Stars
- (7.596 estrelas)
- Métricas de merge de PR
- (Métricas PR pendentes)
Description
Hi,
I found that the implementation of web::http::http_header::add simply append the old header value with a new value using comma(',') as a separator.
void add(const key_type& name, const _t1& value)
{
if (has(name))
{
m_headers[name] = m_headers[name].append(_XPLATSTR(", ") + utility::conversions::print_string(value));
}
else
{
m_headers[name] = utility::conversions::print_string(value);
}
}
This make all "Set-Cookie" headers combined into one. It breaks the rfc6265 and it does not work for all browsers(i tested with Chrome, IE, and FireFox).
here is a snapshot for the RFC
Origin servers SHOULD NOT fold multiple Set-Cookie header fields into
a single header field. The usual mechanism for folding HTTP headers
fields (i.e., as defined in [RFC2616]) might change the semantics of
the Set-Cookie header field because the %x2C (",") character is used
by Set-Cookie in a way that conflicts with such folding.
What I expect is that everytimes I call web::http::http_header::add I should get multiple 'Set-Header' in response.
So please advise if this should be fixed in the library.