From e79f003a79eef4d6c5eb8443c5f19053d233105a Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 6 Aug 2019 17:23:49 +0200 Subject: [PATCH] Prepend scheme://host to location if server returns only path. --- src/lib/uri.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/uri.cpp b/src/lib/uri.cpp index 06ea4b8..41842a2 100644 --- a/src/lib/uri.cpp +++ b/src/lib/uri.cpp @@ -169,7 +169,13 @@ namespace remwharead case 303: // HTTPResponse::HTTP_SEE_OTHER case 307: // HTTPResponse::HTTP_TEMPORARY_REDIRECT { - return make_request(response.get("Location")); + string location = response.get("Location"); + if (location.substr(0, 4) != "http") + { + location = poco_uri.getScheme() + "://" + poco_uri.getHost() + + location; + } + return make_request(location); } case HTTPResponse::HTTP_OK: {