diff rtsp.c @ 5890:f075d373e9be libavformat

Actually parse the auth headers in RTSP
author mstorsjo
date Thu, 25 Mar 2010 21:48:58 +0000
parents 4b42835727aa
children 59e4df62d614
line wrap: on
line diff
--- a/rtsp.c	Thu Mar 25 21:47:33 2010 +0000
+++ b/rtsp.c	Thu Mar 25 21:48:58 2010 +0000
@@ -838,7 +838,8 @@
     }
 }
 
-void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf)
+void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf,
+                        HTTPAuthState *auth_state)
 {
     const char *p;
 
@@ -871,6 +872,12 @@
     } else if (av_stristart(p, "Location:", &p)) {
         skip_spaces(&p);
         av_strlcpy(reply->location, p , sizeof(reply->location));
+    } else if (av_stristart(p, "WWW-Authenticate:", &p) && auth_state) {
+        skip_spaces(&p);
+        ff_http_auth_handle_header(auth_state, "WWW-Authenticate", p);
+    } else if (av_stristart(p, "Authentication-Info:", &p) && auth_state) {
+        skip_spaces(&p);
+        ff_http_auth_handle_header(auth_state, "Authentication-Info", p);
     }
 }
 
@@ -951,7 +958,7 @@
             get_word(buf1, sizeof(buf1), &p);
             reply->status_code = atoi(buf1);
         } else {
-            ff_rtsp_parse_line(reply, p);
+            ff_rtsp_parse_line(reply, p, &rt->auth_state);
             av_strlcat(rt->last_reply, p,    sizeof(rt->last_reply));
             av_strlcat(rt->last_reply, "\n", sizeof(rt->last_reply));
         }