Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept-Encoding: gzip header added by fetch2 handler #624

Closed
ldemailly opened this issue Sep 16, 2022 · 1 comment · Fixed by #625
Closed

Accept-Encoding: gzip header added by fetch2 handler #624

ldemailly opened this issue Sep 16, 2022 · 1 comment · Fixed by #625

Comments

@ldemailly
Copy link
Member

$ fortio server -M "8088 http://localhost:8080 http://localhost:8080"

Shouldn't need the | gunzip

$ fortio curl "http://localhost:8080/fortio/fetch2/?url=http://localhost:8088/debug"  | gunzip

10:58:55 Fetch proxy2: GET /fortio/fetch2/?url=http://localhost:8088/debug HTTP/1.1 127.0.0.1:54473 ()  "fortio.org/fortio-1.36.0"
10:58:55 Debug: GET /debug HTTP/1.1 [::1]:54475 ()  "fortio.org/fortio-1.36.0"
10:58:55 Debug: GET /debug HTTP/1.1 [::1]:54476 ()  "fortio.org/fortio-1.36.0"
HTTP/1.1 200 OK
Content-Length: 654
Content-Type: application/x-gzip
Date: Fri, 16 Sep 2022 17:58:55 GMT

Φορτίο version 1.36.0 h1:YnEOwxQwGwg22lyvF2vy+vXSs8bo5Pj23DBPa23MfhQ= go1.19.1 arm64 darwin echo debug server up for 6m33.1s on K6922C3FGJ - request from [::1]:54476

GET /debug HTTP/1.1

headers:

Host: localhost:8080
Accept-Encoding: gzip
User-Agent: fortio.org/fortio-1.36.0
X-Fortio-Multi-Id: 1
X-On-Behalf-Of: 127.0.0.1:54473,[::1]:54474
X-Proxy-Agent: fortio.org/fortio-1.36.0

body:


Φορτίο version 1.36.0 h1:YnEOwxQwGwg22lyvF2vy+vXSs8bo5Pj23DBPa23MfhQ= go1.19.1 arm64 darwin echo debug server up for 6m33.1s on K6922C3FGJ - request from [::1]:54475

GET /debug HTTP/1.1

headers:

Host: localhost:8080
Accept-Encoding: gzip
User-Agent: fortio.org/fortio-1.36.0
X-Fortio-Multi-Id: 2
X-On-Behalf-Of: 127.0.0.1:54473,[::1]:54474
X-Proxy-Agent: fortio.org/fortio-1.36.0

body:
@ldemailly
Copy link
Member Author

curl -v "http://localhost:8080/fortio/fetch2/?url=http://localhost:8080/debug"          
*   Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /fortio/fetch2/?url=http://localhost:8080/debug HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.85.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: text/plain; charset=UTF-8
< Date: Sun, 18 Sep 2022 19:23:43 GMT
< Content-Length: 317
< 
Φορτίο version dev  go1.19.1 arm64 darwin echo debug server up for 4m4.8s on MacBook-Air.local - request from [::1]:55484

GET /debug HTTP/1.1

headers:

Host: localhost:8080
Accept: */*
Accept-Encoding: gzip
User-Agent: curl/7.85.0
X-On-Behalf-Of: 127.0.0.1:55494
X-Proxy-Agent: fortio.org/fortio-dev

@ldemailly ldemailly changed the title Accept-Encoding: gzip header added by the -M forwarders Accept-Encoding: gzip header added by fetch2 handler Sep 18, 2022
ldemailly added a commit that referenced this issue Sep 18, 2022
…ixes #624) also fix a data race and also enable delay,close and header query args for debug endpoint
ldemailly added a commit that referenced this issue Sep 19, 2022
…625)

* only do compression if requested explictly when forwarding/fetching (fixes #624) also fix a data race and also enable delay,close and header query args for debug endpoint

* allow content-type (and content-length though that can create invalid data) to be passed as echo/debug header= to override the default

* readme update for debug handler features

* add (indirect) test for gzip compression on debug handler (and restore coverage)

* actually exercise gzip handling in the test + catch the missing payload earlier than webtest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant