Ethereal-dev: [Ethereal-dev] HTTP patch

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Brett Kuskie" <mstrprgmmr@xxxxxxxx>
Date: 6 Dec 2004 20:45:17 -0000
This patch adds filter support for the following HTTP headers:
user_agent
host
connection
cookie
accept
referer
accept_language
accept_encoding
date
cache_control
server
location
set_cookie
last_modified



--- ethereal-0.10.7/epan/dissectors/packet-http.c	2004-10-20 16:34:55.000000000 -0600
+++ ethereal-0.10.7_submit/epan/dissectors/packet-http.c	2004-12-06 13:13:08.000000000 -0700
@@ -72,6 +72,20 @@
 static int hf_http_content_length = -1;
 static int hf_http_content_encoding = -1;
 static int hf_http_transfer_encoding = -1;
+static int hf_http_user_agent = -1;
+static int hf_http_host = -1;
+static int hf_http_connection = -1;
+static int hf_http_cookie = -1;
+static int hf_http_accept = -1;
+static int hf_http_referer = -1;
+static int hf_http_accept_language = -1;
+static int hf_http_accept_encoding = -1;
+static int hf_http_date = -1;
+static int hf_http_cache_control = -1;
+static int hf_http_server = -1;
+static int hf_http_location = -1;
+static int hf_http_set_cookie = -1;
+static int hf_http_last_modified = -1;
 
 static gint ett_http = -1;
 static gint ett_http_ntlmssp = -1;
@@ -1270,6 +1284,20 @@
 #define HDR_CONTENT_LENGTH	4
 #define HDR_CONTENT_ENCODING	5
 #define HDR_TRANSFER_ENCODING	6
+#define HDR_USER_AGENT			7
+#define HDR_HOST				8
+#define HDR_CONNECTION			9
+#define HDR_COOKIE				10
+#define HDR_ACCEPT				11
+#define HDR_REFERER				12
+#define HDR_ACCEPT_LANGUAGE		13
+#define HDR_ACCEPT_ENCODING		14
+#define HDR_DATE				15
+#define HDR_CACHE_CONTROL		16
+#define HDR_SERVER				17
+#define HDR_LOCATION			18
+#define HDR_SET_COOKIE			19
+#define HDR_LAST_MODIFIED		20
 
 static const header_info headers[] = {
 	{ "Authorization", &hf_http_authorization, HDR_AUTHORIZATION },
@@ -1280,6 +1308,20 @@
 	{ "Content-Length", &hf_http_content_length, HDR_CONTENT_LENGTH },
 	{ "Content-Encoding", &hf_http_content_encoding, HDR_CONTENT_ENCODING },
 	{ "Transfer-Encoding", &hf_http_transfer_encoding, HDR_TRANSFER_ENCODING },
+	{ "User-Agent",	&hf_http_user_agent, HDR_USER_AGENT },
+	{ "Host", &hf_http_host, HDR_HOST },
+	{ "Connection", &hf_http_connection, HDR_CONNECTION },
+	{ "Cookie", &hf_http_cookie, HDR_COOKIE },
+	{ "Accept", &hf_http_accept, HDR_ACCEPT },
+	{ "Referer", &hf_http_referer, HDR_REFERER },
+	{ "Accept-Language", &hf_http_accept_language, HDR_ACCEPT_LANGUAGE },
+	{ "Accept-Encoding", &hf_http_accept_encoding, HDR_ACCEPT_ENCODING },
+	{ "Date", &hf_http_date, HDR_DATE },
+	{ "Cache-Control", &hf_http_cache_control, HDR_CACHE_CONTROL },
+	{ "Server", &hf_http_server, HDR_SERVER },
+	{ "Location", &hf_http_location, HDR_LOCATION },
+	{ "Set-Cookie", &hf_http_set_cookie, HDR_SET_COOKIE },
+	{ "Last-Modified", &hf_http_last_modified, HDR_LAST_MODIFIED },
 };
 
 static void
@@ -1609,6 +1651,62 @@
 	      { "Transfer-Encoding",	"http.transfer_encoding",
 		FT_STRING, BASE_NONE, NULL, 0x0,
 		"HTTP Transfer-Encoding header", HFILL }},
+	    { &hf_http_user_agent,
+	      { "User-Agent",	"http.user_agent",
+	    FT_STRING, BASE_NONE, NULL, 0x0,
+	    "HTTP User-Agent header", HFILL }},
+	    { &hf_http_host,
+	      { "Host",	"http.host",
+	    FT_STRING, BASE_NONE, NULL, 0x0,
+	    "HTTP Host", HFILL }},
+	    { &hf_http_connection,
+	      { "Connection",	"http.connection",
+	    FT_STRING, BASE_NONE, NULL, 0x0,
+	    "HTTP Connection", HFILL }},
+	    { &hf_http_cookie,
+	      { "Cookie",	"http.cookie",
+	    FT_STRING, BASE_NONE, NULL, 0x0,
+	    "HTTP Cookie", HFILL }},
+	    { &hf_http_accept,
+	      { "Accept",	"http.accept",
+	    FT_STRING, BASE_NONE, NULL, 0x0,
+	    "HTTP Accept", HFILL }},
+	    { &hf_http_referer,
+	      { "Referer",	"http.referer",
+	    FT_STRING, BASE_NONE, NULL, 0x0,
+	    "HTTP Referer", HFILL }},
+	    { &hf_http_accept_language,
+	      { "Accept Language",	"http.accept_language",
+	    FT_STRING, BASE_NONE, NULL, 0x0,
+	    "HTTP Accept Language", HFILL }},
+	    { &hf_http_accept_encoding,
+	      { "Accept Encoding",	"http.accept_encoding",
+	    FT_STRING, BASE_NONE, NULL, 0x0,
+	    "HTTP Accept Encoding", HFILL }},
+	    { &hf_http_date,
+	      { "Date",	"http.date",
+	    FT_STRING, BASE_NONE, NULL, 0x0,
+	    "HTTP Date", HFILL }},
+	    { &hf_http_cache_control,
+	      { "Cache-Control",	"http.cache_control",
+	    FT_STRING, BASE_NONE, NULL, 0x0,
+	    "HTTP Cache Control", HFILL }},
+	    { &hf_http_server,
+	      { "Server",	"http.server",
+	    FT_STRING, BASE_NONE, NULL, 0x0,
+	    "HTTP Server", HFILL }},
+	    { &hf_http_location,
+	      { "Location",	"http.location",
+	    FT_STRING, BASE_NONE, NULL, 0x0,
+	    "HTTP Location", HFILL }},
+	    { &hf_http_set_cookie,
+	      { "Set-Cookie",	"http.set_cookie",
+	    FT_STRING, BASE_NONE, NULL, 0x0,
+	    "HTTP Set Cookie", HFILL }},
+	    { &hf_http_last_modified,
+	      { "Last-Modified",	"http.last_modified",
+	    FT_STRING, BASE_NONE, NULL, 0x0,
+	    "HTTP Last Modified", HFILL }},
 	};
 	static gint *ett[] = {
 		&ett_http,