httpd_message_t *query )
{
httpd_redirect_t *rdir = (httpd_redirect_t*)p_sys;
+ char *p_body;
if( answer == NULL || query == NULL )
{
answer->i_status = 301;
answer->psz_status = strdup( "Moved Permanently" );
- answer->i_body = asprintf( (char **)&answer->p_body,
+ answer->i_body = asprintf( &p_body,
"<?xml version=\"1.0\" encoding=\"ascii\" ?>\n"
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" "
"\"http://www.w3.org/TR/xhtml10/DTD/xhtml10strict.dtd\">\n"
"<hr />\n"
"</body>\n"
"</html>\n", rdir->psz_dst );
+ answer->p_body = (unsigned char *)p_body;
/* XXX check if it's ok or we need to set an absolute url */
httpd_MsgAdd( answer, "Location", "%s", rdir->psz_dst );
{
tls_session_t *p_tls = NULL;
- stats_Create( host, "client_connections", STATS_CLIENT_CONNECTIONS,
- VLC_VAR_INTEGER, STATS_COUNTER );
- stats_Create( host, "active_connections", STATS_ACTIVE_CONNECTIONS,
- VLC_VAR_INTEGER, STATS_COUNTER );
+ host->p_total_counter = stats_CounterCreate( host,
+ VLC_VAR_INTEGER, STATS_COUNTER );
+ host->p_active_counter = stats_CounterCreate( host,
+ VLC_VAR_INTEGER, STATS_COUNTER );
while( !host->b_die )
{
cl->i_activity_date+cl->i_activity_timeout < mdate()) ) ) )
{
httpd_ClientClean( cl );
- stats_UpdateInteger( host, STATS_ACTIVE_CONNECTIONS, -1, NULL );
+ stats_UpdateInteger( host, host->p_active_counter, -1, NULL );
TAB_REMOVE( host->i_client, host->client, cl );
free( cl );
i_client--;
if( fd >= 0 )
{
- int i_state = 0;
+ int i_state = 1;
+
+ setsockopt( fd, SOL_SOCKET, SO_REUSEADDR, &i_state, sizeof (i_state));
+ i_state = 0;
/* set this new socket non-block */
#if defined( WIN32 ) || defined( UNDER_CE )
{
int i_val = fcntl( fd, F_GETFL );
fcntl( fd, F_SETFL,
- O_NONBLOCK | (i_val != -1) ? i_val : 0 );
+ O_NONBLOCK | ((i_val != -1) ? i_val : 0) );
}
if( fd >= FD_SETSIZE )
{
httpd_client_t *cl;
char ip[NI_MAXNUMERICHOST];
- stats_UpdateInteger( host, STATS_CLIENT_CONNECTIONS,
+ stats_UpdateInteger( host, host->p_total_counter,
+ 1, NULL );
+ stats_UpdateInteger( host, host->p_active_counter,
1, NULL );
- stats_UpdateInteger( host, STATS_ACTIVE_CONNECTIONS, 1,
- NULL );
cl = httpd_ClientNew( fd, &sock, i_sock_size, p_tls );
httpd_ClientIP( cl, ip );
msg_Dbg( host, "Connection from %s", ip );