Bug #495

Another problem with Skylark over SCGI

Added by Massimo Del Fedele almost 11 years ago. Updated over 10 years ago.

Status:ApprovedStart date:07/17/2013
Priority:HighDue date:
Assignee:Miroslav Fidler% Done:

0%

Category:-Spent time:-
Target version:-

Description

Hi,

Apache2 mod_scgi has some quirks; here the solution :

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: " << content_type << "\r\n";
            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;
    }
}

History

#1 Updated by Miroslav Fidler over 10 years ago

  • Status changed from New to Approved

Also available in: Atom PDF