X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fnetwork%2Fhttpd.c;h=af4db3d6d37d07c713cd2792b7d4c8a04aca50ec;hb=ba94a1b655983aa0dbfcb8a5d09436007a22b7df;hp=fd402d301f5927d53de1a0cabaf84206690b5942;hpb=36da998fbebd55962d5cb587f3a66bdee064fdfc;p=vlc diff --git a/src/network/httpd.c b/src/network/httpd.c index fd402d301f..af4db3d6d3 100644 --- a/src/network/httpd.c +++ b/src/network/httpd.c @@ -23,6 +23,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #ifdef ENABLE_HTTPD @@ -437,7 +441,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 ); @@ -484,14 +488,18 @@ httpd_file_t *httpd_FileNew( httpd_host_t *host, return file; } -void httpd_FileDelete( httpd_file_t *file ) +httpd_file_sys_t *httpd_FileDelete( httpd_file_t *file ) { + httpd_file_sys_t *p_sys = file->p_sys; + httpd_UrlDelete( file->url ); free( file->psz_url ); free( file->psz_mime ); free( file ); + + return p_sys; } /***************************************************************************** @@ -618,10 +626,12 @@ httpd_handler_t *httpd_HandlerNew( httpd_host_t *host, const char *psz_url, return handler; } -void httpd_HandlerDelete( httpd_handler_t *handler ) +httpd_handler_sys_t *httpd_HandlerDelete( httpd_handler_t *handler ) { + httpd_handler_sys_t *p_sys = handler->p_sys; httpd_UrlDelete( handler->url ); free( handler ); + return p_sys; } /***************************************************************************** @@ -1063,8 +1073,9 @@ httpd_host_t *httpd_TLSHostNew( vlc_object_t *p_this, const char *psz_hostname, goto error; vlc_object_lock( host ); - if( vlc_object_waitpipe( host ) == -1 ) + if( vlc_object_waitpipe( VLC_OBJECT( host ) ) == -1 ) { + msg_Err( host, "signaling pipe error: %m" ); vlc_object_unlock( host ); goto error; } @@ -2024,10 +2035,11 @@ static void httpd_HostThread( httpd_host_t *host ) counter_t *p_total_counter = stats_CounterCreate( host, VLC_VAR_INTEGER, STATS_COUNTER ); counter_t *p_active_counter = stats_CounterCreate( host, VLC_VAR_INTEGER, STATS_COUNTER ); int evfd; - vlc_bool_t b_die = VLC_FALSE; + vlc_bool_t b_die; vlc_object_lock( host ); - evfd = vlc_object_waitpipe( host ); + evfd = vlc_object_waitpipe( VLC_OBJECT( host ) ); + b_die = !vlc_object_alive( host ); vlc_object_unlock( host ); while( !b_die ) @@ -2501,18 +2513,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 ) )