• Kristian Lyngstol's avatar
    Ensure obj->response is set sensibly for errors · 0e3fd5b2
    Kristian Lyngstol authored
    The http_PutProtocol() and http_PutResponse() would in the case of
    workspace overflow leave the headers as NULL and log a
    SLT_LostHeader. This would make Varnish assert correctly later when
    writing to the wire, as these are mandated by HTTP.
    
    This commit changes them to set the fields to static strings instead
    ("HTTP/1.1" and "Lost Response") when failing to write them to the
    workspace. This leaves enough information to complete the protocol in the
    case of overflow.
    
    The patch also increases the synthetic object's workspace from static
    1024 to param->http_resp_size. This leaves more (and configurable)
    room for manipulating the headers of the synthetic object in
    vcl_error.
    
    This whole thing has been a collaboration between Martin and myself. I'll
    leave it a mystery who wrote what line of code, which part of the comment
    and contributed what to the test-case.
    
    In all fairness, it's not a prefect solution, but a far step closer to one.
    So it sort of, kinda, more or less, for now, until we get a better
    solution:
    
    Fixes: #1031
    
    Conflicts:
    
    	bin/varnishd/cache_http.c
    0e3fd5b2
r01031.vtc 4.45 KB