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

Use correct HEAD request when fetching HTTP headers #6063

Merged

Conversation

leonardehrenfried
Copy link
Member

Summary

When working with large downloads in build-config.json I noticed that starting up OTP was quite slow and using a lot of bandwidth before the graph build, and therefore download, even started.

I traced it down to a problematic method that was supposed to fetch HTTP headers but instead downloaded the entire file.

The Javadoc clearly states that a HEAD request should be executed but the in the acutal implementation this is not the case:

/**
* Executes an HTTP HEAD request and returns the headers. Returns an empty list if the HTTP server
* does not accept HTTP HEAD requests.
*/

Unit tests

I could write a test spinning up a HTTP server, but I don't think we want that.

Copy link

codecov bot commented Sep 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.78%. Comparing base (e9f847d) to head (60d98e4).
Report is 7 commits behind head on dev-2.x.

Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6063      +/-   ##
=============================================
- Coverage      69.78%   69.78%   -0.01%     
+ Complexity     17358    17355       -3     
=============================================
  Files           1962     1962              
  Lines          74359    74357       -2     
  Branches        7624     7623       -1     
=============================================
- Hits           51895    51890       -5     
- Misses         19821    19822       +1     
- Partials        2643     2645       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@vpaturet vpaturet left a comment

Choose a reason for hiding this comment

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

Oops, unfortunate mistake in this method, good that you spotted it!

@leonardehrenfried leonardehrenfried merged commit db590e5 into opentripplanner:dev-2.x Sep 16, 2024
5 checks passed
@leonardehrenfried leonardehrenfried deleted the fix-headers branch September 16, 2024 06:46
t2gran pushed a commit that referenced this pull request Sep 16, 2024
@t2gran t2gran added this to the 2.6 milestone Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants