diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-06-01 16:59:54 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-06-01 16:59:54 +0000 |
commit | 63a57830d1af592eefeb2c3ea639ccd13f928b4a (patch) | |
tree | c351db53169402d2b520be8e55ac45fbd8e23396 /src | |
parent | b3e7076d775a894edc8659d165407f41e8dea45a (diff) | |
download | gnunet-63a57830d1af592eefeb2c3ea639ccd13f928b4a.tar.gz gnunet-63a57830d1af592eefeb2c3ea639ccd13f928b4a.zip |
-parse host
Diffstat (limited to 'src')
-rw-r--r-- | src/gns/gnunet-gns-proxy.c | 23 |
1 files changed, 23 insertions, 0 deletions
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; | |||
79 | static struct MHD_Daemon *httpd; | 79 | static struct MHD_Daemon *httpd; |
80 | static GNUNET_SCHEDULER_TaskIdentifier httpd_task; | 80 | static GNUNET_SCHEDULER_TaskIdentifier httpd_task; |
81 | 81 | ||
82 | static int | ||
83 | con_val_iter (void *cls, | ||
84 | enum MHD_ValueKind kind, | ||
85 | const char *key, | ||
86 | const char *value) | ||
87 | { | ||
88 | char* buf = (char*)cls; | ||
89 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
90 | "%s:%s\n", key, value); | ||
91 | |||
92 | if (0 == strcmp ("Host", key)) | ||
93 | { | ||
94 | strcpy (buf, value); | ||
95 | return MHD_NO; | ||
96 | } | ||
97 | return MHD_YES; | ||
98 | } | ||
99 | |||
82 | /** | 100 | /** |
83 | * Main MHD callback for handling requests. | 101 | * Main MHD callback for handling requests. |
84 | * | 102 | * |
@@ -115,6 +133,7 @@ create_response (void *cls, | |||
115 | const char* page = "<html><head><title>gnoxy</title>"\ | 133 | const char* page = "<html><head><title>gnoxy</title>"\ |
116 | "</head><body>gnoxy demo</body></html>"; | 134 | "</head><body>gnoxy demo</body></html>"; |
117 | struct MHD_Response *response; | 135 | struct MHD_Response *response; |
136 | char host[265]; | ||
118 | int ret; | 137 | int ret; |
119 | 138 | ||
120 | if (0 != strcmp (meth, "GET")) | 139 | if (0 != strcmp (meth, "GET")) |
@@ -133,6 +152,10 @@ create_response (void *cls, | |||
133 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 152 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
134 | "url %s\n", url); | 153 | "url %s\n", url); |
135 | 154 | ||
155 | MHD_get_connection_values (con, | ||
156 | MHD_HEADER_KIND, | ||
157 | &con_val_iter, host); | ||
158 | |||
136 | response = MHD_create_response_from_buffer (strlen (page), | 159 | response = MHD_create_response_from_buffer (strlen (page), |
137 | (void*)page, | 160 | (void*)page, |
138 | MHD_RESPMEM_PERSISTENT); | 161 | MHD_RESPMEM_PERSISTENT); |