Normalize URLs during WARC import #886
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It turns out we've been missing some records because redirect URLs (in the 3xx response's
Locationheader) do not always exactly match the requested target URL as recorded in the WARC record. This solves the problem by normalizing URLs before trying to match them.For example,
https://www.heat.gov/recently stopped getting recorded because it started redirecting tohttps://heat.gov, which got recorded in the WARC ashttps://heat.gov/. The/path is exactly equivalent to an empty path, but because we were looking for a URL without a path, we didn't find a record, even though the correct matching record was there, just with a/for its path.While working on this particular case, I found some similar problems arising from variations on this same cause, like having redundant ports (e.g. the
443is redundant here because it is anhttpsscheme:https://whatever.com:443/).