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

Better handling of HTTP header #182

Merged
merged 2 commits into from
Apr 10, 2024
Merged

Conversation

simleo
Copy link
Collaborator

@simleo simleo commented Apr 10, 2024

The issue addressed by this PR was reported by @rsirvent. For the following URL:

https://zenodo.org/records/10782431/files/lysozyme_datasets.zip

  • The content-type (which ends up in encodingFormat) was being duplicated: application/octet-stream, application/octet-stream
  • last-modified was missing

Apparently the content-type duplication is not really an error: the server sends content-type twice and urllib merges them with a comma, which is consistent with RFC 7230 (see the Requests docs for response headers). However, Requests (and the underlying Urllib3) somehow detects that this is some kind of server error and provides a content-type of application/octet-stream. With this PR, we use Requests to get the header and avoid the above problems. It is worth noting that the new behavior is consistent with curl -I.

@simleo simleo requested a review from rsirvent April 10, 2024 09:25
Copy link
Contributor

@rsirvent rsirvent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me. I see you used 'requests' instead of 'urllib3', which I read was also possible.

@simleo simleo merged commit a551acb into ResearchObject:master Apr 10, 2024
12 checks passed
@simleo simleo deleted the http_header branch April 10, 2024 15:03
@stain
Copy link
Contributor

stain commented Apr 11, 2024

Should we report this upstream to Zenodo?

@rsirvent
Copy link
Contributor

rsirvent commented Apr 11, 2024

Done. Wrote a support request at the Zenodo website, linking to this PR.

Edit: they have answered really quick (ticket number at the bottom):

Dear Raul,

We have logged this issue internally and will investigate/fix it in due course.

Thank for you the bug report! Please let me know if there's anything else I can help you with.

Best regards,
Carlin

Zenodo Support
https://zenodo.org/
Support Zenodo — Could we suggest you support Zenodo’s features' development by donating to the CERN & Society Foundation? For more information see https://zenodo.org/donate or reach out directly to our Partnerships & Fundraising colleagues (donorcare@csf.cern.ch) if you have any doubts about the donation process.

Ticket#33602

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 this pull request may close these issues.

3 participants