-
Notifications
You must be signed in to change notification settings - Fork 574
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
Stack trace on unexpected HTTP response #274
Comments
So, problem is reusing resp_data reference means that when there is an error parsing the string, it is still a string and not a dict. So running with this patch (purposefully ot fixing whatever the apache config error is until the acme-tiny error handling is fixed): @@ -36,10 +36,11 @@
except IOError as e:
resp_data = e.read().decode("utf8") if hasattr(e, "read") else str(e)
code, headers = getattr(e, "code", None), {}
+ resp_raw = resp_data
try:
- resp_data = json.loads(resp_data) # try to parse json results
+ resp_data = json.loads(resp_raw) # try to parse json results
except ValueError:
- pass # ignore json parsing errors
+ raise ValueError("{0}:\nUrl: {1}\nData: {2}\nResponse Code: {3}\nResponse: {4}".format(err_msg, url, data, code, '"%s"'%resp_raw))
if depth < 100 and code == 400 and resp_data['type'] == "urn:ietf:params:acme:error:badNonce":
raise IndexError(resp_data) # allow 100 retrys for bad nonces
if code not in [200, 201, 204]: I discover that code is 204 and resp_raw is empty from LE:
|
Ok, this patch is minimal code change and makes the error much clearer: @@ -39,7 +39,7 @@
try:
resp_data = json.loads(resp_data) # try to parse json results
except ValueError:
- pass # ignore json parsing errors
+ resp_data = {'type':None, 'raw': resp_data}
if depth < 100 and code == 400 and resp_data['type'] == "urn:ietf:params:acme:error:badNonce":
raise IndexError(resp_data) # allow 100 retrys for bad nonces
if code not in [200, 201, 204]: And the resulting error is:
|
When fetching the .well-known URL as a test before contacting LE, this stack trace results:
Manually fetching the URL gets this error:
Tcpdump confirms this is on port 80.
Clearly, the 400 error is an apache or apache config problem - acme-tiny-5.0.1 works on EL7 and other systems. However, the error handling could be cleaner. :-)
I will try my hand at a patch that doesn't bloat the beautiful acme-tiny code . . .
The text was updated successfully, but these errors were encountered: