Home » U++ Library support » Skylark » Http::Finalize adds Content-Type even when it is empty
Http::Finalize adds Content-Type even when it is empty [message #59120] |
Sun, 06 November 2022 11:49 |
Zbych
Messages: 327 Registered: July 2009
|
Senior Member |
|
|
Hi,
Http::Finalize in Skylark shouldn't add Content-Type header when content_type is empty.
void Http::Finalize()
{
if(rsocket) {
SKYLARKLOG("=== Response: " << code << ' ' << code_text);
String r;
// weird apache2 mod_scgi behaviour
if(hdr.scgi)
r << "Status: ";
else
r << "HTTP/1.1 ";
if(redirect.GetCount()) {
// for SCGI (at least on apache 2 mod_scgi), we need protocol inside url
if(hdr.scgi && redirect.Find(":") < 0)
redirect = "http:" + redirect;
SKYLARKLOG("Redirect to: " << redirect);
r << code << " Found\r\n";
r << "Location: " << redirect << "\r\n";
for(int i = 0; i < cookies.GetCount(); i++)
r << cookies[i];
}
else {
r <<
code << ' ' << code_text << "\r\n"
"Date: " << WwwFormat(GetUtcTime()) << "\r\n"
"Content-Length: " << response.GetCount() << "\r\n"
<< (content_type.GetLength() ? ("Content-Type: " << content_type << "\r\n") : ""); //<------------ FIX
for(int i = 0; i < headers.GetCount(); i++)
r << headers.GetKey(i) << ": " << headers[i] << "\r\n";
for(int i = 0; i < cookies.GetCount(); i++)
r << cookies[i];
}
r << "\r\n";
rsocket->PutAll(r);
rsocket->PutAll(response);
rsocket = NULL;
}
}
|
|
|
Re: Http::Finalize adds Content-Type even when it is empty [message #59121 is a reply to message #59120] |
Sun, 06 November 2022 20:13 |
|
Klugier
Messages: 1087 Registered: September 2012 Location: Poland, Kraków
|
Senior Contributor |
|
|
Hello Zbych,
Please create PR for Skylar repo with proposed changed. It seems that Mirek doesn't actively develop Skylark anymore and it would be good if somebody will take it from him. So, even if the fix is correct, it might not be applied. Also, having PR in place it is unlikely that the change will not be addressed. With the forum post it might happened.
Klugier
U++ - one framework to rule them all.
[Updated on: Sun, 06 November 2022 20:14] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Sat Dec 14 15:18:07 CET 2024
Total time taken to generate the page: 0.04199 seconds
|