diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2014-09-20 18:10:29 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2014-09-20 22:03:55 +0200 |
commit | 2b74a188332f152e8952725812e086968a41e925 (patch) | |
tree | e895a69b6e04d70bbb98f6b6ad6446837bdc1891 /plugins/http.c | |
parent | b9571ec01ff2a23475ca1a8a6b9910f49206b4ff (diff) | |
download | ponymap-2b74a188332f152e8952725812e086968a41e925.tar.gz ponymap-2b74a188332f152e8952725812e086968a41e925.tar.xz ponymap-2b74a188332f152e8952725812e086968a41e925.zip |
Implement more of the services
- SSH: ready for action
- IRC: ready for action
- HTTP: needs some work
Diffstat (limited to 'plugins/http.c')
-rw-r--r-- | plugins/http.c | 23 |
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 = |