Changeset 1788

Show
Ignore:
Timestamp:
08/12/08 23:14:34 (3 months ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/trunk/ChangeLog

    r1786 r1788  
     12008-08-12  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * cherokee/connection.c (cherokee_connection_clean_error_headers), 
     4        cherokee/thread.c (process_active_connections): It had to remove 
     5        the Content-Length header if the handler is not reporting error 
     6        messages because it has to add its own. Fixes a bug with previous 
     7        versions (cgi, fcgi and scgi). 
     8 
    192008-08-12  Taher Shihadeh <taher@unixwars.com> 
    210        * doc/cookbook_ror.txt, doc/cookbook_php.txt, 
  • cherokee/trunk/cherokee/connection-protected.h

    r1747 r1788  
    239239ret_t cherokee_connection_build_local_directory  (cherokee_connection_t *conn, cherokee_virtual_server_t *vsrv, cherokee_config_entry_t *entry); 
    240240ret_t cherokee_connection_build_local_directory_userdir (cherokee_connection_t *conn, cherokee_virtual_server_t *vsrv, cherokee_config_entry_t *entry); 
     241ret_t cherokee_connection_clean_error_headers    (cherokee_connection_t *conn); 
    241242 
    242243ret_t cherokee_connection_clean_for_respin       (cherokee_connection_t *conn); 
  • cherokee/trunk/cherokee/connection.c

    r1785 r1788  
    19061906 
    19071907 
     1908ret_t 
     1909cherokee_connection_clean_error_headers (cherokee_connection_t *conn) 
     1910{ 
     1911        char *begin; 
     1912        char *end; 
     1913 
     1914        if (cherokee_buffer_is_empty (&conn->header_buffer)) 
     1915                return ret_ok; 
     1916 
     1917        begin = strcasestr (conn->header_buffer.buf, "Content-Length: "); 
     1918        if (begin != NULL) { 
     1919                end = strchr (begin+16, CHR_CR); 
     1920                if (end == NULL) 
     1921                        return ret_error; 
     1922 
     1923                if (end[1] == CHR_LF) 
     1924                        end++; 
     1925 
     1926                cherokee_buffer_remove_chunk (&conn->header_buffer,  
     1927                                              begin - conn->header_buffer.buf,  
     1928                                              (end-begin)+1); 
     1929        } 
     1930 
     1931        return ret_ok; 
     1932} 
     1933 
     1934 
    19081935int 
    19091936cherokee_connection_use_webdir (cherokee_connection_t *conn) 
  • cherokee/trunk/cherokee/thread.c

    r1759 r1788  
    983983                         
    984984                        /* If it is an error, and the connection has not a handler to manage 
    985                          * this error, the handler has to be changed 
    986                          */ 
    987                         if ((http_type_300(conn->error_code) ||  
    988                              http_type_400(conn->error_code) || 
    989                              http_type_500(conn->error_code)) && 
    990                             conn->handler && (!HANDLER_SUPPORTS (conn->handler, hsupport_error))) 
     985                         * this error, the handler has to be changed by an error_handler. 
     986                         */ 
     987                        if (conn->handler == NULL) { 
     988                                conns_freed++; 
     989                                purge_closed_connection (thd, conn); 
     990                                continue; 
     991                        } 
     992 
     993                        if (http_type_300(conn->error_code) ||  
     994                            http_type_400(conn->error_code) || 
     995                            http_type_500(conn->error_code)) 
    991996                        { 
    992                                 /* Try to setup an error handler 
    993                                  */ 
    994                                 ret = cherokee_connection_setup_error_handler (conn); 
    995                                 if (ret != ret_ok) { 
     997                                if (HANDLER_SUPPORTS (conn->handler, hsupport_error)) { 
     998                                        ret = cherokee_connection_clean_error_headers (conn); 
     999                                        if (unlikely (ret != ret_ok)) { 
     1000                                                conns_freed++; 
     1001                                                purge_closed_connection (thd, conn); 
     1002                                                continue; 
     1003                                        } 
     1004                                } else { 
     1005                                        /* Try to setup an error handler 
     1006                                         */ 
     1007                                        ret = cherokee_connection_setup_error_handler (conn); 
     1008                                        if (ret != ret_ok) { 
    9961009                                         
    997                                         /* It could not change the handler to an error 
    998                                          * managing handler, so it is a critical error. 
    999                                          */                                      
    1000                                         conns_freed++; 
    1001                                         purge_closed_connection (thd, conn); 
    1002                                         continue; 
     1010                                                /* It could not change the handler to an error 
     1011                                                 * managing handler, so it is a critical error. 
     1012                                                 */                                      
     1013                                                conns_freed++; 
     1014                                                purge_closed_connection (thd, conn); 
     1015                                                continue; 
     1016                                        } 
     1017 
     1018                                        /* At this point, two different things might happen: 
     1019                                         * - It has got a common handler like handler_redir 
     1020                                         * - It has got an error handler like handler_error 
     1021                                         */ 
     1022                                        conn->phase = phase_init; 
     1023                                        break; 
    10031024                                } 
    1004  
    1005                                 /* At this point, two different things might happen: 
    1006                                  * - It has got a common handler like handler_redir 
    1007                                  * - It has got an error handler like handler_error 
    1008                                  */ 
    1009                                 conn->phase = phase_init; 
    1010                                 break; 
    10111025                        } 
    10121026