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

Merged

Conversation

Projects
None yet
2 participants
@memsharded
Copy link
Contributor

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:

This comment has been minimized.

Copy link
@lasote

lasote Jan 17, 2019

Contributor

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.

This comment has been minimized.

Copy link
@lasote

lasote Jan 17, 2019

Contributor

We need also to test with Artifactory.

This comment has been minimized.

Copy link
@memsharded

memsharded Jan 17, 2019

Author Contributor

Done.
Tested manually with Artifactory CE 6.3 and Bintray

@lasote

lasote approved these changes Jan 17, 2019

Copy link
Contributor

left a comment

👍

@memsharded memsharded merged commit 302deba into conan-io:develop Jan 17, 2019

2 checks passed

continuous-integration/jenkins/pr-head This commit looks good
Details
license/cla Contributor License Agreement is signed.
Details

@ghost ghost removed the stage: review label Jan 17, 2019

@memsharded memsharded deleted the memsharded: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
You can’t perform that action at this time.