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 » [FIXED]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC)
Re: [BUG]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC) [message #46323 is a reply to message #46321] Tue, 19 April 2016 11:01 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
Thanks. You were (mostly) right all the time, I was wrong. I got messed up the trailer and the empty line.

Anyway, deeper digging into HTTP specs revealed that in theory, (main) HTTP header can be empty just as well as chunked trailer. So perhaps the really correct fix should be in ReadingHeader:

bool HttpRequest::ReadingHeader()
{
	for(;;) {
		int c = TcpSocket::Get();
		if(c < 0)
			return !IsEof();
		else
			data.Cat(c);
		if(data.GetCount() == 2 && data[0] == '\r' && data[1] == '\n') // header is empty
			return false;
		if(data.GetCount() >= 3) {
			const char *h = data.Last();
			if(h[0] == '\n' && h[-1] == '\r' && h[-2] == '\n') // empty ending line after non-empty header
				return false;
		}
		if(data.GetCount() > max_header_size) {
			HttpError("HTTP header exceeded " + AsString(max_header_size));
			return true;
		}
	}
}


(now on svn...)

Do you think this is correct?
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: HttpRequest : Add custon authentication capability
Next Topic: NTLM Authentication for HttpRequest
Goto Forum:
  


Current Time: Sat May 11 20:19:56 CEST 2024

Total time taken to generate the page: 0.02424 seconds