http: ignore response body for HEAD requests
Responses to HEAD requests must not have a message body, so do not attempt to use the Content-Length and similar headers that indicate a non-empty message body in the response. Those point to the entity that would be returned for non-HEAD requests. Requests do not have request_method set, so do not limit desegmentation by HEAD in that case. Verified by comparing the output of `tshark -O http` and by looking in the Wireshark GTK UI. Bug: 6064 Change-Id: I7f027a06d8480673ca9754037d080c3b25cc5816 Reviewed-on: https://code.wireshark.org/review/4357 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
parent
f351a58167
commit
1318d4cfe7
|
@ -793,10 +793,15 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
|||
* Yes, it's a request or response.
|
||||
* Do header desegmentation if we've been told to,
|
||||
* and do body desegmentation if we've been told to and
|
||||
* we find a Content-Length header.
|
||||
* we find a Content-Length header. Responses to HEAD MUST NOT
|
||||
* contain a message body, so ignore the Content-Length header
|
||||
* which is done by disabling body desegmentation.
|
||||
*/
|
||||
gboolean try_desegment_body = http_desegment_body &&
|
||||
!(conv_data->request_method &&
|
||||
g_str_equal(conv_data->request_method, "HEAD"));
|
||||
if (!req_resp_hdrs_do_reassembly(tvb, offset, pinfo,
|
||||
http_desegment_headers, http_desegment_body)) {
|
||||
http_desegment_headers, try_desegment_body)) {
|
||||
/*
|
||||
* More data needed for desegmentation.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue