aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-06-27 15:02:11 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-06-27 15:02:11 +0000
commite7e99d8571ea6f90626a41fdea321e19d6426578 (patch)
treede68652672d48408991509be4cb15613e8b0e1b9 /src
parent67ba272f86ae7aed754aeb94ba2aa19477a4e9e4 (diff)
downloadgnunet-e7e99d8571ea6f90626a41fdea321e19d6426578.tar.gz
gnunet-e7e99d8571ea6f90626a41fdea321e19d6426578.zip
Implementing bug 0002910
- extended plugin to contain option field in addresses Implementing bug 0002677 - adding ssl verification for external hostname having - the server send the HTTP_OPTIONS_VERIFY_CERTIFICATE option - client use this option to enable ssl verification
Diffstat (limited to 'src')
-rw-r--r--src/transport/plugin_transport_http_client.c66
-rw-r--r--src/transport/plugin_transport_http_common.c199
-rw-r--r--src/transport/plugin_transport_http_common.h40
-rw-r--r--src/transport/plugin_transport_http_server.c88
4 files changed, 298 insertions, 95 deletions
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index 00b704a27..e2aaaa9e1 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -152,7 +152,7 @@ struct Session
152 /** 152 /**
153 * Address 153 * Address
154 */ 154 */
155 void *addr; 155 struct HttpAddress *addr;
156 156
157 /** 157 /**
158 * Address length 158 * Address length
@@ -277,6 +277,11 @@ struct HTTP_Client_Plugin
277 char *protocol; 277 char *protocol;
278 278
279 /** 279 /**
280 * My options to be included in the address
281 */
282 uint32_t options;
283
284 /**
280 * Maximum number of sockets the plugin can use 285 * Maximum number of sockets the plugin can use
281 * Each http inbound /outbound connections are two connections 286 * Each http inbound /outbound connections are two connections
282 */ 287 */
@@ -917,7 +922,7 @@ client_receive_mst_cb (void *cls, void *client,
917 GNUNET_break (s->ats_address_network_type != ntohl (GNUNET_ATS_NET_UNSPECIFIED)); 922 GNUNET_break (s->ats_address_network_type != ntohl (GNUNET_ATS_NET_UNSPECIFIED));
918 923
919 delay = s->plugin->env->receive (plugin->env->cls, &s->target, message, 924 delay = s->plugin->env->receive (plugin->env->cls, &s->target, message,
920 s, s->addr, s->addrlen); 925 s, (const char *) s->addr, s->addrlen);
921 926
922 plugin->env->update_address_metrics (plugin->env->cls, 927 plugin->env->update_address_metrics (plugin->env->cls,
923 &s->target, 928 &s->target,
@@ -939,7 +944,8 @@ client_receive_mst_cb (void *cls, void *client,
939 944
940 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 945 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
941 "Client: peer `%s' address `%s' next read delayed for %llu ms\n", 946 "Client: peer `%s' address `%s' next read delayed for %llu ms\n",
942 GNUNET_i2s (&s->target), GNUNET_a2s (s->addr, s->addrlen), 947 GNUNET_i2s (&s->target),
948 http_common_plugin_address_to_string (NULL, s->plugin->protocol, s->addr, s->addrlen),
943 delay); 949 delay);
944 } 950 }
945 client_reschedule_session_timeout (s); 951 client_reschedule_session_timeout (s);
@@ -1227,6 +1233,7 @@ client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1227static int 1233static int
1228client_connect_get (struct Session *s) 1234client_connect_get (struct Session *s)
1229{ 1235{
1236
1230 CURLMcode mret; 1237 CURLMcode mret;
1231 /* create get connection */ 1238 /* create get connection */
1232 s->client_get = curl_easy_init (); 1239 s->client_get = curl_easy_init ();
@@ -1239,8 +1246,17 @@ client_connect_get (struct Session *s)
1239#endif 1246#endif
1240#if BUILD_HTTPS 1247#if BUILD_HTTPS
1241 curl_easy_setopt (s->client_get, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); 1248 curl_easy_setopt (s->client_get, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
1242 curl_easy_setopt (s->client_get, CURLOPT_SSL_VERIFYPEER, 0); 1249 if (HTTP_OPTIONS_VERIFY_CERTIFICATE ==
1243 curl_easy_setopt (s->client_get, CURLOPT_SSL_VERIFYHOST, 0); 1250 (ntohl (s->addr->options) & HTTP_OPTIONS_VERIFY_CERTIFICATE))
1251 {
1252 curl_easy_setopt (s->client_get, CURLOPT_SSL_VERIFYPEER, 1);
1253 curl_easy_setopt (s->client_get, CURLOPT_SSL_VERIFYHOST, 1);
1254 }
1255 else
1256 {
1257 curl_easy_setopt (s->client_get, CURLOPT_SSL_VERIFYPEER, 0);
1258 curl_easy_setopt (s->client_get, CURLOPT_SSL_VERIFYHOST, 0);
1259 }
1244 curl_easy_setopt (s->client_get, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS); 1260 curl_easy_setopt (s->client_get, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
1245 curl_easy_setopt (s->client_get, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS); 1261 curl_easy_setopt (s->client_get, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS);
1246#else 1262#else
@@ -1249,8 +1265,6 @@ client_connect_get (struct Session *s)
1249#endif 1265#endif
1250 1266
1251 curl_easy_setopt (s->client_get, CURLOPT_URL, s->url); 1267 curl_easy_setopt (s->client_get, CURLOPT_URL, s->url);
1252 curl_easy_setopt (s->client_get, CURLOPT_URL, s->url);
1253 curl_easy_setopt (s->client_get, CURLOPT_URL, s->url);
1254 //curl_easy_setopt (s->client_get, CURLOPT_HEADERFUNCTION, &curl_get_header_cb); 1268 //curl_easy_setopt (s->client_get, CURLOPT_HEADERFUNCTION, &curl_get_header_cb);
1255 //curl_easy_setopt (s->client_get, CURLOPT_WRITEHEADER, ps); 1269 //curl_easy_setopt (s->client_get, CURLOPT_WRITEHEADER, ps);
1256 curl_easy_setopt (s->client_get, CURLOPT_READFUNCTION, client_send_cb); 1270 curl_easy_setopt (s->client_get, CURLOPT_READFUNCTION, client_send_cb);
@@ -1309,8 +1323,17 @@ client_connect_put (struct Session *s)
1309#endif 1323#endif
1310#if BUILD_HTTPS 1324#if BUILD_HTTPS
1311 curl_easy_setopt (s->client_put, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); 1325 curl_easy_setopt (s->client_put, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
1312 curl_easy_setopt (s->client_put, CURLOPT_SSL_VERIFYPEER, 0); 1326 if (HTTP_OPTIONS_VERIFY_CERTIFICATE ==
1313 curl_easy_setopt (s->client_put, CURLOPT_SSL_VERIFYHOST, 0); 1327 (ntohl (s->addr->options) & HTTP_OPTIONS_VERIFY_CERTIFICATE))
1328 {
1329 curl_easy_setopt (s->client_put, CURLOPT_SSL_VERIFYPEER, 1);
1330 curl_easy_setopt (s->client_put, CURLOPT_SSL_VERIFYHOST, 1);
1331 }
1332 else
1333 {
1334 curl_easy_setopt (s->client_put, CURLOPT_SSL_VERIFYPEER, 0);
1335 curl_easy_setopt (s->client_put, CURLOPT_SSL_VERIFYHOST, 0);
1336 }
1314 curl_easy_setopt (s->client_get, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS); 1337 curl_easy_setopt (s->client_get, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
1315 curl_easy_setopt (s->client_get, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS); 1338 curl_easy_setopt (s->client_get, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS);
1316#else 1339#else
@@ -1366,9 +1389,8 @@ client_connect (struct Session *s)
1366 struct HTTP_Client_Plugin *plugin = s->plugin; 1389 struct HTTP_Client_Plugin *plugin = s->plugin;
1367 int res = GNUNET_OK; 1390 int res = GNUNET_OK;
1368 1391
1369
1370 /* create url */ 1392 /* create url */
1371 if (NULL == http_common_plugin_address_to_string (NULL, s->addr, s->addrlen)) 1393 if (NULL == http_common_plugin_address_to_string (NULL, plugin->protocol, s->addr, s->addrlen))
1372 { 1394 {
1373 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1395 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1374 "Invalid address peer `%s'\n", 1396 "Invalid address peer `%s'\n",
@@ -1377,9 +1399,9 @@ client_connect (struct Session *s)
1377 } 1399 }
1378 1400
1379 GNUNET_asprintf (&s->url, "%s/%s;%u", 1401 GNUNET_asprintf (&s->url, "%s/%s;%u",
1380 http_common_plugin_address_to_string (plugin, s->addr, s->addrlen), 1402 http_common_plugin_address_to_url (NULL, s->addr, s->addrlen),
1381 GNUNET_h2s_full (&plugin->env->my_identity->hashPubKey), 1403 GNUNET_h2s_full (&plugin->env->my_identity->hashPubKey),
1382 plugin->last_tag); 1404 plugin->last_tag);
1383 1405
1384 plugin->last_tag++; 1406 plugin->last_tag++;
1385 1407
@@ -1454,10 +1476,10 @@ http_client_plugin_get_session (void *cls,
1454 return NULL; 1476 return NULL;
1455 } 1477 }
1456 1478
1479 /* Determine network location */
1457 ats.type = htonl (GNUNET_ATS_NETWORK_TYPE); 1480 ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
1458 ats.value = htonl (GNUNET_ATS_NET_UNSPECIFIED); 1481 ats.value = htonl (GNUNET_ATS_NET_UNSPECIFIED);
1459 sa = http_common_socket_from_address (address->address, address->address_length, &res); 1482 sa = http_common_socket_from_address (address->address, address->address_length, &res);
1460
1461 if (GNUNET_SYSERR == res) 1483 if (GNUNET_SYSERR == res)
1462 { 1484 {
1463 return NULL; 1485 return NULL;
@@ -1508,7 +1530,7 @@ http_client_plugin_get_session (void *cls,
1508 { 1530 {
1509 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, 1531 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
1510 "Cannot connect to peer `%s' address `%s''\n", 1532 "Cannot connect to peer `%s' address `%s''\n",
1511 http_common_plugin_address_to_string (NULL, s->addr, s->addrlen), 1533 http_common_plugin_address_to_string (NULL, plugin->name, s->addr, s->addrlen),
1512 GNUNET_i2s (&s->target)); 1534 GNUNET_i2s (&s->target));
1513 client_delete_session (s); 1535 client_delete_session (s);
1514 return NULL; 1536 return NULL;
@@ -1721,6 +1743,13 @@ client_configure_plugin (struct HTTP_Client_Plugin *plugin)
1721 return GNUNET_OK; 1743 return GNUNET_OK;
1722} 1744}
1723 1745
1746const char *http_plugin_address_to_string (void *cls,
1747 const void *addr,
1748 size_t addrlen)
1749{
1750 return http_common_plugin_address_to_string (cls, p->name, addr, addrlen);
1751}
1752
1724/** 1753/**
1725 * Entry point for the plugin. 1754 * Entry point for the plugin.
1726 */ 1755 */
@@ -1737,7 +1766,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
1737 initialze the plugin or the API */ 1766 initialze the plugin or the API */
1738 api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions)); 1767 api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
1739 api->cls = NULL; 1768 api->cls = NULL;
1740 api->address_to_string = &http_common_plugin_address_to_string; 1769 api->address_to_string = &http_plugin_address_to_string;
1741 api->string_to_address = &http_common_plugin_string_to_address; 1770 api->string_to_address = &http_common_plugin_string_to_address;
1742 api->address_pretty_printer = &http_common_plugin_address_pretty_printer; 1771 api->address_pretty_printer = &http_common_plugin_address_pretty_printer;
1743 return api; 1772 return api;
@@ -1752,7 +1781,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
1752 api->disconnect = &http_client_plugin_disconnect; 1781 api->disconnect = &http_client_plugin_disconnect;
1753 api->check_address = &http_client_plugin_address_suggested; 1782 api->check_address = &http_client_plugin_address_suggested;
1754 api->get_session = &http_client_plugin_get_session; 1783 api->get_session = &http_client_plugin_get_session;
1755 api->address_to_string = &http_common_plugin_address_to_string; 1784 api->address_to_string = &http_plugin_address_to_string;
1756 api->string_to_address = &http_common_plugin_string_to_address; 1785 api->string_to_address = &http_common_plugin_string_to_address;
1757 api->address_pretty_printer = &http_common_plugin_address_pretty_printer; 1786 api->address_pretty_printer = &http_common_plugin_address_pretty_printer;
1758 1787
@@ -1765,6 +1794,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
1765 plugin->protocol = "http"; 1794 plugin->protocol = "http";
1766#endif 1795#endif
1767 plugin->last_tag = 1; 1796 plugin->last_tag = 1;
1797 plugin->options = 0; /* Setup options */
1768 1798
1769 if (GNUNET_SYSERR == client_configure_plugin (plugin)) 1799 if (GNUNET_SYSERR == client_configure_plugin (plugin))
1770 { 1800 {
diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c
index bf983302e..5830ab63c 100644
--- a/src/transport/plugin_transport_http_common.c
+++ b/src/transport/plugin_transport_http_common.c
@@ -202,19 +202,49 @@ http_common_plugin_address_pretty_printer (void *cls, const char *type,
202 GNUNET_TRANSPORT_AddressStringCallback 202 GNUNET_TRANSPORT_AddressStringCallback
203 asc, void *asc_cls) 203 asc, void *asc_cls)
204{ 204{
205 const char *saddr = (const char *) addr; 205 const struct HttpAddress *address = addr;
206 206
207 if ( (NULL == saddr) || 207 if (NULL == http_common_plugin_address_to_string (NULL, (char *) type, address, addrlen))
208 (0 >= addrlen) ||
209 ('\0' != saddr[addrlen-1]) )
210 { 208 {
211 asc (asc_cls, NULL); 209 asc (asc_cls, NULL);
212 return; 210 return;
213 } 211 }
214 asc (asc_cls, saddr); 212 asc (asc_cls, http_common_plugin_address_to_string (NULL, (char *) type, address, addrlen));
215 asc (asc_cls, NULL); 213 asc (asc_cls, NULL);
216} 214}
217 215
216const char *
217http_common_plugin_address_to_url (void *cls, const void *addr, size_t addrlen)
218{
219 static char rbuf[1024];
220 const struct HttpAddress *address = addr;
221 const char * addr_str;
222
223
224
225 if (NULL == addr)
226 {
227 GNUNET_break (0);
228 return NULL;
229 }
230 if (0 >= addrlen)
231 {
232 GNUNET_break (0);
233 return NULL;
234 }
235 if (addrlen != http_common_address_get_size (address))
236 {
237 GNUNET_break (0);
238 return NULL;
239 }
240 addr_str = (char *) &address[1];
241
242 if (addr_str[ntohl(address->urlen) -1] != '\0')
243 return NULL;
244
245 memcpy (rbuf, &address[1], ntohl(address->urlen));
246 return rbuf;
247}
218 248
219/** 249/**
220 * Function called for a quick conversion of the binary address to 250 * Function called for a quick conversion of the binary address to
@@ -228,16 +258,35 @@ http_common_plugin_address_pretty_printer (void *cls, const char *type,
228 * @return string representing the same address 258 * @return string representing the same address
229 */ 259 */
230const char * 260const char *
231http_common_plugin_address_to_string (void *cls, const void *addr, size_t addrlen) 261http_common_plugin_address_to_string (void *cls, char *plugin, const void *addr, size_t addrlen)
232{ 262{
233 const char *saddr = (const char *) addr; 263 static char rbuf[1024];
234 if (NULL == saddr) 264 const struct HttpAddress *address = addr;
265 const char * addr_str;
266 char *res;
267
268
269 if (NULL == addr)
235 return NULL; 270 return NULL;
236 if (0 >= addrlen) 271 if (0 >= addrlen)
237 return NULL; 272 return NULL;
238 if (saddr[addrlen-1] != '\0') 273 if (addrlen != http_common_address_get_size (address))
274 return NULL;
275 addr_str = (char *) &address[1];
276
277 if (addr_str[ntohl(address->urlen) -1] != '\0')
239 return NULL; 278 return NULL;
240 return saddr; 279
280 GNUNET_asprintf (&res, "%s.%u.%s", plugin, address->options, &address[1]);
281 if (strlen(res) + 1 < 500)
282 {
283 memcpy (rbuf, res, strlen(res) + 1);
284 GNUNET_free (res);
285 return rbuf;
286 }
287 GNUNET_break (0);
288 GNUNET_free (res);
289 return NULL;
241} 290}
242 291
243/** 292/**
@@ -259,15 +308,63 @@ http_common_plugin_string_to_address (void *cls,
259 void **buf, 308 void **buf,
260 size_t *added) 309 size_t *added)
261{ 310{
262 if (NULL == addr) 311 struct HttpAddress *a;
263 return GNUNET_SYSERR; 312 char *address;
264 if (0 >= addrlen) 313 char *plugin;
314 char *optionstr;
315 size_t urlen;
316 uint32_t options;
317
318 /* Format protocol.options.address:port */
319 address = NULL;
320 plugin = NULL;
321 optionstr = NULL;
322 options = 0;
323 if ((NULL == addr) || (addrlen == 0))
324 {
325 GNUNET_break (0);
265 return GNUNET_SYSERR; 326 return GNUNET_SYSERR;
266 if (addr[addrlen-1] != '\0') 327 }
328 if ('\0' != addr[addrlen - 1])
329 {
330 GNUNET_break (0);
267 return GNUNET_SYSERR; 331 return GNUNET_SYSERR;
268 332 }
269 (*buf) = strdup (addr); 333 if (strlen (addr) != addrlen - 1)
270 (*added) = strlen (addr) + 1; 334 {
335 GNUNET_break (0);
336 return GNUNET_SYSERR;
337 }
338 plugin = GNUNET_strdup (addr);
339 optionstr = strchr (plugin, '.');
340 if (NULL == optionstr)
341 {
342 GNUNET_break (0);
343 GNUNET_free (plugin);
344 return GNUNET_SYSERR;
345 }
346 optionstr[0] = '\0';
347 optionstr ++;
348 options = atol (optionstr);
349 address = strchr (optionstr, '.');
350 if (NULL == address)
351 {
352 GNUNET_break (0);
353 GNUNET_free (plugin);
354 return GNUNET_SYSERR;
355 }
356 address[0] = '\0';
357 address ++;
358 urlen = strlen (address) + 1;
359
360 a = GNUNET_malloc (sizeof (struct HttpAddress) + urlen);
361 a->options = htonl(options);
362 a->urlen = htonl(urlen);
363 memcpy (&a[1], address, urlen);
364
365 (*buf) = a;
366 (*added) = sizeof (struct HttpAddress) + urlen;
367 GNUNET_free (plugin);
271 return GNUNET_OK; 368 return GNUNET_OK;
272} 369}
273 370
@@ -277,14 +374,25 @@ http_common_plugin_string_to_address (void *cls,
277 * @param protocol protocol 374 * @param protocol protocol
278 * @param addr sockaddr * address 375 * @param addr sockaddr * address
279 * @param addrlen length of the address 376 * @param addrlen length of the address
280 * @return the string 377 * @return the HttpAddress
281 */ 378 */
282char * 379struct HttpAddress *
283http_common_address_from_socket (const char *protocol, const struct sockaddr *addr, socklen_t addrlen) 380http_common_address_from_socket (const char *protocol, const struct sockaddr *addr, socklen_t addrlen)
284{ 381{
382 struct HttpAddress *address = NULL;
285 char *res; 383 char *res;
384 size_t len;
385
286 GNUNET_asprintf(&res, "%s://%s", protocol, GNUNET_a2s (addr, addrlen)); 386 GNUNET_asprintf(&res, "%s://%s", protocol, GNUNET_a2s (addr, addrlen));
287 return res; 387 len = strlen (res)+1;
388
389 address = GNUNET_malloc (sizeof (struct HttpAddress) + len);
390 address->options = htonl (HTTP_OPTIONS_NONE);
391 address->urlen = htonl (len);
392 memcpy (&address[1], res, len);
393 GNUNET_free (res);
394
395 return address;
288} 396}
289 397
290/** 398/**
@@ -301,28 +409,39 @@ http_common_address_from_socket (const char *protocol, const struct sockaddr *ad
301struct sockaddr * 409struct sockaddr *
302http_common_socket_from_address (const void *addr, size_t addrlen, int *res) 410http_common_socket_from_address (const void *addr, size_t addrlen, int *res)
303{ 411{
412 const struct HttpAddress *ha;
304 struct SplittedHTTPAddress * spa; 413 struct SplittedHTTPAddress * spa;
305 struct sockaddr_storage *s; 414 struct sockaddr_storage *s;
306 (*res) = GNUNET_SYSERR; 415 (*res) = GNUNET_SYSERR;
307 char * to_conv; 416 char * to_conv;
308 417
418 ha = (const struct HttpAddress *) addr;
309 if (NULL == addr) 419 if (NULL == addr)
310 { 420 {
311 GNUNET_break (0); 421 GNUNET_break (0);
312 return NULL; 422 return NULL;
313 } 423 }
314 if (0 >= addrlen) 424 if (0 >= addrlen)
315 { 425 {
316 GNUNET_break (0); 426 GNUNET_break (0);
317 return NULL; 427 return NULL;
318 } 428 }
429 if (addrlen < sizeof (struct HttpAddress))
430 {
431 GNUNET_break (0);
432 return NULL;
433 }
434 if (addrlen < sizeof (struct HttpAddress) + ntohl (ha->urlen))
435 {
436 /* This is a legacy addresses */
437 return NULL;
438 }
319 if (((char *) addr)[addrlen-1] != '\0') 439 if (((char *) addr)[addrlen-1] != '\0')
320 { 440 {
321 GNUNET_break (0); 441 GNUNET_break (0);
322 return NULL; 442 return NULL;
323 } 443 }
324 444 spa = http_split_address ((const char *) &ha[1]);
325 spa = http_split_address (addr);
326 if (NULL == spa) 445 if (NULL == spa)
327 { 446 {
328 (*res) = GNUNET_SYSERR; 447 (*res) = GNUNET_SYSERR;
@@ -361,9 +480,9 @@ http_common_socket_from_address (const void *addr, size_t addrlen, int *res)
361 * @return the size 480 * @return the size
362 */ 481 */
363size_t 482size_t
364http_common_address_get_size (const void *addr) 483http_common_address_get_size (const struct HttpAddress * addr)
365{ 484{
366 return strlen (addr) + 1; 485 return sizeof (struct HttpAddress) + ntohl(addr->urlen);
367} 486}
368 487
369/** 488/**
@@ -378,8 +497,12 @@ http_common_address_get_size (const void *addr)
378size_t 497size_t
379http_common_cmp_addresses (const void *addr1, size_t addrlen1, const void *addr2, size_t addrlen2) 498http_common_cmp_addresses (const void *addr1, size_t addrlen1, const void *addr2, size_t addrlen2)
380{ 499{
500 const struct HttpAddress *ha1;
501 const struct HttpAddress *ha2;
381 const char *a1 = (const char *) addr1; 502 const char *a1 = (const char *) addr1;
382 const char *a2 = (const char *) addr2; 503 const char *a2 = (const char *) addr2;
504 ha1 = (const struct HttpAddress *) a1;
505 ha2 = (const struct HttpAddress *) a2;
383 506
384 if (NULL == a1) 507 if (NULL == a1)
385 return GNUNET_SYSERR; 508 return GNUNET_SYSERR;
@@ -397,8 +520,10 @@ http_common_cmp_addresses (const void *addr1, size_t addrlen1, const void *addr2
397 520
398 if (addrlen1 != addrlen2) 521 if (addrlen1 != addrlen2)
399 return GNUNET_NO; 522 return GNUNET_NO;
523 if (ha1->urlen != ha2->urlen)
524 return GNUNET_NO;
400 525
401 if (0 == strcmp (addr1, addr2)) 526 if (0 == strcmp ((const char *) &ha1[1],(const char *) &ha2[1]))
402 return GNUNET_YES; 527 return GNUNET_YES;
403 return GNUNET_NO; 528 return GNUNET_NO;
404} 529}
diff --git a/src/transport/plugin_transport_http_common.h b/src/transport/plugin_transport_http_common.h
index 31676c284..528f50243 100644
--- a/src/transport/plugin_transport_http_common.h
+++ b/src/transport/plugin_transport_http_common.h
@@ -27,6 +27,7 @@
27#include "platform.h" 27#include "platform.h"
28#include "gnunet_common.h" 28#include "gnunet_common.h"
29#include "gnunet_transport_plugin.h" 29#include "gnunet_transport_plugin.h"
30
30/** 31/**
31 * Timeout values for testing 32 * Timeout values for testing
32 */ 33 */
@@ -53,6 +54,33 @@
53#define HTTP_DEFAULT_PORT 80 54#define HTTP_DEFAULT_PORT 80
54#define HTTPS_DEFAULT_PORT 443 55#define HTTPS_DEFAULT_PORT 443
55 56
57enum HTTP_OPTIONS
58{
59 HTTP_OPTIONS_NONE = 0,
60 HTTP_OPTIONS_VERIFY_CERTIFICATE = 1
61};
62
63
64GNUNET_NETWORK_STRUCT_BEGIN
65
66/**
67 * HttpAddress
68 */
69struct HttpAddress
70{
71 /**
72 * Address options
73 */
74 uint32_t options;
75
76 /**
77 * Length of URL located after struct
78 *
79 */
80 uint32_t urlen;
81};
82
83GNUNET_NETWORK_STRUCT_END
56 84
57struct SplittedHTTPAddress; 85struct SplittedHTTPAddress;
58 86
@@ -94,6 +122,7 @@ http_common_plugin_address_pretty_printer (void *cls, const char *type,
94 */ 122 */
95const char * 123const char *
96http_common_plugin_address_to_string (void *cls, 124http_common_plugin_address_to_string (void *cls,
125 char *plugin,
97 const void *addr, 126 const void *addr,
98 size_t addrlen); 127 size_t addrlen);
99 128
@@ -125,10 +154,10 @@ http_common_plugin_string_to_address (void *cls,
125 * @param addrlen length of the address 154 * @param addrlen length of the address
126 * @return the string 155 * @return the string
127 */ 156 */
128char * 157struct HttpAddress *
129http_common_address_from_socket (const char *protocol, 158http_common_address_from_socket (const char *protocol,
130 const struct sockaddr *addr, 159 const struct sockaddr *addr,
131 socklen_t addrlen); 160 socklen_t addrlen);
132 161
133/** 162/**
134 * Create a socketaddr from a HTTP address 163 * Create a socketaddr from a HTTP address
@@ -144,6 +173,9 @@ http_common_address_from_socket (const char *protocol,
144struct sockaddr * 173struct sockaddr *
145http_common_socket_from_address (const void *addr, size_t addrlen, int *res); 174http_common_socket_from_address (const void *addr, size_t addrlen, int *res);
146 175
176const char *
177http_common_plugin_address_to_url (void *cls, const void *addr, size_t addrlen);
178
147/** 179/**
148 * Get the length of an address 180 * Get the length of an address
149 * 181 *
@@ -151,7 +183,7 @@ http_common_socket_from_address (const void *addr, size_t addrlen, int *res);
151 * @return the size 183 * @return the size
152 */ 184 */
153size_t 185size_t
154http_common_address_get_size (const void *addr); 186http_common_address_get_size (const struct HttpAddress * addr);
155 187
156 188
157/** 189/**
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index 3ccdf4c94..5ae16ca98 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -55,7 +55,6 @@
55 */ 55 */
56struct Plugin; 56struct Plugin;
57 57
58
59/** 58/**
60 * Session handle for connections. 59 * Session handle for connections.
61 */ 60 */
@@ -209,6 +208,11 @@ struct HTTP_Server_Plugin
209 char *protocol; 208 char *protocol;
210 209
211 /** 210 /**
211 * My options to be included in the address
212 */
213 uint32_t options;
214
215 /**
212 * External address 216 * External address
213 */ 217 */
214 char *external_hostname; 218 char *external_hostname;
@@ -245,7 +249,7 @@ struct HTTP_Server_Plugin
245 * External hostname the plugin can be connected to, can be different to 249 * External hostname the plugin can be connected to, can be different to
246 * the host's FQDN, used e.g. for reverse proxying 250 * the host's FQDN, used e.g. for reverse proxying
247 */ 251 */
248 char *ext_addr; 252 struct HttpAddress *ext_addr;
249 253
250 /** 254 /**
251 * Notify transport only about external address 255 * Notify transport only about external address
@@ -377,7 +381,7 @@ struct HttpAddressWrapper
377 */ 381 */
378 struct HttpAddressWrapper *prev; 382 struct HttpAddressWrapper *prev;
379 383
380 void *addr; 384 struct HttpAddress *address;
381 385
382 size_t addrlen; 386 size_t addrlen;
383}; 387};
@@ -662,7 +666,7 @@ http_server_plugin_address_suggested (void *cls, const void *addr,
662 next = pos->next; 666 next = pos->next;
663 if (GNUNET_YES == (http_common_cmp_addresses(addr, 667 if (GNUNET_YES == (http_common_cmp_addresses(addr,
664 addrlen, 668 addrlen,
665 pos->addr, 669 pos->address,
666 pos->addrlen))) 670 pos->addrlen)))
667 return GNUNET_OK; 671 return GNUNET_OK;
668 672
@@ -1021,7 +1025,7 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin,
1021 const union MHD_ConnectionInfo *conn_info; 1025 const union MHD_ConnectionInfo *conn_info;
1022 struct GNUNET_ATS_Information ats; 1026 struct GNUNET_ATS_Information ats;
1023 1027
1024 char *addr; 1028 struct HttpAddress *addr;
1025 size_t addr_len; 1029 size_t addr_len;
1026 1030
1027 struct GNUNET_PeerIdentity target; 1031 struct GNUNET_PeerIdentity target;
@@ -1111,7 +1115,7 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin,
1111 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1115 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1112 "Creating new session for peer `%s' connecting from `%s'\n", 1116 "Creating new session for peer `%s' connecting from `%s'\n",
1113 GNUNET_i2s (&target), 1117 GNUNET_i2s (&target),
1114 http_common_plugin_address_to_string (NULL, addr, addr_len)); 1118 http_common_plugin_address_to_string (NULL, p->protocol, addr, addr_len));
1115 1119
1116 s = GNUNET_malloc (sizeof (struct Session)); 1120 s = GNUNET_malloc (sizeof (struct Session));
1117 memcpy (&s->target, &target, sizeof (struct GNUNET_PeerIdentity)); 1121 memcpy (&s->target, &target, sizeof (struct GNUNET_PeerIdentity));
@@ -1313,7 +1317,7 @@ server_receive_mst_cb (void *cls, void *client,
1313 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1317 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1314 "Peer `%s' address `%s' next read delayed for %llu ms\n", 1318 "Peer `%s' address `%s' next read delayed for %llu ms\n",
1315 GNUNET_i2s (&s->target), 1319 GNUNET_i2s (&s->target),
1316 http_common_plugin_address_to_string (NULL, s->addr, s->addrlen), 1320 http_common_plugin_address_to_string (NULL, p->protocol, s->addr, s->addrlen),
1317 delay); 1321 delay);
1318 } 1322 }
1319 server_reschedule_session_timeout (s); 1323 server_reschedule_session_timeout (s);
@@ -1420,6 +1424,7 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
1420 s, sc, 1424 s, sc,
1421 GNUNET_i2s (&s->target), 1425 GNUNET_i2s (&s->target),
1422 http_common_plugin_address_to_string (NULL, 1426 http_common_plugin_address_to_string (NULL,
1427 p->protocol,
1423 s->addr, 1428 s->addr,
1424 s->addrlen)); 1429 s->addrlen));
1425 sc->connected = GNUNET_YES; 1430 sc->connected = GNUNET_YES;
@@ -1433,6 +1438,7 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
1433 s, sc, 1438 s, sc,
1434 GNUNET_i2s (&s->target), 1439 GNUNET_i2s (&s->target),
1435 http_common_plugin_address_to_string (NULL, 1440 http_common_plugin_address_to_string (NULL,
1441 p->protocol,
1436 s->addr, 1442 s->addr,
1437 s->addrlen)); 1443 s->addrlen));
1438 sc->connected = GNUNET_NO; 1444 sc->connected = GNUNET_NO;
@@ -1452,6 +1458,7 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
1452 s, sc, 1458 s, sc,
1453 GNUNET_i2s (&s->target), 1459 GNUNET_i2s (&s->target),
1454 http_common_plugin_address_to_string (NULL, 1460 http_common_plugin_address_to_string (NULL,
1461 p->protocol,
1455 s->addr, 1462 s->addr,
1456 s->addrlen), 1463 s->addrlen),
1457 *upload_data_size); 1464 *upload_data_size);
@@ -1532,7 +1539,7 @@ server_disconnect_cb (void *cls, struct MHD_Connection *connection,
1532 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1539 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1533 "Peer `%s' connection %p, GET on address `%s' disconnected\n", 1540 "Peer `%s' connection %p, GET on address `%s' disconnected\n",
1534 GNUNET_i2s (&s->target), s->server_send, 1541 GNUNET_i2s (&s->target), s->server_send,
1535 http_common_plugin_address_to_string (NULL, s->addr, s->addrlen)); 1542 http_common_plugin_address_to_string (NULL, p->protocol, s->addr, s->addrlen));
1536 s->server_send = NULL; 1543 s->server_send = NULL;
1537 if (NULL != (s->server_recv)) 1544 if (NULL != (s->server_recv))
1538 { 1545 {
@@ -1550,7 +1557,7 @@ server_disconnect_cb (void *cls, struct MHD_Connection *connection,
1550 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1557 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1551 "Peer `%s' connection %p PUT on address `%s' disconnected\n", 1558 "Peer `%s' connection %p PUT on address `%s' disconnected\n",
1552 GNUNET_i2s (&s->target), s->server_recv, 1559 GNUNET_i2s (&s->target), s->server_recv,
1553 http_common_plugin_address_to_string (NULL, s->addr, s->addrlen)); 1560 http_common_plugin_address_to_string (NULL, p->protocol, s->addr, s->addrlen));
1554 s->server_recv = NULL; 1561 s->server_recv = NULL;
1555 /* Do not terminate session when PUT disconnects 1562 /* Do not terminate session when PUT disconnects
1556 if (NULL != (s->server_send)) 1563 if (NULL != (s->server_send))
@@ -1578,7 +1585,7 @@ server_disconnect_cb (void *cls, struct MHD_Connection *connection,
1578 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1585 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1579 "Peer `%s' on address `%s' disconnected\n", 1586 "Peer `%s' on address `%s' disconnected\n",
1580 GNUNET_i2s (&s->target), 1587 GNUNET_i2s (&s->target),
1581 http_common_plugin_address_to_string (NULL, s->addr, s->addrlen)); 1588 http_common_plugin_address_to_string (NULL, p->protocol, s->addr, s->addrlen));
1582 1589
1583 if ((GNUNET_YES == s->session_passed) && (GNUNET_NO == s->session_ended)) 1590 if ((GNUNET_YES == s->session_passed) && (GNUNET_NO == s->session_ended))
1584 { 1591 {
@@ -2152,22 +2159,22 @@ server_add_address (void *cls, int add_remove, const struct sockaddr *addr,
2152 struct HttpAddressWrapper *w = NULL; 2159 struct HttpAddressWrapper *w = NULL;
2153 2160
2154 w = GNUNET_malloc (sizeof (struct HttpAddressWrapper)); 2161 w = GNUNET_malloc (sizeof (struct HttpAddressWrapper));
2155 w->addr = http_common_address_from_socket (plugin->protocol, addr, addrlen); 2162 w->address = http_common_address_from_socket (plugin->protocol, addr, addrlen);
2156 if (NULL == w->addr) 2163 if (NULL == w->address)
2157 { 2164 {
2158 GNUNET_free (w); 2165 GNUNET_free (w);
2159 return; 2166 return;
2160 } 2167 }
2161 w->addrlen = http_common_address_get_size (w->addr); 2168 w->addrlen = http_common_address_get_size (w->address);
2162 2169
2163 GNUNET_CONTAINER_DLL_insert(plugin->addr_head, plugin->addr_tail, w); 2170 GNUNET_CONTAINER_DLL_insert(plugin->addr_head, plugin->addr_tail, w);
2164 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 2171 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
2165 "Notifying transport to add address `%s'\n", 2172 "Notifying transport to add address `%s'\n",
2166 http_common_plugin_address_to_string(NULL, w->addr, w->addrlen)); 2173 http_common_plugin_address_to_string (NULL, p->protocol, w->address, w->addrlen));
2167#if BUILD_HTTPS 2174#if BUILD_HTTPS
2168 plugin->env->notify_address (plugin->env->cls, add_remove, w->addr, w->addrlen, "https_client"); 2175 plugin->env->notify_address (plugin->env->cls, add_remove, w->address, w->addrlen, "https_client");
2169#else 2176#else
2170 plugin->env->notify_address (plugin->env->cls, add_remove, w->addr, w->addrlen, "http_client"); 2177 plugin->env->notify_address (plugin->env->cls, add_remove, w->address, w->addrlen, "http_client");
2171#endif 2178#endif
2172} 2179}
2173 2180
@@ -2194,7 +2201,7 @@ server_remove_address (void *cls, int add_remove, const struct sockaddr *addr,
2194 2201
2195 while (NULL != w) 2202 while (NULL != w)
2196 { 2203 {
2197 if (GNUNET_YES == http_common_cmp_addresses(w->addr, w->addrlen, saddr, saddr_len)) 2204 if (GNUNET_YES == http_common_cmp_addresses(w->address, w->addrlen, saddr, saddr_len))
2198 break; 2205 break;
2199 w = w->next; 2206 w = w->next;
2200 } 2207 }
@@ -2205,14 +2212,14 @@ server_remove_address (void *cls, int add_remove, const struct sockaddr *addr,
2205 2212
2206 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 2213 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
2207 "Notifying transport to remove address `%s'\n", 2214 "Notifying transport to remove address `%s'\n",
2208 http_common_plugin_address_to_string (NULL, w->addr, w->addrlen)); 2215 http_common_plugin_address_to_string (NULL, p->protocol, w->address, w->addrlen));
2209 GNUNET_CONTAINER_DLL_remove (plugin->addr_head, plugin->addr_tail, w); 2216 GNUNET_CONTAINER_DLL_remove (plugin->addr_head, plugin->addr_tail, w);
2210#if BUILD_HTTPS 2217#if BUILD_HTTPS
2211 plugin->env->notify_address (plugin->env->cls, add_remove, w->addr, w->addrlen, "https_client"); 2218 plugin->env->notify_address (plugin->env->cls, add_remove, w->address, w->addrlen, "https_client");
2212#else 2219#else
2213 plugin->env->notify_address (plugin->env->cls, add_remove, w->addr, w->addrlen, "http_client"); 2220 plugin->env->notify_address (plugin->env->cls, add_remove, w->address, w->addrlen, "http_client");
2214#endif 2221#endif
2215 GNUNET_free (w->addr); 2222 GNUNET_free (w->address);
2216 GNUNET_free (w); 2223 GNUNET_free (w);
2217} 2224}
2218 2225
@@ -2533,7 +2540,7 @@ server_stop_report_addresses (struct HTTP_Server_Plugin *plugin)
2533 { 2540 {
2534 w = plugin->addr_head; 2541 w = plugin->addr_head;
2535 GNUNET_CONTAINER_DLL_remove (plugin->addr_head, plugin->addr_tail, w); 2542 GNUNET_CONTAINER_DLL_remove (plugin->addr_head, plugin->addr_tail, w);
2536 GNUNET_free (w->addr); 2543 GNUNET_free (w->address);
2537 GNUNET_free (w); 2544 GNUNET_free (w);
2538 } 2545 }
2539} 2546}
@@ -2588,30 +2595,29 @@ static void
2588server_notify_external_hostname (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 2595server_notify_external_hostname (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2589{ 2596{
2590 struct HTTP_Server_Plugin *plugin = cls; 2597 struct HTTP_Server_Plugin *plugin = cls;
2598 unsigned int urlen;
2599 char *url;
2591 2600
2592 plugin->notify_ext_task = GNUNET_SCHEDULER_NO_TASK; 2601 plugin->notify_ext_task = GNUNET_SCHEDULER_NO_TASK;
2593
2594 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 2602 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
2595 return; 2603 return;
2596 2604
2605 GNUNET_asprintf(&url, "%s://%s", plugin->protocol, plugin->external_hostname);
2597 2606
2598#if BUILD_HTTPS 2607 urlen = strlen (url) + 1;
2599 GNUNET_asprintf(&plugin->ext_addr, "%s%s://%s", plugin->protocol, 2608 plugin->ext_addr = GNUNET_malloc (sizeof (struct HttpAddress) + urlen);
2600 (GNUNET_YES == plugin->verify_external_hostname) ? "+" : "", 2609 plugin->ext_addr->options = htonl(plugin->options);
2601 plugin->external_hostname); 2610 plugin->ext_addr->urlen = htonl (urlen);
2602#else 2611 plugin->ext_addr_len = sizeof (struct HttpAddress) + urlen;
2603 GNUNET_asprintf(&plugin->ext_addr, "%s://%s", plugin->protocol, 2612 memcpy (&plugin->ext_addr[1], url, urlen);
2604 plugin->external_hostname); 2613 GNUNET_free (url);
2605#endif
2606
2607 plugin->ext_addr_len = strlen (plugin->ext_addr) + 1;
2608 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 2614 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
2609 "Notifying transport about external hostname address `%s'\n", plugin->ext_addr); 2615 "Notifying transport about external hostname address `%s'\n", plugin->ext_addr);
2610 2616
2611#if BUILD_HTTPS 2617#if BUILD_HTTPS
2612 if (GNUNET_YES == plugin->verify_external_hostname) 2618 if (GNUNET_YES == plugin->verify_external_hostname)
2613 GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, plugin->name, 2619 GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, plugin->name,
2614 "Enabling SSL verification for external hostname address `%s'\n", plugin->ext_addr); 2620 "Enabling SSL verification for external hostname address `%s'\n", plugin->external_hostname);
2615 plugin->env->notify_address (plugin->env->cls, GNUNET_YES, 2621 plugin->env->notify_address (plugin->env->cls, GNUNET_YES,
2616 plugin->ext_addr, plugin->ext_addr_len, 2622 plugin->ext_addr, plugin->ext_addr_len,
2617 "https_client"); 2623 "https_client");
@@ -2756,6 +2762,8 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin)
2756 "VERIFY_EXTERNAL_HOSTNAME"); 2762 "VERIFY_EXTERNAL_HOSTNAME");
2757 if (GNUNET_SYSERR == plugin->verify_external_hostname) 2763 if (GNUNET_SYSERR == plugin->verify_external_hostname)
2758 plugin->verify_external_hostname = GNUNET_NO; 2764 plugin->verify_external_hostname = GNUNET_NO;
2765 if (GNUNET_YES == plugin->verify_external_hostname)
2766 plugin->options |= HTTP_OPTIONS_VERIFY_CERTIFICATE;
2759#endif 2767#endif
2760 2768
2761 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg, plugin->name, 2769 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg, plugin->name,
@@ -2908,6 +2916,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls)
2908 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 2916 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
2909 "Notifying transport to remove address `%s'\n", 2917 "Notifying transport to remove address `%s'\n",
2910 http_common_plugin_address_to_string (NULL, 2918 http_common_plugin_address_to_string (NULL,
2919 p->protocol,
2911 plugin->ext_addr, 2920 plugin->ext_addr,
2912 plugin->ext_addr_len)); 2921 plugin->ext_addr_len));
2913#if BUILD_HTTPS 2922#if BUILD_HTTPS
@@ -2961,6 +2970,13 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls)
2961 return NULL; 2970 return NULL;
2962} 2971}
2963 2972
2973const char *http_plugin_address_to_string (void *cls,
2974 const void *addr,
2975 size_t addrlen)
2976{
2977 return http_common_plugin_address_to_string (cls, p->protocol, addr, addrlen);
2978}
2979
2964 2980
2965/** 2981/**
2966 * Entry point for the plugin. 2982 * Entry point for the plugin.
@@ -2985,7 +3001,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
2985 initialze the plugin or the API */ 3001 initialze the plugin or the API */
2986 api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions)); 3002 api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
2987 api->cls = NULL; 3003 api->cls = NULL;
2988 api->address_to_string = &http_common_plugin_address_to_string; 3004 api->address_to_string = &http_plugin_address_to_string;
2989 api->string_to_address = &http_common_plugin_string_to_address; 3005 api->string_to_address = &http_common_plugin_string_to_address;
2990 api->address_pretty_printer = &http_common_plugin_address_pretty_printer; 3006 api->address_pretty_printer = &http_common_plugin_address_pretty_printer;
2991 return api; 3007 return api;
@@ -2998,7 +3014,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
2998 api->check_address = &http_server_plugin_address_suggested; 3014 api->check_address = &http_server_plugin_address_suggested;
2999 api->get_session = &http_server_plugin_get_session; 3015 api->get_session = &http_server_plugin_get_session;
3000 3016
3001 api->address_to_string = &http_common_plugin_address_to_string; 3017 api->address_to_string = &http_plugin_address_to_string;
3002 api->string_to_address = &http_common_plugin_string_to_address; 3018 api->string_to_address = &http_common_plugin_string_to_address;
3003 api->address_pretty_printer = &http_common_plugin_address_pretty_printer; 3019 api->address_pretty_printer = &http_common_plugin_address_pretty_printer;
3004 3020