GNOME Bugzilla – Bug 601733
rtspsrc: Use specific error message when authentication is required
Last modified: 2015-02-24 09:07:51 UTC
Something similar to giosrc's "not-mounted" message would be fine. It could even pass the "AuthName" from the server, as context.
FWIW, that's what we have right now: /* RTSP or HTTP source with user-id property ? */ if ((g_strcmp0 ("GstRTSPSrc", G_OBJECT_TYPE_NAME (err_msg->src)) == 0 || g_strcmp0 ("GstSoupHTTPSrc", G_OBJECT_TYPE_NAME (err_msg->src)) == 0) && g_object_class_find_property (G_OBJECT_GET_CLASS (err_msg->src), "user-id") != NULL) { GError *err = NULL; gchar *dbg = NULL; gst_message_parse_error (err_msg, &err, &dbg); /* Urgh! Check whether this is an auth error */ if (err != NULL && dbg != NULL && is_error (err, RESOURCE, READ) && strstr (dbg, "401") != NULL) { and strstr'ing for "401" really doesn't look like the best of ideas.
This is still current.
So what's actually needed here? Error codes for 401 UNAUTHORIZED and make both souphttpsrc and rtspsrc map 401 errors to that and post appropriate error messages?
Yeah, anything better than doing strstr() on a string.
Created attachment 297541 [details] [review] rtspsrc: improve error message when unauthorized I'm attaching a patch that fixes this for rtspsrc. souphttpsrc already returns NOT_AUTHORIZED since cf31a4284bcd87f4137bdd8f2dc1cf3cedf43ccb.
Comment on attachment 297541 [details] [review] rtspsrc: improve error message when unauthorized Thanks for the patch! commit e3ca4d1c86813338915e2e143e4d4675e40c45ea Author: Krzysztof Kotlenga <pocek@users.sf.net> Date: Sun Feb 22 01:49:52 2015 +0100 rtspsrc: improve error message when unauthorized Make use of NOT_AUTHORIZED error code instead of falling back to generic READ error. https://bugzilla.gnome.org/show_bug.cgi?id=601733