Changeset 909

Show
Ignore:
Timestamp:
09/06/07 19:28:33 (1 year ago)
Author:
alo
Message:

--

Files:

Legend:

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

    r908 r909  
     12007-09-06  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * cherokee/connection.c (cherokee_connection_build_header): If the 
     4        handler doesn't support to add headers, don't even call the 
     5        handler method.  It shouldn't adding the server headers either. 
     6        It fixes: http://code.google.com/p/cherokee/issues/detail?id=17 
     7 
     8        * cherokee/handler.h (HANDLER_SUPPORTS): Added new macro. There is 
     9        some clean up around the handler class macros that we need to 
     10        accomplish soon. 
     11 
    1122007-08-04  Juan Badia  <jubapa@gmail.com> 
    213 
  • cherokee/trunk/cherokee/connection.c

    r897 r909  
    525525        ret_t ret; 
    526526 
     527        /* If the handler requires not to add headers, exit. 
     528         */ 
     529        if (HANDLER_SUPPORTS (conn->handler, dont_add_headers))  
     530                return ret_ok; 
     531 
    527532        /* Try to get the headers from the handler 
    528533         */ 
     
    530535        if (unlikely (ret != ret_ok)) { 
    531536                switch (ret) { 
    532  
    533537                case ret_eof: 
    534538                case ret_error: 
    535539                case ret_eagain: 
    536540                        return ret; 
    537  
    538541                default: 
    539542                        RET_UNKNOWN(ret); 
     
    542545        } 
    543546 
    544         if (HANDLER_SUPPORT_MAYBE_LENGTH(conn->handler) && 
    545                conn->keepalive != 0) { 
     547        if ((conn->keepalive != 0) && 
     548            HANDLER_SUPPORTS(conn->handler, maybe_length)) { 
    546549                if (strcasestr (conn->header_buffer.buf, "Content-Length: ") == NULL) { 
    547550                        conn->keepalive = 0; 
     
    551554        /* Add the server headers        
    552555         */ 
    553         if (! (conn->handler->support & hsupport_dont_add_headers)) 
    554                 build_response_header (conn, &conn->buffer); 
    555  
    556         /* Add handler headers 
     556        build_response_header (conn, &conn->buffer); 
     557 
     558        /* Add handler headers end EOH 
    557559         */ 
    558560        cherokee_buffer_add_buffer (&conn->buffer, &conn->header_buffer); 
    559  
    560         /* END of response 
    561          */ 
    562561        cherokee_buffer_add_str (&conn->buffer, CRLF); 
    563562 
  • cherokee/trunk/cherokee/handler.h

    r841 r909  
    9090#define HANDLER_SUPPORT_COMPLEX_HEADERS(h) (HANDLER(h)->support & hsupport_complex_headers) 
    9191#define HANDLER_SUPPORT_ERROR(h)           (HANDLER(h)->support & hsupport_error) 
    92  
     92#define HANDLER_SUPPORTS(h,s)              (HANDLER(h)->support & hsupport_ ## s) 
    9393 
    9494/* Module information