ngraziano / SharpRTSP

A RTSP handling library
Other
557 stars 182 forks source link

Sample RTSPServer doesn't work with VLC interactive authentication #127

Closed bentorkington closed 3 weeks ago

bentorkington commented 3 months ago

While VLC can connect when embedding the credentials in the RTSP URL, the connection fails when using URLs without credentials. The user is never prompted for a password. Normally, VLC prompts the user for credentials when none are in the URL and authentication is required.

After receiving a 401 to the first OPTIONS request, VLC then attempts to authenticate with an empty username and password. This also returns a 401, but VLC then issues a DESCRIBE request with the same credentials anyway. RtspServer never responds to this message, and VLC gives up without prompting the user for credentials.

While this seems like an unconventional RTSP conversation, (sending a DESCRIBE straight after OPTIONS get a 401), it seems like a bug not to respond to the DESCRIBE with another 401.

I intend to submit a PR for this but I have other priorities right now.

PCAP of VLC -> RtspServer failed auth

ngraziano commented 3 months ago

I made a change to allow OPTIONS request to ignore authentication and it seems to work, VLC show the login window.

The server do not respond to DESCRIBE because it close the socket just after detecting bad auth on OPTIONS, so VLC send the DESCRIBE on a closing socket.

bentorkington commented 3 weeks ago

Sorry I took a long time to get around to testing this, looks fixed.