Repository navigation
Reject HTML error pages when downloading the country file - #1141
Merged
Merged
Conversation
saveToDisk() writes whatever the server returned, without checking that it is a country file. When the download fails in a way that still gives an HTTP 200 - a captcha page, a redirect to an error page, a proxy notice - that HTML replaces cty.csv, and every DXCC lookup silently stops working. KLog reports the download as successful. I hit this on a live log: cty.csv was 12 kB of HTML instead of ~290 kB of data, and getQRZARRLId() returned -3 for every callsign. There is no error anywhere, so the only symptom is that entities stop being recognised. This checks the payload before replacing the existing file: an HTML document or a suspiciously small file is rejected and the old data kept.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



saveToDisk() writes whatever the server returned, without checking that it is a country file. When the download fails in a way that still gives an HTTP 200 - a captcha page, a redirect to an error page, a proxy notice - that HTML replaces cty.csv, and every DXCC lookup silently stops working. KLog reports the download as successful.
I hit this on a live log: cty.csv was 12 kB of HTML instead of ~290 kB of data, and getQRZARRLId() returned -3 for every callsign. There is no error anywhere, so the only symptom is that entities stop being recognised.
This checks the payload before replacing the existing file: an HTML document or a suspiciously small file is rejected and the old data kept.