From 2ce927d7bc58e7ee00267f593d874570a3ab467e Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Mon, 9 Jul 2012 12:07:33 +0000 Subject: [PATCH] -fix site of origin refs --- src/gns/gnunet-gns-proxy.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index 4d605d82d..7f6a93b8b 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c @@ -44,7 +44,7 @@ /* regexp */ //#define RE_DOTPLUS " %s\n", ctask->pp_buf, short_name); - - sprintf (tmp, "pp_buf, tmp); ctask->pp_finished = GNUNET_YES; @@ -814,7 +814,8 @@ mhd_content_cb (void *cls, GNUNET_log ( GNUNET_ERROR_TYPE_DEBUG, "MHD: We need to parse the HTML %s\n", ctask->buffer_ptr); - nomatch = regexec ( &re_dotplus, ctask->buffer_ptr, RE_N_MATCHES, m, 0); + nomatch = regexec ( &re_dotplus, + ctask->buffer_ptr, RE_N_MATCHES, m, 0); if (nomatch) { @@ -885,12 +886,31 @@ mhd_content_cb (void *cls, strcpy ( ctask->pp_buf+strlen(ctask->pp_buf), ctask->authority); } - /* If .zkey simply copy the name */ + /* If .zkey or .tld simply copy the name */ else { + memcpy (ctask->pp_buf, hostptr, (m[3].rm_eo-m[1].rm_so)); + if (is_tld (ctask->pp_buf, GNUNET_GNS_TLD_ZKEY) == GNUNET_NO) + { + if (0 == strcmp (ctask->pp_buf, ctask->leho)) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Replacing LEHO\n"); + memcpy (ctask->pp_buf, + ctask->buffer_ptr+m[0].rm_so, + m[1].rm_so-m[0].rm_so); + strcpy (ctask->pp_buf+(m[1].rm_so-m[0].rm_so), + ctask->host); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "New tag: %s\n", ctask->pp_buf); + ctask->is_postprocessing = GNUNET_YES; + ctask->pp_finished = GNUNET_YES; + return 0; + } + goto copy_data; + } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Link is zkey\n"); - memcpy (ctask->pp_buf, hostptr, (m[1].rm_eo-m[1].rm_so + strlen (GNUNET_GNS_TLD_ZKEY))); + "Link %s is zkey\n", ctask->pp_buf); } ctask->is_postprocessing = GNUNET_YES; @@ -908,7 +928,7 @@ mhd_content_cb (void *cls, } } } - +copy_data: if ( bytes_to_copy > max ) { GNUNET_log ( GNUNET_ERROR_TYPE_DEBUG, -- 2.25.1