aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2018-11-20 14:11:48 +0100
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2018-11-20 14:11:48 +0100
commit8f587cf6e19d65bbaf277ddc18d8e0bb72e7c26f (patch)
tree0b993dfa94c3434eaf89483b94589fb653f879c3 /src
parenta0d77ca83403ff8ae8c4c81395b95faebecbdd4a (diff)
downloadgnunet-8f587cf6e19d65bbaf277ddc18d8e0bb72e7c26f.tar.gz
gnunet-8f587cf6e19d65bbaf277ddc18d8e0bb72e7c26f.zip
no leho cors
Diffstat (limited to 'src')
-rw-r--r--src/gns/gnunet-gns-proxy.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c
index a502e0b65..bec5360ca 100644
--- a/src/gns/gnunet-gns-proxy.c
+++ b/src/gns/gnunet-gns-proxy.c
@@ -1230,9 +1230,7 @@ curl_check_hdr (void *buffer,
1230 goto cleanup; 1230 goto cleanup;
1231 } 1231 }
1232 if ((0 == strcasecmp (MHD_HTTP_HEADER_LOCATION, 1232 if ((0 == strcasecmp (MHD_HTTP_HEADER_LOCATION,
1233 hdr_type)) || 1233 hdr_type)))
1234 (0 == strcasecmp (MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN,
1235 hdr_type)))
1236 { 1234 {
1237 char *leho_host; 1235 char *leho_host;
1238 1236
@@ -1256,6 +1254,29 @@ curl_check_hdr (void *buffer,
1256 } 1254 }
1257 GNUNET_free (leho_host); 1255 GNUNET_free (leho_host);
1258 } 1256 }
1257 if (0 == strcasecmp (MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN,
1258 hdr_type))
1259 {
1260 char *leho_host;
1261
1262 GNUNET_asprintf (&leho_host,
1263 (HTTPS_PORT != s5r->port)
1264 ? "http://%s"
1265 : "https://%s",
1266 s5r->leho);
1267 if (0 == strncmp (leho_host,
1268 hdr_val,
1269 strlen (leho_host)))
1270 {
1271 GNUNET_asprintf (&new_location,
1272 "%s%s",
1273 (HTTPS_PORT != s5r->port)
1274 ? "http://"
1275 : "https://",
1276 s5r->domain);
1277 hdr_val = new_location;
1278 }
1279
1259 /* MHD does not allow certain characters in values, remove those */ 1280 /* MHD does not allow certain characters in values, remove those */
1260 if (NULL != (tok = strchr (hdr_val, '\n'))) 1281 if (NULL != (tok = strchr (hdr_val, '\n')))
1261 *tok = '\0'; 1282 *tok = '\0';
@@ -1337,22 +1358,6 @@ create_mhd_response_from_s5r (struct Socks5Request *s5r)
1337 header->value)); 1358 header->value));
1338 1359
1339 } 1360 }
1340 if (NULL != s5r->leho)
1341 {
1342 char *cors_hdr;
1343
1344 GNUNET_asprintf (&cors_hdr,
1345 (HTTPS_PORT == s5r->port)
1346 ? "https://%s"
1347 : "http://%s",
1348 s5r->leho);
1349
1350 GNUNET_break (MHD_YES ==
1351 MHD_add_response_header (s5r->response,
1352 MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN,
1353 cors_hdr));
1354 GNUNET_free (cors_hdr);
1355 }
1356 /* force connection to be closed after each request, as we 1361 /* force connection to be closed after each request, as we
1357 do not support HTTP pipelining (yet, FIXME!) */ 1362 do not support HTTP pipelining (yet, FIXME!) */
1358 /*GNUNET_break (MHD_YES == 1363 /*GNUNET_break (MHD_YES ==