summaryrefslogtreecommitdiff
path: root/src/IO/http.c
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-11-18 18:32:41 +0100
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-11-18 18:32:41 +0100
commitf3103cc4b6c369da96c7de487214a9e56eca755d (patch)
tree4c12f9d8ea33a5ad3a7098545fd159e3238f40fc /src/IO/http.c
parent318d1f14e699e8dd38b73fbe2f8da1c0586ccab7 (diff)
Always include the path "/" in HTTP requests
Following https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.1, the path must not be empty, even if we have a query: > If the target URI's path component is empty, the client MUST send "/" > as the path within the origin-form of request-target. Notice URIs can have empty paths, this is a restriction of HTTP only. Fixes: https://github.com/dillo-browser/dillo/issues/302
Diffstat (limited to 'src/IO/http.c')
-rw-r--r--src/IO/http.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/IO/http.c b/src/IO/http.c
index f8a1ebb2..3c178bf1 100644
--- a/src/IO/http.c
+++ b/src/IO/http.c
@@ -407,11 +407,10 @@ static Dstr *Http_make_query_str(DilloWeb *web, bool_t use_proxy, bool_t use_tls
dStr_sprintf(proxy_auth, "Proxy-Authorization: Basic %s\r\n",
HTTP_Proxy_Auth_base64);
} else {
- dStr_sprintfa(request_uri, "%s%s%s%s",
- URL_PATH(url),
+ dStr_sprintfa(request_uri, "%s%s%s",
+ URL_PATH_(url) ? URL_PATH(url) : "/",
URL_QUERY_(url) ? "?" : "",
- URL_QUERY(url),
- (URL_PATH_(url) || URL_QUERY_(url)) ? "" : "/");
+ URL_QUERY(url));
}
cookies = a_Cookies_get_query(url, web->requester);