Skip to content

Commit 4697249

Browse files
committed
Fix: Set --post302
cURL resets the real method type from POST to GET on redirects. This means that a protocol upgrade or generic redirect from Scarf.sh will cause the telemetry upload to downgrade from a POST with a body to what should be a GET, but what old cURL will treat as a POST without a body due to the presence of the -X flag. Very new cURLs have a flag which repairs this particular behavior, and the RFC compliant thing would be to move from the ambiguous HTTP 302 to the specific HTTP 307 which preserves method type. But we have tons of ancient clients out there and the vendor may not be willing to fix their redirects so we have to set the feature flag which tells cURL to do the standard defined thing rather than the common implementation defined thing. Computers are great.
1 parent ca8f6e1 commit 4697249

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

extension.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ exports_files(["report.json", "defs.bzl"], visibility = ["//visibility:public"])
149149
"--max-time", "1",
150150
"--connect-timeout", "0.5",
151151
"--request", "POST",
152+
# Persist the POST method across redirects. Maddeningly this is
153+
# the RFC specified behavior but almost no client originaly
154+
# behaved this way so cURL jumps off a cliff too like its
155+
# friends and we have to tell it to follow the spec. Ideally
156+
# we'd serve 307s instead but we may not be able to.
157+
"--post302",
152158
"--header", "Content-Type:application/json",
153159
"--data", "@report.json",
154160
endpoint],

0 commit comments

Comments
 (0)