floom4 commented on PR #12748: URL: https://github.com/apache/trafficserver/pull/12748#issuecomment-3662825458
You're right I misunderstood the RFC, I went back to it and in my understanding, the only cases where a non-zero 'Content-Lenght' header without payload is allowed are: - HEAD response - 304 response to conditional GET From [Section 3.3.2 of [RFC7230]](https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2) ``` A server MAY send a Content-Length header field in a response to a HEAD request (Section 4.3.2 of [RFC7231]); ... A server MAY send a Content-Length header field in a 304 (Not Modified) response to a conditional GET request (Section 4.1 of [RFC7232]); ... ``` It indeed means that, while other types of request and response may have an empty payload (or data_length == 0), they must not have a `Content-Length` header with a value different from 0. Here is a proposal to check that the current frame is part of an HEAD response that we could use in rcv_headers_frame and rcv_continuation_frame: ``` stream->is_outbound_connection() && stream->get_sm()->t_state.hdr_info.server_request.method_get_wksidx() == HTTP_WKSIDX_HEAD ``` My understanding is that *is_outbound_connection* represents communication with origin which in case of receiving frame means response from origin I assumed that *server_request* field would be set since the previous condition ensure that we are at the response step and consequently, the request was created and sent. I think the same fields can be used to know if the frame is part of a response to a conditional GET request, however to find the http status code seems trickier since the response headers are not parsed yet as we just received the frame and are still validating it. Maybe we could only fix HEAD request for the moment, does the above conditional statement work for you ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
