-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fixes server ignores request to gzip data #14982
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
base: develop
Are you sure you want to change the base?
Conversation
Hey @rose2221 , thanks for the contribution! This PR only adds gzip to the blobs endpoint, but it would make much more sense to have support on all endpoints that return data. Which means all endpoint that use Before merging the PR you will also have to sign the Contributor License Agreement and add a changelog file. |
Thank you, @rkapka, for your suggestions! I've implemented the requested changes. Let me know if there's anything else that needs adjustment. Also, should I add tests for this as well? |
That would be very helpful. Perhaps you could write a unit test where you:
|
Thank you, I've implemented the test as suggested and I'm open to any further feedback. @rkapka |
please fix linting |
api/server/middleware/middleware.go
Outdated
if !strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") { | ||
next.ServeHTTP(w, r) | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's something wrong with this formatting when I first read it I thought it was on the return above
api/server/middleware/middleware.go
Outdated
|
||
w.Header().Set("Content-Encoding", "gzip") | ||
|
||
gz := gzip.NewWriter(w) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little worried about the usage of this will need to read up more on this
@rose2221 Thanks for the test. I would like to approve the PR, but you need to run |
Merging the PR @rose2221 , thanks a lot for the contribution! |
@rose2221 For some reason our end-to-end tests fail with this PR. I can debug this myself but if you'd like to do it yourself you can run
|
hey yes i would like to work on it |
Great! When the test fails, it outputs a path where all logs are stored. These are logs from the e2e run as well as beacon node logs (and some other as well but looking at beacon node logs should be enough) |
Hey @rkapka @james-prysm , sorry for the delay — I've fixed it now. Thanks for pointing out the log path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simply ignoring SSZ is not correct
Ignoring SSZ is fine, but we should do it in a more reliable way. The user can specify two values in the Accept
header, in which case even though application/octet-stream
is a part of the header, the type of the response can still be application/json
Also the PR has some conflicts now @rose2221 |
i've applied the changes as suggested! thanks very much for the same! |
What type of PR is this?
Bug fix
What does this PR do? Why is it needed?
This PR fixes an issue where the Prysm beacon chain server ignores the
Accept-Encoding: gzip
header in HTTP requests and always returns uncompressed JSON responses.Fix Details:
Accept-Encoding
header.Which issue(s) does this PR fix?
Fixes #14593
Other Notes for Review
Acknowledgements