2 # HTTP header TPG description
4 # (c) 2005 Luis E. Garcia Ontanon <luis@ontanon.org>
8 # Wireshark - Network traffic analyzer
9 # By Gerald Combs <gerald@wireshark.org>
10 # Copyright 2004 Gerald Combs
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License
14 # as published by the Free Software Foundation; either version 2
15 # of the License, or (at your option) any later version.
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 typedef struct _http_info_value_t
30 gchar *request_method;
37 gchar* transfer_encoding;
42 %export req_resp header crlf sp.
44 %tt_type %{ http_info_value_t %}
50 %choice versions = "1.0" | "1.1". <version>
52 %field version hyttp.version "HTTP Version" FT_STRING .
54 %sequence http_version = "HTTP/" & versions .
56 %field response hyttp.response "Response" FT_STRING .
57 %field response_code hyttp.response.code "Response Code" FT_UINT32 BASE_DEC %{ http_response_codes %} .
59 %sequence %tree response = http_version & [0-9]+<response_code:RESPONSE> & ... ( crlf ) . <response:%plain_text> %{
60 TT_DATA->is_response = TRUE;
61 TT_DATA->response_code = TPG_UINT(RESPONSE);
65 %field request hyttp.request "Request" FT_STRING .
66 %field method hyttp.request.method "Request Method" FT_STRING .
67 %field uri hyttp.request.uri "Request URI" FT_STRING .
68 %sequence %tree request = [A-Z]+<method:METHOD> & [^ ]+<uri:URI> & http_version & crlf . <request:%plain_text> %{
69 TT_DATA->is_response = FALSE;
70 TT_DATA->request_method = TPG_STRING(METHOD);
71 TT_DATA->request_uri = TPG_STRING(URI);
74 %choice req_resp = request | response.
76 %field media hyttp.content_type.media "Content-Type Media" FT_STRING .
78 %sequence media = [a-zA-Z0-9-]+ & "/" & [a-zA-Z0-9-]+ . <media:MEDIA> %{
79 TT_DATA->media = TPG_STRING(MEDIA);
83 %sequence quoted_string = ["] & [^"]* & ["] .
85 %choice value = [a-zA-Z0-9-]+ | quoted_string.
87 %field charset hyttp.content_type.charset "Content-Type Charset" FT_STRING .
89 %sequence parameter = [a-zA-Z0-9-]+ & [=] & value.
90 %sequence charset_parameter = 'charset' & '=' & [a-z0-9-]+<charset> .
92 %choice content_type_param = charset_parameter | parameter .
94 %sequence content_type_params = [;] & content_type_param .
96 %sequence content_type_value = media & content_type_params* .
98 %sequence content_type_hdr = 'Content-type:' & content_type_value & crlf .
100 %field content_length hyttp.headers.content_length "Content-Length" FT_UINT32 BASE_DEC .
101 %sequence content_length = 'Content-length:' & [0-9]+<content_length:LENGTH> & crlf. %{
102 TT_DATA->content_length = TPG_UINT(LENGTH);
105 %field transfer_encoding hyttp.transfer_encoding "Transfer-Encoding" FT_STRING .
106 %sequence transfer_encoding = 'Transfer-encoding:' & ...<transfer_encoding:ENCODING> ( crlf %leave ) & crlf. %{
107 TT_DATA->transfer_encoding = TPG_STRING(ENCODING);
110 %field authorization hyttp.authorization "Authorization" FT_STRING .
111 %sequence authorization = 'Authorization:' & ...<authorization> ( crlf %leave ) & crlf.
113 %field proxy_authorization hyttp.proxy_authorization "Proxy-Authorization" FT_STRING .
114 %sequence proxy_author = 'Proxy-authorization:' & ...<proxy_authorization> ( crlf %leave ) & crlf.
116 %field proxy_authen hyttp.proxy_authenti "Proxy-Authenticate" FT_STRING .
117 %sequence proxy_authen = 'Proxy-authenticate:' & ...<proxy_authen> ( crlf %leave ) & crlf.
119 %field www_auth hyttp.www_authenticate "WWW-Authenticate" FT_STRING .
120 %sequence www_auth = 'WWW-authenticate:' & ...<www_auth> ( crlf %leave ) & crlf.
122 %field content_encoding hyttp.content_encoding "Content-Encoding" FT_STRING .
123 %sequence content_encoding = 'Content-Encoding:' & ...<content_encoding> ( crlf %leave ) & crlf.
125 %field user_agent hyttp.content_encoding "User-Agent" FT_STRING .
126 %sequence user_agent = 'User-Agent:' & ...<user_agent> ( crlf %leave ) & crlf.
128 %field host hyttp.host "Host" FT_STRING .
129 %sequence host = 'Host:' & ...<host:HOST> ( crlf %leave ) & crlf. %{
130 TT_DATA->http_host = TPG_STRING(HOST);
133 %field accept hyttp.accept "Accept" FT_STRING .
134 %sequence accept = 'Accept:' & ...<accept> ( crlf %leave ) & crlf.
136 %field accept_language hyttp.accept_language "Accept-Language" FT_STRING .
137 %sequence accept_language = 'Accept-language:' & ...<accept_language> ( crlf %leave ) & crlf.
139 %field accept_encoding hyttp.accept_encoding "Accept-Language" FT_STRING .
140 %sequence accept_encoding = 'Accept-encoding:' & ...<accept_encoding> ( crlf %leave ) & crlf.
142 %field accept_ranges hyttp.accept_encoding "Accept-Ranges" FT_STRING .
143 %sequence accept_ranges = 'Accept-Ranges:' & ...<accept_ranges> ( crlf %leave ) & crlf.
145 %field keep_alive hyttp.keep_alive "Keep-Alive" FT_UINT32 BASE_DEC .
146 %sequence keep_alive = 'Keep-Alive:' & ...<keep_alive> ( crlf %leave ) & crlf.
148 %field connection hyttp.connection "Connection" FT_STRING .
149 %sequence connection = 'Connection:' & ...<connection> ( crlf %leave ) & crlf.
151 %field referer hyttp.referer "Referer" FT_STRING .
152 %sequence referer = 'Referer:' & ...<referer> ( crlf %leave ) & crlf.
154 %field cookie hyttp.cookie "Cookie" FT_STRING .
155 %sequence cookie = 'Cookie:' & ...<cookie> ( crlf %leave ) & crlf.
157 %field etag hyttp.etag "Etag" FT_STRING .
158 %sequence etag = 'Etag:' & ["] & [^"]+<etag> & ["] & crlf .
160 %field last_modified hyttp.last_modified "Last-Modified" FT_STRING .
161 %sequence last_modified = 'Last-Modified:' & ...<last_modified> ( crlf %leave ) & crlf.
163 %field server hyttp.server "Server" FT_STRING .
164 %sequence server = 'Server:' & ...<server> ( crlf %leave ) & crlf.
166 %sequence other_header = [A-Z] & [a-zA-Z-]+ & ":" & ... ( crlf %leave ) & crlf.
168 %field header hyttp.headers.line "HTTP Header Line" FT_BOOLEAN .
169 %choice %tree header =
191 | other_header . <header:%plain_text>