From: Martin Schanzenbach Date: Fri, 1 Jun 2012 16:59:54 +0000 (+0000) Subject: -parse host X-Git-Tag: initial-import-from-subversion-38251~13289 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=63a57830d1af592eefeb2c3ea639ccd13f928b4a;p=oweals%2Fgnunet.git -parse host --- diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index cbc12ed02..876f53194 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c @@ -79,6 +79,24 @@ GNUNET_SCHEDULER_TaskIdentifier ltask; static struct MHD_Daemon *httpd; static GNUNET_SCHEDULER_TaskIdentifier httpd_task; +static int +con_val_iter (void *cls, + enum MHD_ValueKind kind, + const char *key, + const char *value) +{ + char* buf = (char*)cls; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "%s:%s\n", key, value); + + if (0 == strcmp ("Host", key)) + { + strcpy (buf, value); + return MHD_NO; + } + return MHD_YES; +} + /** * Main MHD callback for handling requests. * @@ -115,6 +133,7 @@ create_response (void *cls, const char* page = "gnoxy"\ "gnoxy demo"; struct MHD_Response *response; + char host[265]; int ret; if (0 != strcmp (meth, "GET")) @@ -133,6 +152,10 @@ create_response (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "url %s\n", url); + MHD_get_connection_values (con, + MHD_HEADER_KIND, + &con_val_iter, host); + response = MHD_create_response_from_buffer (strlen (page), (void*)page, MHD_RESPMEM_PERSISTENT);