Thomas. Good evening.

I have posted a reference from RFC 4622.

On Tue, 24 Feb 2026 09:51:18 -0500
Thomas Passin <[email protected]> wrote:

> On 2/24/2026 2:00 AM, Schimon Jehudah via Python-list wrote:
> > Greetings.
> > 
> > I am interested at advisory as to how to handle XMPP URI links.
> > 
> > This is how module "urllib" handles this type of URI.
> > 
> > 
> > urlparse
> > --------
> > 
> > from urllib.parse import urlparse
> > 
> > urlparse("xmpp:pubsub.python.i2p?;node=xmpp-python-news")
> > 
> > ParseResult(
> >    scheme='xmpp',
> >    netloc='',
> >    path='pubsub.python.i2p',
> >    params='',
> >    query=';node=xmpp-python-news',
> >    fragment='')
> > 
> > urlparse("xmpp:[email protected]?;node=urn:xmpp:microblog:0;item=xmpp-and-python")
> > 
> > ParseResult(
> >    scheme='xmpp',
> >    netloc='',
> >    path='[email protected]',
> >    params='',
> >    query=';node=urn:xmpp:microblog:0;item=xmpp-and-python',
> >    fragment='')
> > 
> > Hostname (netloc) should be "pubsub.movim.eu" and "python.i2p".  
> 
> Your example has no netloc. From the Python docs:
> 
> "recognizes a netloc only if it is properly introduced by ‘//’. 
> Otherwise the input is presumed to be a relative URL and thus to
> start with a path component."
> 
> > 
> > parse_qs
> > --------
> > 
> > Another issue, is not recognizing query parameters.
> > 
> > from urllib.parse import parse_qs
> > 
> > parse_qs("xmpp:[email protected]?;node=urn:xmpp:microblog:0;item=xmpp-and-python")
> > 
> > {'xmpp:[email protected]?;node':
> > ['urn:xmpp:microblog:0;item=xmpp-and-python']}
> > 
> > The query parameters are not recorgnized unless the URI is formed
> > in a similar fashion to HTTP URI, which is not a valid XMPP URI.
> > 
> > parse_qs("xmpp://[email protected]/?node=urn:xmpp:microblog:0&item=xmpp-and-python")
> > 
> > {'xmpp://[email protected]/?node': ['urn:xmpp:microblog:0'], 'item':
> > ['xmpp-and-python']}  
> 
> 
> urllib does not support xmpp:
> 
> "The module has been designed to match the internet RFC on Relative 
> Uniform Resource Locators. It supports the following URL schemes:
> file, ftp, gopher, hdl, http, https, imap, itms-services, mailto,
> mms, news, nntp, prospero, rsync, rtsp, rtsps, rtspu, sftp, shttp,
> sip, sips, snews, svn, svn+ssh, telnet, wais, ws, wss."
> 
> The docs page is at
> 
> https://docs.python.org/3/library/urllib.parse.html#module-urllib.parse
> 

Could clause 2.3 (Authority Component) of RFC 4622 be relevant?

> In accordance with Section 3.2 of RFC 3986, the authority component
> is preceded by a double slash ("//") and is terminated by the next
> slash ("/"), question mark ("?"), or number sign ("#") character, or
> by the end of the IRI/URI.  As explained more fully in Section 2.8.1
> of this document, the presence of an authority component signals the
> processing application to authenticate as the node@domain specified
> in the authority component rather than as a configured node@domain
> (see the Security Considerations section of this document regarding
> authentication).  (While it is unlikely that the authority component
> will be included in most XMPP IRIs or URIs, the scheme allows for its
> inclusion, if appropriate.)  Thus, the following XMPP IRI/URI
> indicates to authenticate as "[email protected]":
>
>     xmpp://[email protected]
>

https://rfc-editor.org/rfc/rfc4622.txt

I might substitute the URI, or create a package to parse URI of XMPP.

Schimon

> > Request
> > -------
> > 
> > I would appreciate your advisory.
> > 
> > 
> > Kind reagrds,
> > Schimon  
> 
-- 
https://mail.python.org/mailman3//lists/python-list.python.org

Reply via email to