summaryrefslogtreecommitdiff
path: root/src/IO
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-10-15 20:30:14 +0200
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-10-17 20:03:45 +0200
commit9f44eb55c67cebd6b2b70758d9a5abf37b8d0fde (patch)
treef577b624a72b64aca95b7be83d153dcba6c99344 /src/IO
parente4225afe894a59c76b6d24d74c52929421f8c0c8 (diff)
Only use full URL for HTTP proxies
When performing a HTTPS request over a HTTP proxy, a direct connection is made to the remote server, so the GET line will be received as is. Therefore we shouldn't send the full URL but just the path. Fixes: https://github.com/dillo-browser/dillo/issues/279
Diffstat (limited to 'src/IO')
-rw-r--r--src/IO/http.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/IO/http.c b/src/IO/http.c
index c7915fc5..f8a1ebb2 100644
--- a/src/IO/http.c
+++ b/src/IO/http.c
@@ -380,7 +380,7 @@ static Dstr *Http_make_content_type(const DilloUrl *url)
/**
* Make the http query string
*/
-static Dstr *Http_make_query_str(DilloWeb *web, bool_t use_proxy)
+static Dstr *Http_make_query_str(DilloWeb *web, bool_t use_proxy, bool_t use_tls)
{
char *ptr, *cookies, *referer, *auth;
const DilloUrl *url = web->url;
@@ -397,7 +397,7 @@ static Dstr *Http_make_query_str(DilloWeb *web, bool_t use_proxy)
const char *connection_hdr_val =
(prefs.http_persistent_conns == TRUE) ? "keep-alive" : "close";
- if (use_proxy) {
+ if (use_proxy && !use_tls) {
dStr_sprintfa(request_uri, "%s%s",
URL_STR(url),
(URL_PATH_(url) || URL_QUERY_(url)) ? "" : "/");
@@ -485,7 +485,9 @@ static void Http_send_query(SocketData_t *S)
DataBuf *dbuf;
/* Create the query */
- query = Http_make_query_str(S->web, S->flags & HTTP_SOCKET_USE_PROXY);
+ query = Http_make_query_str(S->web,
+ S->flags & HTTP_SOCKET_USE_PROXY,
+ S->flags & HTTP_SOCKET_TLS);
dbuf = a_Chain_dbuf_new(query->str, query->len, 0);
MSG_BW(S->web, 1, "Sending query%s...",