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

fixed uncontrolled error when server responds 200 #4317



Copy link

@memsharded memsharded commented Jan 15, 2019

Changelog: Fix: Improve error message when a server (like a proxy), returns 200-OK for a conan api call, but with an unexpected message.
Docs: Omit

Close #3985

@ghost ghost assigned memsharded Jan 15, 2019
@ghost ghost added the stage: review label Jan 15, 2019
@memsharded memsharded added this to the 1.12 milestone Jan 15, 2019
@memsharded memsharded assigned lasote and unassigned memsharded Jan 15, 2019
@ghost ghost assigned memsharded Jan 16, 2019
result = json.loads(decode_text(response.content))
try: # This can fail, if some proxy returns 200 and an html message
result = json.loads(decode_text(response.content))
except Exception:
Copy link

@lasote lasote Jan 17, 2019

The issue is produced because of a message that it is not a json, right? The right way to check this is to check if application/json header is present. I know you would think that is risky, but a server returning a json without a json header is a bug. The protocols need to be followed. If our own test's with the server fails (I hope they don't) we need to fix it in the server but I agree we cannot break old servers, in that case, narrow the exception capturing to the json decoding, please.

Copy link

@lasote lasote Jan 17, 2019

We need also to test with Artifactory.

Copy link
Member Author

@memsharded memsharded Jan 17, 2019

Tested manually with Artifactory CE 6.3 and Bintray

lasote approved these changes Jan 17, 2019
Copy link

@lasote lasote left a comment


@memsharded memsharded merged commit 302deba into conan-io:develop Jan 17, 2019
2 checks passed
@ghost ghost removed the stage: review label Jan 17, 2019
@memsharded memsharded deleted the feature/fix_server_unexpected_200 branch Jan 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants