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)
[FIXED]HttpRequest hangs when Chunked response, without trailer, and KeepAlive is set. (patch & TC) [message #46292] Fri, 08 April 2016 19:44 Go to previous message
omari is currently offline  omari
Messages: 265
Registered: March 2010
Experienced Member
Hi,

When HttpRequest is in TRAILER phase, he call ReadingHeader().

buf if there is no trailer, the socket contain only two charachter: \r\n.
because ReadingHeader() read at least three characters, il hangs waiting a third one.

Here a Test Case:
	HttpRequest r("http://dev.alt.cloudappsportal.com/_api/web/lists");
	r.KeepAlive().Execute();


A solution is to check if there is a trailer, and if not, read only \r\n and finish:

in the file Core\Http.cpp
Line : 385
replace :
	case TRAILER:		
		if(ReadingHeader())
			break;
		header.ParseAdd(data);
		Finish();
		break;
	case FINISHED:


by
	case TRAILER:
		if(TcpSocket::Peek() == '\r') // if the next line is empty (then no trailer)
		{
			TcpSocket::Get();
			c2 = TcpSocket::Get();
			if(c2 != '\n')
				HttpError("missing ending CRLF");
			Finish();
			break;
		}
		
		if(ReadingHeader())
			break;
		header.ParseAdd(data);
		Finish();
		break;
	case FINISHED:


regards
omari.

[Updated on: Sat, 18 March 2017 16:01]

Report message to a moderator

 
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: Wed Apr 24 20:29:46 CEST 2024

Total time taken to generate the page: 0.02398 seconds