diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-09-29 01:39:32 +0200 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2014-10-01 19:14:53 +0000 |
commit | 1318d4cfe77fe58e766634eff8407091fe63fdb2 (patch) | |
tree | 6ef8eb15e0f1454f1fefa95b8068116f0e95c75d | |
parent | f351a581670126f94ed84e1dccfa63311b6e7afe (diff) |
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>
-rw-r--r-- | epan/dissectors/packet-http.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c index d55d69074f..ebfba9e19e 100644 --- a/epan/dissectors/packet-http.c +++ b/epan/dissectors/packet-http.c @@ -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. */ |