While writing a Privoxy test for client header sorting I
noticed that calling curl with --proxy and
-H "Proxy-Connection: Keep-Alive" to get a http:// resource
currently results in two Proxy-Connection headers being
sent instead of one.

Setting the Proxy-Connection header with --proxy-header works
as expected (by me) and only results in one Proxy-Connection
being sent.

Attached are two tests, the first one currently fails.

Is this a bug or a feature that may deserve documentation?

Fabian
From ececee58118e86516bf3b44a77dafdf8438f70a1 Mon Sep 17 00:00:00 2001
From: Fabian Keil <f...@fabiankeil.de>
Date: Sat, 16 Jan 2021 15:45:28 +0100
Subject: [PATCH 1/2] Add test1180: Proxy request with -H "Proxy-Connection:
 Keep-Alive"

At the moment the test fails as curl sends two Proxy-Connection
headers.
---
 tests/data/Makefile.inc |  2 +-
 tests/data/test1180     | 57 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 tests/data/test1180

diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
index a6da863fa..557e2c6e7 100644
--- a/tests/data/Makefile.inc
+++ b/tests/data/Makefile.inc
@@ -137,7 +137,7 @@ test1144 test1145 test1146 test1147 test1148 test1149 test1150 test1151 \
 test1152 test1153 test1154 test1155 test1156 test1157 test1158 test1159 \
 test1160 test1161 test1162 test1163 test1164 test1165 test1166 test1167 \
 test1168          test1170 test1171 test1172 test1173 test1174 test1175 \
-test1176 test1177 test1178 test1179 \
+test1176 test1177 test1178 test1179 test1180 \
 \
 test1188 \
 \
diff --git a/tests/data/test1180 b/tests/data/test1180
new file mode 100644
index 000000000..09d39e9bd
--- /dev/null
+++ b/tests/data/test1180
@@ -0,0 +1,57 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP proxy
+</keywords>
+</info>
+
+# Server-side
+<reply>
+<data>
+HTTP/1.1 200 OK
+Server: Blafasel/5.0
+Date: Sat, 16 Jan 2021 14:48:30 GMT
+Content-Length: 11
+
+Bla bla bla
+</data>
+
+<datacheck>
+HTTP/1.1 200 OK
+Server: Blafasel/5.0
+Date: Sat, 16 Jan 2021 14:48:30 GMT
+Content-Length: 11
+
+Bla bla bla
+</datacheck>
+
+</reply>
+
+# Client-side
+<client>
+<server>
+http
+</server>
+<features>
+proxy
+</features>
+ <name>
+HTTP GET request with proxy and -H "Proxy-Connection: keep-alive"
+ </name>
+ <command>
+--proxy http://%HOSTIP:%HTTPPORT -H "Proxy-Connection: Keep-Alive" http://%HOSTIP:%HTTPPORT/1180
+</command>
+</client>
+
+<verify>
+<protocol>
+GET http://%HOSTIP:%HTTPPORT/1180 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Proxy-Connection: Keep-Alive
+
+</protocol>
+</verify>
+</testcase>
-- 
2.30.0

From 353680c76319ca7736a5b2e9bd18f8fcc6858601 Mon Sep 17 00:00:00 2001
From: Fabian Keil <f...@fabiankeil.de>
Date: Sat, 16 Jan 2021 15:55:08 +0100
Subject: [PATCH 2/2] Add test1181: Proxy request with --proxy-header
 "Connection: Keep-Alive"

---
 tests/data/Makefile.inc |  2 +-
 tests/data/test1181     | 57 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 tests/data/test1181

diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
index 557e2c6e7..b1b2069a7 100644
--- a/tests/data/Makefile.inc
+++ b/tests/data/Makefile.inc
@@ -137,7 +137,7 @@ test1144 test1145 test1146 test1147 test1148 test1149 test1150 test1151 \
 test1152 test1153 test1154 test1155 test1156 test1157 test1158 test1159 \
 test1160 test1161 test1162 test1163 test1164 test1165 test1166 test1167 \
 test1168          test1170 test1171 test1172 test1173 test1174 test1175 \
-test1176 test1177 test1178 test1179 test1180 \
+test1176 test1177 test1178 test1179 test1180 test1181 \
 \
 test1188 \
 \
diff --git a/tests/data/test1181 b/tests/data/test1181
new file mode 100644
index 000000000..d5a5e1aee
--- /dev/null
+++ b/tests/data/test1181
@@ -0,0 +1,57 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP proxy
+</keywords>
+</info>
+
+# Server-side
+<reply>
+<data>
+HTTP/1.1 200 OK
+Server: Blafasel/5.0
+Date: Sat, 16 Jan 2021 14:48:30 GMT
+Content-Length: 11
+
+Bla bla bla
+</data>
+
+<datacheck>
+HTTP/1.1 200 OK
+Server: Blafasel/5.0
+Date: Sat, 16 Jan 2021 14:48:30 GMT
+Content-Length: 11
+
+Bla bla bla
+</datacheck>
+
+</reply>
+
+# Client-side
+<client>
+<server>
+http
+</server>
+<features>
+proxy
+</features>
+ <name>
+HTTP GET request with proxy and --proxy-header "Proxy-Connection: Keep-Alive"
+ </name>
+ <command>
+--proxy http://%HOSTIP:%HTTPPORT --proxy-header "Proxy-Connection: Keep-Alive" http://%HOSTIP:%HTTPPORT/1181
+</command>
+</client>
+
+<verify>
+<protocol>
+GET http://%HOSTIP:%HTTPPORT/1181 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+Proxy-Connection: Keep-Alive
+
+</protocol>
+</verify>
+</testcase>
-- 
2.30.0

Attachment: pgpTH7CkeUPVw.pgp
Description: OpenPGP digital signature

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

Reply via email to