[Mplayer-cvslog] CVS: main/libmpdemux asf_streaming.c,1.29,1.30

Bertrand Baudet bertrand at mplayerhq.hu
Tue Jul 9 10:26:37 CEST 2002


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv26531

Modified Files:
	asf_streaming.c 
Log Message:
Fixed the asf http authentication.


Index: asf_streaming.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asf_streaming.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- asf_streaming.c	8 Jul 2002 04:11:23 -0000	1.29
+++ asf_streaming.c	9 Jul 2002 08:26:34 -0000	1.30
@@ -552,9 +552,14 @@
 		mp_msg(MSGT_NETWORK,MSGL_ERR,"Failed to parse HTTP response\n");
 		return -1;
 	}
-	if( http_hdr->status_code!=200 ) {
-		mp_msg(MSGT_NETWORK,MSGL_ERR,"Server return %d:%s\n", http_hdr->status_code, http_hdr->reason_phrase);
-		return -1;
+	switch( http_hdr->status_code ) {
+		case 200:
+			break;
+		case 401: // Authentication required
+			return ASF_Authenticate_e;
+		default:
+			mp_msg(MSGT_NETWORK,MSGL_ERR,"Server return %d:%s\n", http_hdr->status_code, http_hdr->reason_phrase);
+			return -1;
 	}
 
 	content_type = http_get_field( http_hdr, "Content-Type");
@@ -609,6 +614,7 @@
 	int i, ret;
 	int fd = stream->fd;
 	int done;
+	int auth_retry = 0;
 
 	asf_http_ctrl = (asf_http_streaming_ctrl_t*)malloc(sizeof(asf_http_streaming_ctrl_t));
 	if( asf_http_ctrl==NULL ) {
@@ -701,6 +707,11 @@
 				}
 				stream->type = STREAMTYPE_PLAYLIST;
 				done = 1;
+				break;
+			case ASF_Authenticate_e:
+				if( http_authenticate( http_hdr, url, &auth_retry)<0 ) return -1;
+				asf_http_ctrl->streaming_type = ASF_Unknown_e;
+				done = 0;
 				break;
 			case ASF_Unknown_e:
 			default:




More information about the MPlayer-cvslog mailing list