aboutsummaryrefslogtreecommitdiff
path: root/src/gns
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2012-07-14 21:52:09 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2012-07-14 21:52:09 +0000
commit67cc349602fc6c071955be40174a6397662f83f2 (patch)
treee471f4eefbd8b0ecb8e3070bebab02c616afe6ef /src/gns
parenta299afa8af5593c2114ca8242099d8f7971c428e (diff)
downloadgnunet-67cc349602fc6c071955be40174a6397662f83f2.tar.gz
gnunet-67cc349602fc6c071955be40174a6397662f83f2.zip
-fixes
Diffstat (limited to 'src/gns')
-rw-r--r--src/gns/gnunet-gns-proxy.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c
index a6fc47e94..03d08cd6b 100644
--- a/src/gns/gnunet-gns-proxy.c
+++ b/src/gns/gnunet-gns-proxy.c
@@ -253,7 +253,7 @@ struct ProxyCurlTask
253 char host[256]; 253 char host[256];
254 254
255 /* The port */ 255 /* The port */
256 int port; 256 uint16_t port;
257 257
258 /* The LEgacy HOstname (can be empty) */ 258 /* The LEgacy HOstname (can be empty) */
259 char leho[256]; 259 char leho[256];
@@ -606,6 +606,7 @@ con_val_iter (void *cls,
606 char* port; 606 char* port;
607 char* cstr; 607 char* cstr;
608 const char* hdr_val; 608 const char* hdr_val;
609 unsigned int uport;
609 610
610 if (0 == strcmp ("Host", key)) 611 if (0 == strcmp ("Host", key))
611 { 612 {
@@ -613,7 +614,14 @@ con_val_iter (void *cls,
613 if (NULL != port) 614 if (NULL != port)
614 { 615 {
615 strncpy (buf, value, port-value); 616 strncpy (buf, value, port-value);
616 ctask->port = atoi (++port); 617 port++;
618 if ((1 != sscanf (port, "%u", &uport)) ||
619 (uport > UINT16_MAX) ||
620 (0 == uport))
621 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
622 "Unable to parse port!\n");
623 else
624 ctask->port = (uint16_t) uport;
617 } 625 }
618 else 626 else
619 strcpy (buf, value); 627 strcpy (buf, value);
@@ -1640,7 +1648,7 @@ process_leho_lookup (void *cls,
1640 1648
1641 if (0 != strcmp (ctask->leho, "")) 1649 if (0 != strcmp (ctask->leho, ""))
1642 { 1650 {
1643 sprintf (hosthdr, "%s%s", "Host: ", ctask->leho); 1651 sprintf (hosthdr, "%s%s:%d", "Host: ", ctask->leho, ctask->port);
1644 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1652 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1645 "New HTTP header value: %s\n", hosthdr); 1653 "New HTTP header value: %s\n", hosthdr);
1646 ctask->headers = curl_slist_append (ctask->headers, hosthdr); 1654 ctask->headers = curl_slist_append (ctask->headers, hosthdr);