]> git.sesse.net Git - vlc/blobdiff - src/misc/httpd.c
remember to enable it in the doc for 0.7.3
[vlc] / src / misc / httpd.c
index fb8883c5d9a6061f09ec80d97d0808eeba2b2fd4..b5929309e67d405500e8349bf4f5a55572f9c75f 100644 (file)
@@ -700,6 +700,7 @@ static int httpd_StreamCallBack( httpd_callback_sys_t *p_sys,
         else
         {
             httpd_MsgAdd( answer, "Content-Length", "%d", 0 );
+            answer->i_body_offset = 0;
         }
 
         if( !strcmp( stream->psz_mime, "video/x-ms-asf-stream" ) )
@@ -718,7 +719,7 @@ static int httpd_StreamCallBack( httpd_callback_sys_t *p_sys,
             for( i = 0; i < query->i_name; i++ )
             {
                 if( !strcasecmp( query->name[i],  "Pragma" ) &&
-                    !strcasecmp( query->value[i], "xPlayStrm=1" ) )
+                    strstr( query->value[i], "xPlayStrm=1" ) )
                 {
                     b_xplaystream = VLC_TRUE;
                 }
@@ -1267,7 +1268,7 @@ static void httpd_ClientInit( httpd_client_t *cl )
 {
     cl->i_state = HTTPD_CLIENT_RECEIVING;
     cl->i_activity_date = mdate();
-    cl->i_activity_timeout = 50000000LL;
+    cl->i_activity_timeout = 50000000;
     cl->i_buffer_size = 10000;
     cl->i_buffer = 0;
     cl->p_buffer = malloc( cl->i_buffer_size );
@@ -1932,11 +1933,13 @@ static void httpd_HostThread( httpd_host_t *host )
                                 if( answer && ( *url->psz_user || *url->psz_password ) )
                                 {
                                     /* create the headers */
-                                    char id[strlen(url->psz_user)+strlen(url->psz_password) + 2];
                                     char *b64 = httpd_MsgGet( query, "Authorization" ); /* BASIC id */
-                                    char auth[strlen(b64) +1];
+                                    char *auth;
+                                    char *id;
+
+                                    asprintf( &id, "%s:%s", url->psz_user, url->psz_password );
+                                    auth = malloc( strlen(b64) + 1 );
 
-                                    sprintf( id, "%s:%s", url->psz_user, url->psz_password );
                                     if( !strncasecmp( b64, "BASIC", 5 ) )
                                     {
                                         b64 += 5;
@@ -1955,8 +1958,13 @@ static void httpd_HostThread( httpd_host_t *host )
                                         httpd_MsgAdd( answer, "WWW-Authenticate", "Basic realm=\"%s\"", url->psz_user );
                                         /* We fail for all url */
                                         b_auth_failed = VLC_TRUE;
+                                        free( id );
+                                        free( auth );
                                         break;
                                     }
+
+                                    free( id );
+                                    free( auth );
                                 }
 
                                 if( !url->catch[i_msg].cb( url->catch[i_msg].p_sys, cl, answer, query ) )
@@ -2023,7 +2031,7 @@ static void httpd_HostThread( httpd_host_t *host )
             }
             else if( cl->i_state == HTTPD_CLIENT_SEND_DONE )
             {
-                if( cl->i_mode == HTTPD_CLIENT_FILE )
+                if( cl->i_mode == HTTPD_CLIENT_FILE || cl->answer.i_body_offset == 0 )
                 {
                     cl->url = NULL;
                     if( ( cl->query.i_proto == HTTPD_PROTO_HTTP &&
@@ -2196,7 +2204,8 @@ static int BuildAddr( struct sockaddr_in * p_socket,
         if( !inet_aton( psz_address, &p_socket->sin_addr ) )
 #else
         p_socket->sin_addr.s_addr = inet_addr( psz_address );
-        if( p_socket->sin_addr.s_addr == INADDR_NONE )
+/*        if( p_socket->sin_addr.s_addr == INADDR_NONE )*/
+        if( p_socket->sin_addr.s_addr == INADDR_BROADCAST )
 #endif
         {
             /* We have a fqdn, try to find its address */