|
|
ba028ab |
From 3c54eaf986d62a1f7482b8d5fff2d6ac42d19f23 Mon Sep 17 00:00:00 2001
|
|
|
ba028ab |
From: Daniel Stenberg <daniel@haxx.se>
|
|
|
ba028ab |
Date: Thu, 6 Oct 2022 14:13:36 +0200
|
|
|
ba028ab |
Subject: [PATCH 1/2] http_proxy: restore the protocol pointer on error
|
|
|
ba028ab |
|
|
|
ba028ab |
Reported-by: Trail of Bits
|
|
|
ba028ab |
|
|
|
ba028ab |
Closes #9790
|
|
|
ba028ab |
|
|
|
ba028ab |
Upstream-commit: 55e1875729f9d9fc7315cec611bffbd2c817ad89
|
|
|
ba028ab |
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
|
ba028ab |
---
|
|
|
ba028ab |
lib/http_proxy.c | 6 ++----
|
|
|
ba028ab |
lib/url.c | 9 ---------
|
|
|
ba028ab |
2 files changed, 2 insertions(+), 13 deletions(-)
|
|
|
ba028ab |
|
|
|
ba028ab |
diff --git a/lib/http_proxy.c b/lib/http_proxy.c
|
|
|
ba028ab |
index 1f87f6c..cc20b3a 100644
|
|
|
ba028ab |
--- a/lib/http_proxy.c
|
|
|
ba028ab |
+++ b/lib/http_proxy.c
|
|
|
ba028ab |
@@ -210,10 +210,8 @@ void Curl_connect_done(struct Curl_easy *data)
|
|
|
ba028ab |
Curl_dyn_free(&s->rcvbuf);
|
|
|
ba028ab |
Curl_dyn_free(&s->req);
|
|
|
ba028ab |
|
|
|
ba028ab |
- /* restore the protocol pointer, if not already done */
|
|
|
ba028ab |
- if(s->prot_save)
|
|
|
ba028ab |
- data->req.p.http = s->prot_save;
|
|
|
ba028ab |
- s->prot_save = NULL;
|
|
|
ba028ab |
+ /* restore the protocol pointer */
|
|
|
ba028ab |
+ data->req.p.http = s->prot_save;
|
|
|
ba028ab |
data->info.httpcode = 0; /* clear it as it might've been used for the
|
|
|
ba028ab |
proxy */
|
|
|
ba028ab |
data->req.ignorebody = FALSE;
|
|
|
ba028ab |
diff --git a/lib/url.c b/lib/url.c
|
|
|
ba028ab |
index bfc784f..61c99d2 100644
|
|
|
ba028ab |
--- a/lib/url.c
|
|
|
ba028ab |
+++ b/lib/url.c
|
|
|
ba028ab |
@@ -728,15 +728,6 @@ static void conn_shutdown(struct Curl_easy *data, struct connectdata *conn)
|
|
|
ba028ab |
DEBUGASSERT(data);
|
|
|
ba028ab |
infof(data, "Closing connection %ld", conn->connection_id);
|
|
|
ba028ab |
|
|
|
ba028ab |
-#ifndef USE_HYPER
|
|
|
ba028ab |
- if(conn->connect_state && conn->connect_state->prot_save) {
|
|
|
ba028ab |
- /* If this was closed with a CONNECT in progress, cleanup this temporary
|
|
|
ba028ab |
- struct arrangement */
|
|
|
ba028ab |
- data->req.p.http = NULL;
|
|
|
ba028ab |
- Curl_safefree(conn->connect_state->prot_save);
|
|
|
ba028ab |
- }
|
|
|
ba028ab |
-#endif
|
|
|
ba028ab |
-
|
|
|
ba028ab |
/* possible left-overs from the async name resolvers */
|
|
|
ba028ab |
Curl_resolver_cancel(data);
|
|
|
ba028ab |
|
|
|
ba028ab |
--
|
|
|
ba028ab |
2.37.3
|
|
|
ba028ab |
|
|
|
ba028ab |
|
|
|
ba028ab |
From 5fdb5e8433c132dbb1e31a48d39a4a54ba4d7a9e Mon Sep 17 00:00:00 2001
|
|
|
ba028ab |
From: Daniel Stenberg <daniel@haxx.se>
|
|
|
ba028ab |
Date: Thu, 6 Oct 2022 14:14:25 +0200
|
|
|
ba028ab |
Subject: [PATCH 2/2] test445: verifies the protocols-over-http-proxy flaw and
|
|
|
ba028ab |
fix
|
|
|
ba028ab |
|
|
|
ba028ab |
Upstream-commit: 038bfb8522a93328b7e65bd2b6b8387c974b9ac8
|
|
|
ba028ab |
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
|
ba028ab |
---
|
|
|
ba028ab |
tests/data/Makefile.inc | 2 +-
|
|
|
ba028ab |
tests/data/test445 | 61 +++++++++++++++++++++++++++++++++++++++++
|
|
|
ba028ab |
2 files changed, 62 insertions(+), 1 deletion(-)
|
|
|
ba028ab |
create mode 100644 tests/data/test445
|
|
|
ba028ab |
|
|
|
ba028ab |
diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
|
|
|
ba028ab |
index 0cfab9b..14c1b0c 100644
|
|
|
ba028ab |
--- a/tests/data/Makefile.inc
|
|
|
ba028ab |
+++ b/tests/data/Makefile.inc
|
|
|
ba028ab |
@@ -72,7 +72,7 @@ test409 test410 \
|
|
|
ba028ab |
\
|
|
|
ba028ab |
test430 test431 test432 test433 test434 test435 test436 \
|
|
|
ba028ab |
\
|
|
|
ba028ab |
-test440 test441 test442 test443 test444 \
|
|
|
ba028ab |
+test440 test441 test442 test443 test444 test445 \
|
|
|
ba028ab |
\
|
|
|
ba028ab |
test490 test491 test492 test493 test494 \
|
|
|
ba028ab |
\
|
|
|
ba028ab |
diff --git a/tests/data/test445 b/tests/data/test445
|
|
|
ba028ab |
new file mode 100644
|
|
|
ba028ab |
index 0000000..0406c0f
|
|
|
ba028ab |
--- /dev/null
|
|
|
ba028ab |
+++ b/tests/data/test445
|
|
|
ba028ab |
@@ -0,0 +1,61 @@
|
|
|
ba028ab |
+<testcase>
|
|
|
ba028ab |
+<info>
|
|
|
ba028ab |
+<keywords>
|
|
|
ba028ab |
+HTTP
|
|
|
ba028ab |
+HTTP proxy
|
|
|
ba028ab |
+</keywords>
|
|
|
ba028ab |
+</info>
|
|
|
ba028ab |
+
|
|
|
ba028ab |
+#
|
|
|
ba028ab |
+# Server-side
|
|
|
ba028ab |
+<reply>
|
|
|
ba028ab |
+<connect>
|
|
|
ba028ab |
+HTTP/1.1 503 no just no
|
|
|
ba028ab |
+Date: Tue, 09 Nov 2010 14:49:00 GMT
|
|
|
ba028ab |
+Server: test-server/fake
|
|
|
ba028ab |
+Accept-Ranges: bytes
|
|
|
ba028ab |
+Content-Length: 6
|
|
|
ba028ab |
+Connection: close
|
|
|
ba028ab |
+
|
|
|
ba028ab |
+-foo-
|
|
|
ba028ab |
+</connect>
|
|
|
ba028ab |
+</reply>
|
|
|
ba028ab |
+
|
|
|
ba028ab |
+#
|
|
|
ba028ab |
+# Client-side
|
|
|
ba028ab |
+<client>
|
|
|
ba028ab |
+<features>
|
|
|
ba028ab |
+gopher
|
|
|
ba028ab |
+dict
|
|
|
ba028ab |
+http
|
|
|
ba028ab |
+ftp
|
|
|
ba028ab |
+imap
|
|
|
ba028ab |
+ldap
|
|
|
ba028ab |
+mqtt
|
|
|
ba028ab |
+pop3
|
|
|
ba028ab |
+rtsp
|
|
|
ba028ab |
+scp
|
|
|
ba028ab |
+sftp
|
|
|
ba028ab |
+smb
|
|
|
ba028ab |
+smtp
|
|
|
ba028ab |
+</features>
|
|
|
ba028ab |
+<server>
|
|
|
ba028ab |
+http-proxy
|
|
|
ba028ab |
+</server>
|
|
|
ba028ab |
+ <name>
|
|
|
ba028ab |
+Refuse tunneling protocols through HTTP proxy
|
|
|
ba028ab |
+ </name>
|
|
|
ba028ab |
+ <command>
|
|
|
ba028ab |
+-x http://%HOSTIP:%PROXYPORT/%TESTNUMBER -p gopher://127.0.0.1 dict://127.0.0.1 http://moo https://example telnet://another ftp://yes ftps://again imap://more ldap://perhaps mqtt://yes pop3://mail rtsp://harder scp://copy sftp://files smb://wird smtp://send
|
|
|
ba028ab |
+</command>
|
|
|
ba028ab |
+</client>
|
|
|
ba028ab |
+
|
|
|
ba028ab |
+#
|
|
|
ba028ab |
+# Verify data after the test has been "shot"
|
|
|
ba028ab |
+<verify>
|
|
|
ba028ab |
+# refused in the CONNECT
|
|
|
ba028ab |
+<errorcode>
|
|
|
ba028ab |
+56
|
|
|
ba028ab |
+</errorcode>
|
|
|
ba028ab |
+</verify>
|
|
|
ba028ab |
+</testcase>
|
|
|
ba028ab |
--
|
|
|
ba028ab |
2.37.3
|
|
|
ba028ab |
|