From 99a1caf7222a7863fb54ef671623065eba5984e6 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Mon, 26 Mar 2012 15:13:01 +0000 Subject: [PATCH] -fixes, no deflate/partial content in proxy --- src/gns/gnunet-service-gns_resolver.c | 16 +++++++++++----- src/gns/proxy/{proxy.py => gnunet-gns-proxy.py} | 5 ++++- 2 files changed, 15 insertions(+), 6 deletions(-) rename src/gns/proxy/{proxy.py => gnunet-gns-proxy.py} (97%) diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 991d518e6..ae01dafa9 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c @@ -2164,7 +2164,7 @@ process_zone_to_name_shorten(void *cls, free_resolver_handle(rh); } else if (GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone, - &local_zone)) + &local_zone) == 0) { /* our zone, just append .gnunet */ answer_len = strlen(rh->name) + strlen(GNUNET_GNS_TLD) + 2; @@ -2190,11 +2190,17 @@ process_zone_to_name_shorten(void *cls, // strlen(next_authority->name) + 2); memset(next_authority_name, 0, strlen(rh->name)+ strlen(next_authority->name) + 2); - strcpy(next_authority_name, rh->name); - strcpy(next_authority_name+strlen(rh->name)+1, "."); - strcpy(next_authority_name+strlen(rh->name)+2, next_authority->name); - + GNUNET_snprintf(next_authority_name, MAX_DNS_NAME_LENGTH, + "%s.%s", rh->name, next_authority->name); + //strcpy(next_authority_name, rh->name); + //strcpy(next_authority_name+strlen(rh->name)+1, "."); + //strcpy(next_authority_name+strlen(rh->name)+2, next_authority->name); + strcpy(rh->name, next_authority_name); + GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, + "No PSEU found for authority %s. Promoting back: %s\n", + next_authority->name, rh->name); + GNUNET_CONTAINER_DLL_remove(rh->authority_chain_head, rh->authority_chain_tail, next_authority); diff --git a/src/gns/proxy/proxy.py b/src/gns/proxy/gnunet-gns-proxy.py similarity index 97% rename from src/gns/proxy/proxy.py rename to src/gns/proxy/gnunet-gns-proxy.py index eca2e43d2..aea625cbb 100644 --- a/src/gns/proxy/proxy.py +++ b/src/gns/proxy/gnunet-gns-proxy.py @@ -121,6 +121,7 @@ class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler): self.headers['Host'] = newhost self.headers['Connection'] = 'close' del self.headers['Proxy-Connection'] + del self.headers['Accept-Encoding'] for key_val in self.headers.items(): soc.send("%s: %s\r\n" % key_val) soc.send("\r\n") @@ -149,6 +150,8 @@ class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler): data = i.recv(8192) if data: try: + print self.headers + data = re.sub(r'\nAccept-Ranges: \w+', r'', data) data = re.sub('(a href="http://(\w+\.)*zkey)', self.shorten_zkey(), data) if (re.match("(\w+\.)*gnunet", self.host_port[0])): @@ -156,7 +159,7 @@ class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler): arr.pop(0) data = re.sub('(a href="http://(\w+\.)*)(\+)', self.replace_and_shorten(to_repl), data) - #print data + print data out.send(data) count = 0 except: -- 2.25.1