[GH-ISSUE #100] HttpRequest doesn't return valid HTTP error code #54

Closed
opened 2026-05-05 03:36:25 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @klugier on GitHub (Sep 28, 2022).
Original GitHub issue: https://github.com/ultimatepp/ultimatepp/issues/100

Following code:

#include <Core/Core.h>

using namespace Upp;

CONSOLE_APP_MAIN
{
	HttpRequest r("https://github.com/ultimatepp/UppHub/blob/main/nests.jsonhjb");
	r.Execute();
	Cout() << "Error: " << r.IsError() << ", HttpError: " << r.IsHttpError() << ", StatusCode: " << r.GetStatusCode() << "\n";
}

prints:
Error: true, HttpError: false, StatusCode: 0

instead of
Error: true, HttpError: true, StatusCode: 404

In such case system wget returns:

klugier@X470Pro:~ $ wget https://github.com/ultimatepp/UppHub/blob/main/nests.jsonhjb
--2022-09-28 21:29:24--  https://github.com/ultimatepp/UppHub/blob/main/nests.jsonhjb
Załadowano certyfikat CA '/etc/ssl/certs/ca-certificates.crt'
Translacja github.com (github.com)... 140.82.121.3
Łączenie się z github.com (github.com)|140.82.121.3|:443... połączono.
Żądanie HTTP wysłano, oczekiwanie na odpowiedź... 404 Not Found
2022-09-28 21:29:25 BŁĄD 404: Not Found.

Looks like ciritical error to me, it is basic http request scenario which return wrong values...

Originally created by @klugier on GitHub (Sep 28, 2022). Original GitHub issue: https://github.com/ultimatepp/ultimatepp/issues/100 Following code: ``` #include <Core/Core.h> using namespace Upp; CONSOLE_APP_MAIN { HttpRequest r("https://github.com/ultimatepp/UppHub/blob/main/nests.jsonhjb"); r.Execute(); Cout() << "Error: " << r.IsError() << ", HttpError: " << r.IsHttpError() << ", StatusCode: " << r.GetStatusCode() << "\n"; } ``` prints: `Error: true, HttpError: false, StatusCode: 0` instead of `Error: true, HttpError: true, StatusCode: 404` In such case system wget returns: ``` klugier@X470Pro:~ $ wget https://github.com/ultimatepp/UppHub/blob/main/nests.jsonhjb --2022-09-28 21:29:24-- https://github.com/ultimatepp/UppHub/blob/main/nests.jsonhjb Załadowano certyfikat CA '/etc/ssl/certs/ca-certificates.crt' Translacja github.com (github.com)... 140.82.121.3 Łączenie się z github.com (github.com)|140.82.121.3|:443... połączono. Żądanie HTTP wysłano, oczekiwanie na odpowiedź... 404 Not Found 2022-09-28 21:29:25 BŁĄD 404: Not Found. ``` Looks like ciritical error to me, it is basic http request scenario which return wrong values...
Author
Owner

@klugier commented on GitHub (Sep 28, 2022):

OK, it was lack of SSL package.

<!-- gh-comment-id:1261451187 --> @klugier commented on GitHub (Sep 28, 2022): OK, it was lack of SSL package.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/ultimatepp#54
No description provided.