From f569f4676231f5ed845a3e7bfabb407763aea80b Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 15 Oct 2024 20:30:14 +0200 Subject: [PATCH] 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 --- ChangeLog | 1 + src/IO/http.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a9a06c5..a59b546c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,7 @@ dillo-3.2.0 [Not released yet] - Fix use-after-free on errors in TLS connection. - Add scrollbar_page_mode option to easily scroll full pages with the mouse. - Control the page overlap with the scroll_page_overlap option. + - Fix GET requests over HTTPS via a proxy. Patches: Rodrigo Arias Mallo +- Add primitive support for SVG using the nanosvg.h library. - Add support for ch, rem, vw, vh, vmin and vmax CSS units. 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...",