aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2014-09-21 01:12:15 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2014-09-21 01:12:15 +0200
commitd453a1226ccef854fcec14beaba82347ad36e615 (patch)
tree8f3c4821b44786420dbf82f922cb3027b06d132b /plugins
parent82a125a3c3bd0da0bf6545b7fe28c64f7a85f4ed (diff)
downloadponymap-d453a1226ccef854fcec14beaba82347ad36e615.tar.gz
ponymap-d453a1226ccef854fcec14beaba82347ad36e615.tar.xz
ponymap-d453a1226ccef854fcec14beaba82347ad36e615.zip
HTTP: initialize `http_settings' statically
Diffstat (limited to 'plugins')
-rw-r--r--plugins/http.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins/http.c b/plugins/http.c
index ff48b5f..0bf7378 100644
--- a/plugins/http.c
+++ b/plugins/http.c
@@ -42,8 +42,6 @@ struct scan_data
struct unit *u; ///< Scan unit
http_parser parser; ///< HTTP parser
- http_parser_settings settings; ///< HTTP parser settings
-
enum header_state state; ///< What did we get last time?
struct str field; ///< Field part buffer
struct str value; ///< Value part buffer
@@ -109,11 +107,6 @@ scan_init (struct unit *u)
http_parser_init (&scan->parser, HTTP_RESPONSE);
scan->parser.data = scan;
- http_parser_settings *s = &scan->settings;
- s->on_header_field = on_header_field;
- s->on_header_value = on_header_value;
- s->on_headers_complete = on_headers_complete;
-
scan->state = STATE_FIELD;
str_init (&scan->field);
str_init (&scan->value);
@@ -134,12 +127,19 @@ scan_free (void *handle)
static void
on_data (void *handle, struct unit *u, struct str *data)
{
+ static const http_parser_settings http_settings =
+ {
+ .on_header_field = on_header_field,
+ .on_header_value = on_header_value,
+ .on_headers_complete = on_headers_complete,
+ };
+
struct scan_data *scan = handle;
http_parser *parser = &scan->parser;
size_t len = data ? data->len : 0;
const char *str = data ? data->str : NULL;
- size_t n_parsed = http_parser_execute (parser, &scan->settings, str, len);
+ size_t n_parsed = http_parser_execute (parser, &http_settings, str, len);
if (parser->upgrade)
{