]> git.sesse.net Git - vlc/commitdiff
* modules/misc/httpd.c: win32 fixes.
authorGildas Bazin <gbazin@videolan.org>
Fri, 9 May 2003 16:01:17 +0000 (16:01 +0000)
committerGildas Bazin <gbazin@videolan.org>
Fri, 9 May 2003 16:01:17 +0000 (16:01 +0000)
* modules/control/http.c: fixed a problem with IE that sends POST requests instead of GET ones.

modules/control/http.c
modules/misc/httpd.c

index 944fe739846edfa1ebfd705b87a6eba4041bcc92..b914137ec2b2b40ff102a5f31244e894a15090d4 100644 (file)
@@ -2,7 +2,7 @@
  * http.c :  http remote control plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: http.c,v 1.4 2003/05/06 14:19:29 fenrir Exp $
+ * $Id: http.c,v 1.5 2003/05/09 16:01:17 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -180,7 +180,8 @@ static void Run( intf_thread_t *p_intf )
     p_page_intf = p_intf->p_sys->p_httpd->pf_register_file(
                       p_intf->p_sys->p_httpd, "/", "text/html",
                       NULL, NULL, httpd_page_interface_get,
-                      NULL, (httpd_file_callback_args_t*)p_intf );
+                      httpd_page_interface_get,
+                      (httpd_file_callback_args_t*)p_intf );
 
     while( !p_intf->b_die )
     {
@@ -279,7 +280,16 @@ static void uri_extract_value( char *psz_uri, char *psz_name,
         }
         else
         {
-            i_len = strlen( p );
+            /* for POST method */
+            if( strchr( p, '\n' ) )
+            {
+                i_len = strchr( p, '\n' ) - p;
+                if( i_len && *(p+i_len-1) == '\r' ) i_len--;
+            }
+            else
+            {
+                i_len = strlen( p );
+            }
         }
         i_len = __MIN( i_value_max - 1, i_len );
         if( i_len > 0 )
index 76a8472b1dd27bb52952338df438576342013fa2..4a3bd93520b6fbfa7b0549e235c80872bc51798d 100644 (file)
@@ -2,7 +2,7 @@
  * httpd.c
  *****************************************************************************
  * Copyright (C) 2001-2003 VideoLAN
- * $Id: httpd.c,v 1.13 2003/04/27 14:11:26 gbazin Exp $
+ * $Id: httpd.c,v 1.14 2003/05/09 16:01:17 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -1803,7 +1803,7 @@ static void httpd_Thread( httpd_sys_t *p_httpt )
 
 
 #if defined( WIN32 ) || defined( UNDER_CE )
-                if( ( i_len < 0 && WSAGetLastError() == !WSAEWOULDBLOCK ) ||
+                if( ( i_len < 0 && WSAGetLastError() != WSAEWOULDBLOCK ) ||
 #else
                 if( ( i_len < 0 && errno != EAGAIN && errno != EINTR ) ||
 #endif
@@ -1853,7 +1853,11 @@ static void httpd_Thread( httpd_sys_t *p_httpt )
                 }
 //                msg_Warn( p_httpt, "on %d send %d bytes %s", p_con->i_buffer_size, i_len, p_con->p_buffer + p_con->i_buffer );
 
-                if( ( i_len < 0 && errno != EAGAIN && errno != EINTR )||
+#if defined( WIN32 ) || defined( UNDER_CE )
+                if( ( i_len < 0 && WSAGetLastError() != WSAEWOULDBLOCK ) ||
+#else
+                if( ( i_len < 0 && errno != EAGAIN && errno != EINTR ) ||
+#endif
                     ( i_len == 0 ) )
                 {
                     httpd_connection_t *p_next = p_con->p_next;
@@ -1952,7 +1956,12 @@ static void httpd_Thread( httpd_sys_t *p_httpt )
                     }
                     i_send = send( p_con->fd, &p_stream->p_buffer[i_pos], i_write, 0 );
 
-                    if( ( i_send < 0 && errno != EAGAIN && errno != EINTR )|| ( i_send == 0 ) )
+#if defined( WIN32 ) || defined( UNDER_CE )
+                    if( ( i_send < 0 && WSAGetLastError() != WSAEWOULDBLOCK )||
+#else
+                    if( ( i_send < 0 && errno != EAGAIN && errno != EINTR )||
+#endif
+                        ( i_send == 0 ) )
                     {
                         httpd_connection_t *p_next = p_con->p_next;