Changeset 1663

Show
Ignore:
Timestamp:
02/19/2007 01:52:23 PM (1 year ago)
Author:
darix
Message:

- applied patch from colin.stephen@o2.com (#1041)

fixes http 500 errors with mod_fastcgi

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/lighttpd-1.4.x/src/mod_fastcgi.c

    r1607 r1663  
    23682368         */ 
    23692369        if (ioctl(hctx->fd, FIONREAD, &toread)) { 
     2370                if( errno == EAGAIN ) return 0; 
    23702371                log_error_write(srv, __FILE__, __LINE__, "sd", 
    23712372                                "unexpected end-of-file (perhaps the fastcgi process died):", 
     
    23782379        if (toread > 0) { 
    23792380                buffer *b; 
     2381                chunk *cq_first = hctx->rb->first; 
     2382                chunk *cq_last = hctx->rb->last; 
    23802383 
    23812384                b = chunkqueue_get_append_buffer(hctx->rb); 
     
    23842387                /* append to read-buffer */ 
    23852388                if (-1 == (r = read(hctx->fd, b->ptr, toread))) { 
    2386                         if (errno == EAGAIN) return 0; 
     2389                        if( errno == EAGAIN ) { 
     2390                                /* roll back the last chunk allocation, 
     2391                                   and continue on next iteration        */ 
     2392                                buffer_free(hctx->rb->last->mem); 
     2393                                free(hctx->rb->last); 
     2394                                hctx->rb->first = cq_first; 
     2395                                hctx->rb->last = cq_last; 
     2396                                return 0; 
     2397                        } 
    23872398                        log_error_write(srv, __FILE__, __LINE__, "sds", 
    23882399                                        "unexpected end-of-file (perhaps the fastcgi process died):", 
     
    23972408                b->ptr[b->used - 1] = '\0'; 
    23982409        } else { 
     2410                if( errno == EAGAIN ) return 0; 
    23992411                log_error_write(srv, __FILE__, __LINE__, "ssdsb", 
    24002412                                "unexpected end-of-file (perhaps the fastcgi process died):",