aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http_server.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-10-13 08:06:28 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-10-13 08:06:28 +0000
commitf9d82cbcd81da81a3e78bada99f54ccc7c9ac50b (patch)
tree24635e8bad579f156f4c8f2153c2d213a20f1850 /src/transport/plugin_transport_http_server.c
parent1a7597ebe84660f31cb5f5b22904641940ca86ab (diff)
downloadgnunet-f9d82cbcd81da81a3e78bada99f54ccc7c9ac50b.tar.gz
gnunet-f9d82cbcd81da81a3e78bada99f54ccc7c9ac50b.zip
Diffstat (limited to 'src/transport/plugin_transport_http_server.c')
-rw-r--r--src/transport/plugin_transport_http_server.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index 68686169e..0eb88fc01 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -352,6 +352,12 @@ server_lookup_session (struct Plugin *plugin,
352 struct ServerConnection *sc = NULL; 352 struct ServerConnection *sc = NULL;
353 const union MHD_ConnectionInfo *conn_info; 353 const union MHD_ConnectionInfo *conn_info;
354 354
355 struct IPv4HttpAddress a4;
356 struct IPv6HttpAddress a6;
357 struct sockaddr_in * s4;
358 struct sockaddr_in6 * s6;
359 void * a;
360 size_t a_len;
355 struct GNUNET_PeerIdentity target; 361 struct GNUNET_PeerIdentity target;
356 size_t addrlen; 362 size_t addrlen;
357 int check = GNUNET_NO; 363 int check = GNUNET_NO;
@@ -485,10 +491,32 @@ create:
485 "Server: Creating new session for peer `%s' \n", GNUNET_i2s (&target)); 491 "Server: Creating new session for peer `%s' \n", GNUNET_i2s (&target));
486#endif 492#endif
487 493
494 switch (conn_info->client_addr->sa_family)
495 {
496 case (AF_INET):
497 s4 = ((struct sockaddr_in * ) conn_info->client_addr);
498 a4.u4_port = s4->sin_port;
499 memcpy (&a4.ipv4_addr, &s4->sin_addr,
500 sizeof (struct in_addr));
501 a = &a4;
502 a_len = sizeof (struct IPv4HttpAddress);
503 break;
504 case (AF_INET6):
505 s6 = ((struct sockaddr_in6 * ) conn_info->client_addr);
506 a6.u6_port = s6->sin6_port;
507 memcpy (&a6.ipv6_addr, &s6->sin6_addr,
508 sizeof (struct in6_addr));
509 a = &a6;
510 a_len = sizeof (struct IPv6HttpAddress);
511 break;
512 default:
513 GNUNET_break (0);
514 }
515
488 s = create_session (plugin, 516 s = create_session (plugin,
489 &target, 517 &target,
490 conn_info->client_addr, 518 a,
491 addrlen, 519 a_len,
492 NULL, 520 NULL,
493 NULL); 521 NULL);
494 522