Changeset 1806

Show
Ignore:
Timestamp:
08/14/08 11:09:01 (3 months ago)
Author:
alo
Message:

--

Files:

Legend:

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

    r1801 r1806  
     12008-08-14  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * cherokee/connection.c: Allows 3xx replies to keep the connection 
     4        alive. 
     5 
    162008-08-13  Taher Shihadeh <taher@unixwars.com> 
    27 
  • cherokee/trunk/cherokee/connection.c

    r1788 r1806  
    357357        entry = vsrv->error_handler; 
    358358 
    359         /* On error, it will close the socket 
    360          */ 
    361         conn->keepalive = 0; 
    362  
    363359        /* It has a common handler. It has to be freed. 
    364360         */ 
     
    389385        } 
    390386#endif 
     387 
     388        /* Only 3xx errors can keep the connection alive 
     389         */ 
     390        if ((! (http_type_300 (conn->error_code))) || 
     391            (! (conn->handler->support & hsupport_length))) 
     392        { 
     393                conn->keepalive = 0; 
     394        } 
    391395 
    392396        /* Nothing should be mmaped any longer 
     
    559563        } 
    560564 
     565        /* It might need to deactive Keep-Alive 
     566         */ 
    561567        if ((conn->keepalive != 0) && 
    562             HANDLER_SUPPORTS(conn->handler, hsupport_maybe_length)) { 
    563                 if (strcasestr (conn->header_buffer.buf, "Content-Length: ") == NULL) { 
     568            (http_method_with_body (conn->error_code)))  
     569        { 
     570                if (HANDLER_SUPPORTS (conn->handler, hsupport_maybe_length)) { 
     571                        if (strcasestr (conn->header_buffer.buf, "Content-Length: ") == NULL) 
     572                                conn->keepalive = 0; 
     573                } 
     574                 
     575                if (HANDLER_SUPPORTS (conn->handler, hsupport_length) == 0) 
    564576                        conn->keepalive = 0; 
    565                 } 
    566577        } 
    567578 
     
    17111722                        conn->keepalive = 0; 
    17121723                } 
    1713  
    17141724        } else { 
    17151725                conn->keepalive = 0; 
     
    17841794               conn->local_directory.buf); 
    17851795 
    1786         /* If the connection is keep-alive 
    1787          * then verify whether the handler supports it. 
    1788          */ 
    1789         if ((conn->keepalive != 0) && 
    1790             (HANDLER_SUPPORTS (conn->handler, hsupport_length) == 0) &&  
    1791             (HANDLER_SUPPORTS (conn->handler, hsupport_maybe_length) == 0)) 
    1792         { 
    1793                 conn->keepalive = 0; 
    1794         } 
    1795  
    17961796        /* Ensure the space for headers and I/O buffer 
    17971797         */ 
     
    17991799        cherokee_buffer_ensure_size (&conn->buffer, DEFAULT_READ_SIZE+1); 
    18001800 
     1801        /* Init the connection handler object 
     1802         */ 
    18011803        return cherokee_handler_init (conn->handler); 
    18021804}