[issue13244] WebSocket schemes in urlparse

Tobias Oberstein report at bugs.python.org
Sat Oct 22 22:47:34 CEST 2011


Tobias Oberstein <tobias.oberstein at tavendo.de> added the comment:

fragment identifiers:

the spec says:

"Fragment identifiers are meaningless in the context of WebSocket
URIs, and MUST NOT be used on these URIs.  The character "#" in URIs
MUST be escaped as %23 if used as part of the query component."

[see last line of my initial comment]

I nevertheless added the ws/wss schemes to urlparse.uses_fragment so that I can detect them being used and throw.

Does urllib throw when an URL contains a fragment identifier, but the scheme of the URL is not in urlparse.uses_fragment?

If so, thats fine and of course better than putting the burden of checking on the user.

==

Further, when "#" is to be used in a WS URL, it MUST be encoded, and if so, it's interpreted as part of the query component.

So in summary, I think the best would be:

urllib throws upon non-encoded "#", and interpret it as part of the query component when encoded.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13244>
_______________________________________


More information about the Python-bugs-list mailing list