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 » HttpRequest ignores server errors
HttpRequest ignores server errors [message #48739] Wed, 06 September 2017 13:24 Go to previous message
Zbych is currently offline  Zbych
Messages: 313
Registered: July 2009
Senior Member
Hi,

I made some simple test and it appears that HttpRequest likes to ignore error code returned by http server.
Simple example:
	HttpRequest conn("http://google.com/nonexistingpage");
	conn.Trace(true);
	Value resp = conn.Execute();
	RDUMP(conn.IsFailure());
	RDUMP(conn.GetStatusCode());
	RDUMP(conn.GetErrorDesc());
	RDUMP(conn.IsError());
	RDUMP(resp.IsError());


and trace:
06.09.2017 13:11:14 HTTP START
06.09.2017 13:11:14 Using google.com:80
06.09.2017 13:11:14 Starting status 2 'Resolving host name', url: google.com
06.09.2017 13:11:14 HTTP Execute: Resolving host name
06.09.2017 13:11:14 HTTP StartConnect
06.09.2017 13:11:14 HTTP AfterConnect
06.09.2017 13:11:14 Starting status 6 'Sending request', url: google.com
06.09.2017 13:11:14 HTTP REQUEST google.com:0
06.09.2017 13:11:14 HTTP request:
06.09.2017 13:11:14 GET /nonexistingpage HTTP/1.1
06.09.2017 13:11:14 URL: http://google.com/nonexistingpage
06.09.2017 13:11:14 Host: google.com
06.09.2017 13:11:14 Connection: close
06.09.2017 13:11:14 Accept: */*
06.09.2017 13:11:14 Accept-Encoding: gzip
06.09.2017 13:11:14 User-Agent: U++ HTTP request
06.09.2017 13:11:14 
06.09.2017 13:11:14 HTTP request body:
06.09.2017 13:11:14 
06.09.2017 13:11:14 HTTP Execute: Sending request
06.09.2017 13:11:14 Starting status 7 'Receiving header', url: google.com
06.09.2017 13:11:14 HTTP Execute: Receiving header
06.09.2017 13:11:14 HTTP Header received: 
06.09.2017 13:11:14 HTTP/1.1 404 Not Found
06.09.2017 13:11:14 Content-Type: text/html; charset=UTF-8
06.09.2017 13:11:14 Referrer-Policy: no-referrer
06.09.2017 13:11:14 Content-Length: 1576
06.09.2017 13:11:14 Date: Wed, 06 Sep 2017 11:11:14 GMT
06.09.2017 13:11:14 Connection: close
06.09.2017 13:11:14 
06.09.2017 13:11:14 
06.09.2017 13:11:14 HTTP status code: 404
06.09.2017 13:11:14 Starting status 8 'Receiving content', url: google.com
06.09.2017 13:11:14 HTTP Execute: Receiving content
06.09.2017 13:11:14 HTTP reading body 1576
06.09.2017 13:11:14 HTTP Out 1576
06.09.2017 13:11:14 conn.IsFailure() = false
06.09.2017 13:11:14 conn.GetStatusCode() = 404
06.09.2017 13:11:14 conn.GetErrorDesc() = 
06.09.2017 13:11:14 conn.IsError() = false
06.09.2017 13:11:14 resp.IsError() = false


As you can see server returned code 404, but IsFailure(), IsError(), GetErrorDesc() ignored it.
At least IsFailure() should return true if code is not 2xx, according to the docs.
How about IsHttpError, IsError, GetErrorDesc?
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Code before Thread.Run() nor executed
Next Topic: AsyncWork, IsFinished() may not be working properly
Goto Forum:
  


Current Time: Sat Jul 11 19:51:04 CEST 2020

Total time taken to generate the page: 0.01220 seconds