Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » Skylark and SCGI
Skylark and SCGI [message #40269] Sun, 14 July 2013 11:21 Go to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Hi,

I'm trying to use Skylark01 tutorial code in SCGI mode.
I configured apache to redirect ol requests on

/ucloud


over a SCGI server on port 8001, which should be the default of Skylark.
The server runs ok and is accepting connections, but the result in webpage is :

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


And the apache error log shows this one :

[Sun Jul 14 11:15:11 2013] [error] [client 127.0.0.1] Premature end of script headers: ucloud
[Sun Jul 14 11:15:11 2013] [error] [client 127.0.0.1] (500)Unknown error 500: scgi: error reading response headers


What am I doing wrong ???
Re: Skylark and SCGI [message #40270 is a reply to message #40269] Sun, 14 July 2013 13:14 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Some progress... I found that

HttpHeader::ParseSCGI

always returns false, which make in turn
HttpHeader::Read()

Always return false in SCGI mode. Headers are indeed correctly read. Http::Dispatch(), with HttpHeader::Read() returning false don't go further.

Making ParseSCGI return true, the Dispatch() can proceed, but web page still shows same error.
Apache error log is now :
[Sun Jul 14 13:05:41 2013] [error] [client 127.0.0.1] malformed header from script. Bad header=HTTP/1.1 200 : ucloud
[Sun Jul 14 13:05:41 2013] [error] [client 127.0.0.1] (500)Unknown error 500: scgi: error reading response headers


Any hint ?
Re: Skylark and SCGI [message #40272 is a reply to message #40270] Sun, 14 July 2013 14:35 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
More findings: in Http::Finalize()
void Http::Finalize()
{
	if(rsocket) {
		SKYLARKLOG("=== Response: " << code << ' ' << code_text);
		String r;
		if(redirect.GetCount()) {
			SKYLARKLOG("Redirect to: " << redirect);
			r << "HTTP/1.1 " << code << " Found\r\n";
			r << "Location: " << redirect << "\r\n";
			for(int i = 0; i < cookies.GetCount(); i++)
				r << cookies[i];
		}
		else {
			r <<
				"HTTP/1.1 " << 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;
	}
}


The 'code_text' string, which should be 'OK', is empty, and the 'r' string is missing the 'Status :' part.
So, the first line sent to browser is
200

instead of
Status : 200 OK


I don't know how is SCGI related.....

Max
Re: Skylark and SCGI [message #40273 is a reply to message #40272] Sun, 14 July 2013 17:02 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Proposed solution :

1) make HttpHeader::ParseSCGI() return true

2) Change Http::Finalize() like this :
void Http::Finalize()
{
	if(rsocket) {
		SKYLARKLOG("=== Response: " << code << ' ' << code_text);
		String r;
--->		if(hdr.scgi)
--->			r << ":";

Re: Skylark and SCGI [message #40299 is a reply to message #40273] Tue, 16 July 2013 08:42 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Should be now resolved...

Mirek
Previous Topic: SSL sockets example
Next Topic: Probable bug in Skylark and sessions
Goto Forum:
  


Current Time: Fri Apr 19 23:27:03 CEST 2024

Total time taken to generate the page: 0.03675 seconds