summaryrefslogtreecommitdiff
path: root/rpm/rpm.go
diff options
context:
space:
mode:
authorJeroen Schickendantz <[email protected]>2022-08-18 20:45:09 -0400
committerJeroen Schickendantz <[email protected]>2022-08-18 20:45:09 -0400
commit24fd73313e767c736f5b5f427391ff48bd07847c (patch)
treefa1708e6b0b99cca47b2baad153c8548a7b80d87 /rpm/rpm.go
parent64614ce713b03025204da4ca528c5d561a2fc57f (diff)
Force No Compression
Force http-compression off by: Sending header "Accept-Encoding: identity" in request. Checking header "Content-Encoding" in response.
Diffstat (limited to 'rpm/rpm.go')
-rw-r--r--rpm/rpm.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/rpm/rpm.go b/rpm/rpm.go
index 607cffa..3b32273 100644
--- a/rpm/rpm.go
+++ b/rpm/rpm.go
@@ -127,11 +127,19 @@ func Probe(
return err
}
+ // Used to disable compression
+ probe_req.Header.Set("Accept-Encoding", "identity")
+
probe_resp, err := client.Do(probe_req)
if err != nil {
return err
}
+ // Header.Get returns "" when not set
+ if probe_resp.Header.Get("Content-Encoding") != "" {
+ return fmt.Errorf("Content-Encoding header was set (compression not allowed)")
+ }
+
// TODO: Make this interruptable somehow by using _ctx_.
_, err = io.ReadAll(probe_resp.Body)
if err != nil {