5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include <wsutil/filesystem.h>
31 #include <epan/dfilter/dfilter.h>
33 #include "ui/follow.h"
37 sgetline(char *str, int *next)
41 end = strstr(str, "\r\n");
43 *next = (int)strlen(str);
47 *next = (int)(end-str+2);
52 parse_http_header(char *data, size_t len, size_t *content_start)
54 char *tmp, *copy, *line;
59 /* XXX handle case where only partial header is passed in here.
60 * we should pass something back to indicate whether header is complete.
61 * (if not, is_gzipped is may still be unknown)
65 * In order to parse header, we duplicate data and tokenize lines.
66 * We aren't interested in actual data, so use g_strndup instead of memcpy
67 * to (possibly) copy fewer bytes (e.g., if a nul byte exists in data)
68 * This also ensures that we have a terminated string for further
71 tmp = copy = g_strndup(data, len);
77 /* skip HTTP... line*/
78 /*line = */sgetline(tmp, &next_line);
86 while ((line = sgetline(tmp, &next_line))) {
92 if (strlen(line) == 0) {
97 c = strchr(line, ':');
104 if (!strcmp(key, "Content-Encoding") && strstr(val, "gzip")) {
108 *content_start = pos;
121 * indent-tabs-mode: nil
124 * ex: set shiftwidth=4 tabstop=8 expandtab:
125 * :indentSize=4:tabSize=8:noTabs=true: