]> git.sesse.net Git - vlc/blobdiff - src/network/httpd.c
avoid mere whitespaces when hostname is not specified
[vlc] / src / network / httpd.c
index 1339b2e6174ab46c3eb3e2efc9d970bea8d89ac9..9d7d57406c62e0390591eb9383c6a81b02ecd2a0 100644 (file)
@@ -437,7 +437,7 @@ httpd_FileCallBack( httpd_callback_sys_t *p_sys, httpd_client_t *cl,
     psz_connection = httpd_MsgGet( &cl->query, "Connection" );
     if( psz_connection != NULL )
     {
-        httpd_MsgAdd( answer, "Connection", psz_connection );
+        httpd_MsgAdd( answer, "Connection", "%s", psz_connection );
     }
 
     httpd_MsgAdd( answer, "Content-Length", "%d", answer->i_body );
@@ -1071,6 +1071,7 @@ httpd_host_t *httpd_TLSHostNew( vlc_object_t *p_this, const char *psz_hostname,
     vlc_object_lock( host );
     if( vlc_object_waitpipe( VLC_OBJECT( host ) ) == -1 )
     {
+        msg_Err( host, "signaling pipe error: %m" );
         vlc_object_unlock( host );
         goto error;
     }
@@ -2034,7 +2035,7 @@ static void httpd_HostThread( httpd_host_t *host )
 
     vlc_object_lock( host );
     evfd = vlc_object_waitpipe( VLC_OBJECT( host ) );
-    b_die = vlc_object_alive( host );
+    b_die = !vlc_object_alive( host );
     vlc_object_unlock( host );
 
     while( !b_die )
@@ -2508,18 +2509,19 @@ static void httpd_HostThread( httpd_host_t *host )
         {
             httpd_client_t *cl;
             int i_state = -1;
+            int fd = ufd[nfd].fd;
 
-            assert (ufd[nfd].fd == host->fds[nfd]);
+            assert (fd == host->fds[nfd]);
 
             if( ufd[nfd].revents == 0 )
                 continue;
 
             /* */
-            int kludge[] = { ufd[nfd].fd, -1 };
-            int fd = net_Accept( host, kludge, 0 );
-            if( fd < 0 )
+            fd = accept (fd, NULL, NULL);
+            if (fd == -1)
                 continue;
 
+            net_SetupSocket (fd);
             if( p_tls != NULL )
             {
                 switch( tls_ServerSessionHandshake( p_tls, fd ) )