Bugs and Issues - LSS

Patroneo: urlparse().hostname does not return the exact hostname

optical_disc

I'm in a rare situation where case sensitivity in the hostname actually matters. I know it's weird, but bear with me.

I really like Patroneo, but for some reason I could never get it to work in an NSM session without crashing immediately. While investigating this, I found the following code.

%
#osc.udp://hostname:portnumber/
o = urlparse(nsmOSCUrl)
return o.hostname, o.port
%

For whatever reason, urlparse was fetching all of the correct information, but `o.hostname` was always set to all lowercase no matter what.
I checked the docs of urlparse, and sure enough, *urlparse().hostname always uncapitalizes hostnames by design.*

(see here) https://docs.python.org/3/library/urllib.parse.html

This is what ended up being the cause of my crashes. The program would check for the running NSM server, but it would find nothing because the hostname wasn't capitalized correctly.

The code below is a modified version of the block above. It's functionally the same, except it preserves uppercase letters in the hostname. This simple change fixes the crash I was experiencing before.

%
#osc.udp://hostname:portnumber/
o = urlparse(nsmOSCUrl)
return o.netloc.split(":")[0], o.port
%

RSS Only moderators or members can reply to this. Sign-in if you are a moderator or member in order to post.

Replies

#1. lss

Thank you very much.
You will experience the same crash in other programs as well, like jack_mixer

This will be included in all new releases.
It was a bug in

https://github.com/jackaudio/new-session-manager/tree/master/extras/pynsm

which is also by me.