Commit 3755de85 authored by Gildas Bazin's avatar Gildas Bazin

* configure.ac.in, modules/misc/httpd.c: compilation fixes for win32.
parent 7def7049
...@@ -130,7 +130,7 @@ case "x${target_os}" in ...@@ -130,7 +130,7 @@ case "x${target_os}" in
LDFLAGS_access_ftp="${LDFLAGS_access_ftp} -lws2_32" LDFLAGS_access_ftp="${LDFLAGS_access_ftp} -lws2_32"
LDFLAGS_access_output_udp="${LDFLAGS_access_output_udp} -lws2_32" LDFLAGS_access_output_udp="${LDFLAGS_access_output_udp} -lws2_32"
LDFLAGS_sap="${LDFLAGS_sap} -lws2_32" LDFLAGS_sap="${LDFLAGS_sap} -lws2_32"
LDFALGS_httpd="${LDFLAGS_httpd} -lws2_32" LDFLAGS_httpd="${LDFLAGS_httpd} -lws2_32"
fi fi
;; ;;
x*nto*) x*nto*)
...@@ -1739,22 +1739,22 @@ AC_ARG_ENABLE(dv, ...@@ -1739,22 +1739,22 @@ AC_ARG_ENABLE(dv,
[ --enable-dv DV decoder support (default disabled)]) [ --enable-dv DV decoder support (default disabled)])
if test "x${enable_dv}" = "xyes" if test "x${enable_dv}" = "xyes"
then then
AC_CHECK_HEADERS(FLAC/stream_decoder.h, [ AC_CHECK_HEADERS(libdv/dv.h, [
PLUGINS="${PLUGINS} flac flacdec" PLUGINS="${PLUGINS} dv"
LDFLAGS_flacdec="${LDFLAGS_flacdec} -lFLAC" LDFLAGS_dv="${LDFLAGS_dv} -ldv"
],[]) ],[])
fi fi
dnl dnl
dnl DV plugin dnl Flac plugin
dnl dnl
AC_ARG_ENABLE(flac, AC_ARG_ENABLE(flac,
[ --enable-falc flac decoder support (default disabled)]) [ --enable-falc flac decoder support (default disabled)])
if test "x${enable_flac}" = "xyes" if test "x${enable_flac}" = "xyes"
then then
AC_CHECK_HEADERS(libdv/dv.h, [ AC_CHECK_HEADERS(FLAC/stream_decoder.h, [
PLUGINS="${PLUGINS} dv" PLUGINS="${PLUGINS} flac flacdec"
LDFLAGS_dv="${LDFLAGS_dv} -ldv" LDFLAGS_flacdec="${LDFLAGS_flacdec} -lFLAC"
],[]) ],[])
fi fi
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* httpd.c * httpd.c
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2003 VideoLAN * Copyright (C) 2001-2003 VideoLAN
* $Id: httpd.c,v 1.1 2003/02/23 19:05:22 fenrir Exp $ * $Id: httpd.c,v 1.2 2003/02/24 11:14:16 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -73,9 +73,9 @@ ...@@ -73,9 +73,9 @@
#define FREE( p ) if( p ) { free( p); (p) = NULL; } #define FREE( p ) if( p ) { free( p); (p) = NULL; }
#if defined( WIN32 ) || defined( UNDER_CE ) #if defined( WIN32 ) || defined( UNDER_CE )
#define SOCKET_CLOSE closesocket; #define SOCKET_CLOSE(a) closesocket(a)
#else #else
#define SOCKET_CLOSE close #define SOCKET_CLOSE(a) close(a)
#endif #endif
/***************************************************************************** /*****************************************************************************
...@@ -389,14 +389,16 @@ static int BuildAddr( struct sockaddr_in * p_socket, ...@@ -389,14 +389,16 @@ static int BuildAddr( struct sockaddr_in * p_socket,
* listen on a host for a httpd instance * listen on a host for a httpd instance
*/ */
static httpd_host_t *_RegisterHost( httpd_sys_t *p_httpt, char *psz_host_addr, int i_port ) static httpd_host_t *_RegisterHost( httpd_sys_t *p_httpt, char *psz_host_addr, int i_port )
{ {
httpd_host_t *p_host; httpd_host_t *p_host;
struct sockaddr_in sock; struct sockaddr_in sock;
int i; int i;
int fd = -1; int fd = -1;
int i_opt; int i_opt;
#if !defined( WIN32 ) && !defined( UNDER_CE )
int i_flags; int i_flags;
#endif
if( BuildAddr( &sock, psz_host_addr, i_port ) ) if( BuildAddr( &sock, psz_host_addr, i_port ) )
{ {
...@@ -440,12 +442,22 @@ static httpd_host_t *_RegisterHost( httpd_sys_t *p_httpt, char *psz_host_add ...@@ -440,12 +442,22 @@ static httpd_host_t *_RegisterHost( httpd_sys_t *p_httpt, char *psz_host_add
msg_Warn( p_httpt, "cannot configure socket (SO_REUSEADDR)" ); msg_Warn( p_httpt, "cannot configure socket (SO_REUSEADDR)" );
} }
/* bind it */ /* bind it */
if( bind( fd, &sock, sizeof( struct sockaddr_in ) ) < 0 ) if( bind( fd, (struct sockaddr *)&sock, sizeof( struct sockaddr_in ) ) < 0 )
{ {
msg_Err( p_httpt, "cannot bind socket" ); msg_Err( p_httpt, "cannot bind socket" );
goto socket_failed; goto socket_failed;
} }
/* set to non-blocking */ /* set to non-blocking */
#if defined( WIN32 ) || defined( UNDER_CE )
{
unsigned long i_dummy = 1;
if( ioctlsocket( fd, FIONBIO, &i_dummy ) != 0 )
{
msg_Err( p_httpt, "cannot set socket to non-blocking mode" );
goto socket_failed;
}
}
#else
if( ( i_flags = fcntl( fd, F_GETFL, 0 ) ) < 0 ) if( ( i_flags = fcntl( fd, F_GETFL, 0 ) ) < 0 )
{ {
msg_Err( p_httpt, "cannot F_GETFL socket" ); msg_Err( p_httpt, "cannot F_GETFL socket" );
...@@ -456,6 +468,7 @@ static httpd_host_t *_RegisterHost( httpd_sys_t *p_httpt, char *psz_host_add ...@@ -456,6 +468,7 @@ static httpd_host_t *_RegisterHost( httpd_sys_t *p_httpt, char *psz_host_add
msg_Err( p_httpt, "cannot F_SETFL O_NONBLOCK" ); msg_Err( p_httpt, "cannot F_SETFL O_NONBLOCK" );
goto socket_failed; goto socket_failed;
} }
#endif
/* listen */ /* listen */
if( listen( fd, LISTEN_BACKLOG ) < 0 ) if( listen( fd, LISTEN_BACKLOG ) < 0 )
{ {
...@@ -1357,10 +1370,18 @@ static void httpd_Thread( httpd_sys_t *p_httpt ) ...@@ -1357,10 +1370,18 @@ static void httpd_Thread( httpd_sys_t *p_httpt )
struct sockaddr_in sock; struct sockaddr_in sock;
int fd; int fd;
fd = accept( p_httpt->host[i]->fd, &sock, &i_sock_size ); fd = accept( p_httpt->host[i]->fd, (struct sockaddr *)&sock,
&i_sock_size );
if( fd > 0 ) if( fd > 0 )
{ {
#if defined( WIN32 ) || defined( UNDER_CE )
{
unsigned long i_dummy = 1;
ioctlsocket( fd, FIONBIO, &i_dummy );
}
#else
fcntl( fd, F_SETFL, O_NONBLOCK ); fcntl( fd, F_SETFL, O_NONBLOCK );
#endif
if( p_httpt->i_connection_count >= HTTPD_MAX_CONNECTION ) if( p_httpt->i_connection_count >= HTTPD_MAX_CONNECTION )
{ {
...@@ -1542,4 +1563,3 @@ static void httpd_Thread( httpd_sys_t *p_httpt ) ...@@ -1542,4 +1563,3 @@ static void httpd_Thread( httpd_sys_t *p_httpt )
_UnregisterFile( p_httpt, p_page_404 ); _UnregisterFile( p_httpt, p_page_404 );
_UnregisterFile( p_httpt, p_page_admin ); _UnregisterFile( p_httpt, p_page_admin );
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment