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

Minor fix which turns an unintentional and confusing error message into the intended error message #53

Merged
merged 1 commit into from
Aug 9, 2012

Conversation

EliAndrewC
Copy link
Contributor

WebSocketTool.upgrade is supposed to raise a HandshakeError with the message "Header %s is not defined" if either the "Upgrade" or "Connection" header is missing.

However, the expression on line 126 of cherrypyserver.py:

request.headers.get(key).lower()

raises an AttributeError with the message "'NoneType' object has no attribute 'lower'" if one of those headers is missing, which prevents the intended error message from ever being displayed.

This commit fixes this problem by replacing get(key) with get(key, '') since the empty string evaluates as false.

WebSocketTool.upgrade is supposed to raise a HandshakeError with the message "Header %s is not defined" if either the "Upgrade" or "Connection" header is missing.

However, the expression on line 126 of cherrypyserver.py:

request.headers.get(key).lower()

raises an AttributeError with the message "'NoneType' object has no attribute 'lower'" if one of those headers is missing, which prevents the intended error message from ever being displayed.

This commit fixes this problem by replacing get(key) with get(key, '') since the empty string evaluates as false.
Lawouach added a commit that referenced this pull request Aug 9, 2012
Minor fix which turns an unintentional and confusing error message into the intended error message
@Lawouach Lawouach merged commit 482d4f0 into Lawouach:master Aug 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants