Changeset 4d907c9406499a7931676e0e5162280025cd1cd6

Show
Ignore:
Timestamp:
11/08/03 22:18:02 (5 years ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1060633082 +0000
git-parent:

[5e422b1ff9247e46387798e43076f9c185cde6f2]

git-author:
Laurent Aimar <fenrir@videolan.org> 1060633082 +0000
Message:
  • httpd: added HEAD command support.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/misc/httpd.c

    raf3dd2c r4d907c9  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001-2003 VideoLAN 
    5  * $Id: httpd.c,v 1.24 2003/07/10 22:37:02 fenrir Exp $ 
     5 * $Id: httpd.c,v 1.25 2003/08/11 20:18:02 fenrir Exp $ 
    66 * 
    77 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
     
    2424/***************************************************************************** 
    2525 * Preamble 
     26 * 
     27 * TODO: 
     28 *  - make that two distinct host:port use different daemon 
    2629 *****************************************************************************/ 
    2730#include <stdlib.h> 
     
    135138}; 
    136139 
    137 #define HTTPD_AUTHENTICATE_NONE     0 
    138 #define HTTPD_AUTHENTICATE_BASIC    1 
     140enum httpd_authenticate_e 
     141
     142    HTTPD_AUTHENTICATE_NONE = 0, 
     143    HTTPD_AUTHENTICATE_BASIC = 1 
     144}; 
    139145 
    140146//typedef httpd_file_t httpd_stream_t; 
     
    172178 
    173179 
    174 #define HTTPD_CONNECTION_RECEIVING_REQUEST      1 
    175 #define HTTPD_CONNECTION_SENDING_HEADER         2 
    176 #define HTTPD_CONNECTION_SENDING_FILE           3 
    177 #define HTTPD_CONNECTION_SENDING_STREAM         4 
    178 #define HTTPD_CONNECTION_TO_BE_CLOSED           5 
    179  
    180 #define HTTPD_CONNECTION_METHOD_GET             1 
    181 #define HTTPD_CONNECTION_METHOD_POST            2 
     180enum httpd_connection_state_e 
     181
     182    HTTPD_CONNECTION_RECEIVING_REQUEST = 1, 
     183    HTTPD_CONNECTION_SENDING_HEADER = 2, 
     184    HTTPD_CONNECTION_SENDING_FILE = 3, 
     185    HTTPD_CONNECTION_SENDING_STREAM = 4, 
     186    HTTPD_CONNECTION_TO_BE_CLOSED = 5 
     187}; 
     188 
     189enum httpd_connection_method_e 
     190
     191    HTTPD_CONNECTION_METHOD_GET = 1, 
     192    HTTPD_CONNECTION_METHOD_POST = 2, 
     193    HTTPD_CONNECTION_METHOD_HEAD =3 
     194}; 
     195 
    182196typedef struct httpd_connection_s 
    183197{ 
     
    248262static void httpd_ConnnectionClose( httpd_sys_t *, httpd_connection_t * ); 
    249263static int httpd_UnbanIP( httpd_sys_t *, httpd_banned_ip_t *); 
     264#if 0 
    250265static int httpd_BanIP( httpd_sys_t *, char *); 
     266#endif 
    251267static httpd_banned_ip_t *httpd_GetbannedIP( httpd_sys_t *, char * ); 
    252268 
     
    11241140} 
    11251141 
    1126  
     1142#if 0 
    11271143static int httpd_BanIP( httpd_sys_t *p_httpt, char * psz_new_banned_ip) 
    11281144{ 
     
    11681184    return 0; 
    11691185} 
    1170  
     1186#endif 
    11711187static httpd_banned_ip_t *httpd_GetbannedIP( httpd_sys_t *p_httpt, char *psz_ip ) 
    11721188{ 
     
    14451461        p_con->i_method = HTTPD_CONNECTION_METHOD_POST; 
    14461462    } 
     1463    else if( !strcmp( command, "HEAD" )) 
     1464    { 
     1465        p_con->i_method = HTTPD_CONNECTION_METHOD_HEAD; 
     1466    } 
    14471467    else 
    14481468    { 
     
    15641584        { 
    15651585            if( p_httpt->file[i]->b_stream || 
     1586                p_con->i_method == HTTPD_CONNECTION_METHOD_HEAD || 
    15661587                ( p_con->i_method == HTTPD_CONNECTION_METHOD_GET  && p_httpt->file[i]->pf_get ) || 
    15671588                ( p_con->i_method == HTTPD_CONNECTION_METHOD_POST && p_httpt->file[i]->pf_post ) ) 
     
    18721893                            FREE( p_con->p_buffer ); 
    18731894 
    1874                             if( !p_con->p_file->b_stream
     1895                            if( !p_con->p_file->b_stream || p_con->i_method == HTTPD_CONNECTION_METHOD_HEAD
    18751896                            { 
    18761897                                p_con->i_state = HTTPD_CONNECTION_SENDING_FILE; // be sure to out from HTTPD_CONNECTION_SENDING_HEADER 
     
    18891910                                else 
    18901911                                { 
     1912                                    /* HTTPD_CONNECTION_METHOD_HEAD for example */ 
    18911913                                    p_con->p_buffer = NULL; 
    18921914                                    p_con->i_buffer_size = 0;