-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Add support for compression in http api #3752
Conversation
258342a
to
6205918
Compare
Hi @slackpad, |
Hi @kyhavlov, |
Hi @slackpad, |
3a031bf
to
6a40e50
Compare
Thanks for the PR @yfouquet! As to your original question using the NYTimes/gziphandler library is fine and this would be a good addition to Consul. However in order to merge the PR there are 4 items that need addressing:
|
Hi @mkeeler, Thanks for your response. |
@yfouquet Thanks for the fixes. The code looks good to me and I figured out why the test failed. Even with the gziphandler setup to use MinSize(0) without any writes to the stream it wouldn't go ahead and send the HTTP response headers. If you add the following into agent/agent_endpoint.go at line 703 (after the WriteHeader call and before the Flush call) then it should work properly.
Its a bit of a hack to get around the issue with the gziphandler library but seems to work well enough. |
The need has been spotted in issue hashicorp#3687. Using "NYTimes/gziphandler", the http api responses can now be compressed if required. The Go API requires compressed response if possible and handle the compressed response. We here change only the http api (not the UI for instance).
Great @mkeeler, |
The need has been spotted in issue #3687.
Using "NYTimes/gziphandler", the HTTP api responses can now be compressed if required.
The Go API requires compressed response if possible and handle the compressed response (natively).
We here only change the HTTP "v1" endpoints (not "ui" or "debug" for instance).
Note that, in our context, the compression has a strong impact on the UI latency which takes more than 10 seconds to load without compression because of "/v1/internal/ui/nodes" response size (> 40MB).