aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bbot/agent/http-service.cxx32
-rw-r--r--bbot/machine-manifest.test.testscript9
2 files changed, 37 insertions, 4 deletions
diff --git a/bbot/agent/http-service.cxx b/bbot/agent/http-service.cxx
index 1921edc..a56c259 100644
--- a/bbot/agent/http-service.cxx
+++ b/bbot/agent/http-service.cxx
@@ -212,7 +212,7 @@ namespace bbot
return optional<string> (move (r));
};
- while (!(l = curl::read_http_response_line (is)).empty ())
+ auto parse_header = [&ctype, &location, &rs, &header] ()
{
if (optional<string> v = header ("Content-Type"))
ctype = move (v);
@@ -221,6 +221,36 @@ namespace bbot
if ((rs.code >= 301 && rs.code <= 303) || rs.code == 307)
location = move (v);
}
+ };
+
+ // Note that the curl's output may include the CONNECT response (see
+ // curl::read_http_status() for details). If that's the case, then
+ // skip it, similar to curl::read_http_status().
+ //
+ bool content_expected (false);
+ while (!(l = curl::read_http_response_line (is)).empty ())
+ {
+ if (curl::http_content_aspect (l))
+ content_expected = true;
+
+ parse_header ();
+ }
+
+ if (rs.code == 200 && !content_expected)
+ {
+ try
+ {
+ rs = curl::read_http_status (is, false /* skip_headers */);
+ }
+ catch (const invalid_argument& e)
+ {
+ bad_response (
+ string ("unable to read proxied HTTP response status line: ") +
+ e.what ());
+ }
+
+ while (!(l = curl::read_http_response_line (is)).empty ())
+ parse_header ();
}
assert (!eof (is)); // Would have already failed otherwise.
diff --git a/bbot/machine-manifest.test.testscript b/bbot/machine-manifest.test.testscript
index e358ff3..f6a2eae 100644
--- a/bbot/machine-manifest.test.testscript
+++ b/bbot/machine-manifest.test.testscript
@@ -19,7 +19,8 @@
type: kvm
mac: de:ad:be:ef:de:ad
options: -device "virtio-scsi-pci,id=scsi" -device "scsi-hd,drive=disk0"
- changes:\
+ changes:
+ \
0.7.0
- mac is changed to de:ad:be:ef:de:ad
- increased disk size to 30GB
@@ -34,7 +35,8 @@
name: windows_10-msvc_14
summary: Windows 10 build 1607 with VC 14 update 3
type: kvm
- options:\
+ options:
+ \
-device "virtio-scsi-pci,id=scsi"
-device "scsi-hd,drive=disk0"
\
@@ -331,7 +333,8 @@
ram-minimum: 1048576
type: kvm
mac: e6:38:72:53:61:ae
- changes:\
+ changes:
+ \
1.0
- clone off linux_debian_12-small-1.0
- postgresql-15 15.6.0+deb12u1