Fixed the asf http authentication.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6678 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
bertrand 2002-07-09 08:26:34 +00:00
parent ff5cc95b60
commit b5a178733e
1 changed files with 14 additions and 3 deletions

View File

@ -552,9 +552,14 @@ asf_http_parse_response( HTTP_header_t *http_hdr ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Failed to parse HTTP response\n"); mp_msg(MSGT_NETWORK,MSGL_ERR,"Failed to parse HTTP response\n");
return -1; return -1;
} }
if( http_hdr->status_code!=200 ) { switch( http_hdr->status_code ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Server return %d:%s\n", http_hdr->status_code, http_hdr->reason_phrase); case 200:
return -1; 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"); content_type = http_get_field( http_hdr, "Content-Type");
@ -609,6 +614,7 @@ asf_http_streaming_start( stream_t *stream ) {
int i, ret; int i, ret;
int fd = stream->fd; int fd = stream->fd;
int done; int done;
int auth_retry = 0;
asf_http_ctrl = (asf_http_streaming_ctrl_t*)malloc(sizeof(asf_http_streaming_ctrl_t)); asf_http_ctrl = (asf_http_streaming_ctrl_t*)malloc(sizeof(asf_http_streaming_ctrl_t));
if( asf_http_ctrl==NULL ) { if( asf_http_ctrl==NULL ) {
@ -702,6 +708,11 @@ asf_http_streaming_start( stream_t *stream ) {
stream->type = STREAMTYPE_PLAYLIST; stream->type = STREAMTYPE_PLAYLIST;
done = 1; done = 1;
break; 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: case ASF_Unknown_e:
default: default:
mp_msg(MSGT_NETWORK,MSGL_ERR,"Unknown ASF streaming type\n"); mp_msg(MSGT_NETWORK,MSGL_ERR,"Unknown ASF streaming type\n");