aboutsummaryrefslogtreecommitdiff
path: root/plugins/http.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/http.c')
-rw-r--r--plugins/http.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/plugins/http.c b/plugins/http.c
index 2b16462..b350fee 100644
--- a/plugins/http.c
+++ b/plugins/http.c
@@ -30,23 +30,38 @@ static struct plugin_data
}
g_data;
+struct scan_data
+{
+ struct str input; ///< Input buffer
+};
+
static void *
scan_init (struct unit *u)
{
- // TODO
- return NULL;
+ struct str hello;
+ str_init (&hello);
+ str_append_printf (&hello, "GET / HTTP/1.0\r\n"
+ "Host: %s\r\n\r\n", g_data.api->unit_get_address (u));
+ g_data.api->unit_write (u, hello.str, hello.len);
+ str_free (&hello);
+
+ struct scan_data *scan = xcalloc (1, sizeof *scan);
+ str_init (&scan->input);
+ return scan;
}
static void
scan_free (void *handle)
{
- // TODO
+ struct scan_data *scan = handle;
+ str_free (&scan->input);
+ free (scan);
}
static void
on_data (void *handle, struct unit *u, struct str *data)
{
- // TODO
+ // TODO: implement a state machine to parse the headers
}
static struct service g_http_service =