diff options
Diffstat (limited to 'src/transport/plugin_transport_http_server.c')
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 4d879e166..58e5db46a 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -25,8 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_common.h" | 28 | #include "gnunet_util_lib.h" |
29 | #include "gnunet_server_lib.h" | ||
30 | #include "gnunet_statistics_service.h" | 29 | #include "gnunet_statistics_service.h" |
31 | #include "gnunet_transport_plugin.h" | 30 | #include "gnunet_transport_plugin.h" |
32 | #include "gnunet_nat_lib.h" | 31 | #include "gnunet_nat_lib.h" |
@@ -924,14 +923,16 @@ server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin, | |||
924 | */ | 923 | */ |
925 | 924 | ||
926 | static int | 925 | static int |
927 | server_parse_url (struct HTTP_Server_Plugin *plugin, const char * url, struct GNUNET_PeerIdentity * target, uint32_t *tag) | 926 | server_parse_url (struct HTTP_Server_Plugin *plugin, |
927 | const char *url, | ||
928 | struct GNUNET_PeerIdentity *target, | ||
929 | uint32_t *tag) | ||
928 | { | 930 | { |
929 | char * tag_start = NULL; | 931 | char * tag_start = NULL; |
930 | char * tag_end = NULL; | 932 | char * tag_end = NULL; |
931 | char * target_start = NULL; | 933 | char * target_start = NULL; |
932 | char * separator = NULL; | 934 | char * separator = NULL; |
933 | char hash[plugin->peer_id_length+1]; | 935 | unsigned int hash_length; |
934 | int hash_length; | ||
935 | unsigned long int ctag; | 936 | unsigned long int ctag; |
936 | 937 | ||
937 | /* URL parsing | 938 | /* URL parsing |
@@ -1011,18 +1012,19 @@ server_parse_url (struct HTTP_Server_Plugin *plugin, const char * url, struct GN | |||
1011 | if (DEBUG_URL_PARSE) GNUNET_break (0); | 1012 | if (DEBUG_URL_PARSE) GNUNET_break (0); |
1012 | return GNUNET_SYSERR; | 1013 | return GNUNET_SYSERR; |
1013 | } | 1014 | } |
1014 | memcpy (hash, target_start, hash_length); | 1015 | if (GNUNET_OK != |
1015 | hash[hash_length] = '\0'; | 1016 | GNUNET_CRYPTO_ecc_public_sign_key_from_string (target_start, |
1016 | 1017 | hash_length, | |
1017 | if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string ((const char *) hash, &(target->hashPubKey))) | 1018 | &target->public_key)) |
1018 | { | 1019 | { |
1019 | /* hash conversion failed */ | 1020 | /* hash conversion failed */ |
1020 | if (DEBUG_URL_PARSE) GNUNET_break (0); | 1021 | if (DEBUG_URL_PARSE) GNUNET_break (0); |
1021 | return GNUNET_SYSERR; | 1022 | return GNUNET_SYSERR; |
1022 | } | 1023 | } |
1023 | 1024 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | |
1024 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1025 | plugin->name, |
1025 | "Found target `%s' in url\n", GNUNET_h2s_full(&target->hashPubKey)); | 1026 | "Found target `%s' in URL\n", |
1027 | GNUNET_i2s_full (target)); | ||
1026 | return GNUNET_OK; | 1028 | return GNUNET_OK; |
1027 | } | 1029 | } |
1028 | 1030 | ||
@@ -2879,7 +2881,7 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin) | |||
2879 | plugin->max_connections); | 2881 | plugin->max_connections); |
2880 | 2882 | ||
2881 | 2883 | ||
2882 | plugin->peer_id_length = strlen (GNUNET_h2s_full (&plugin->env->my_identity->hashPubKey)); | 2884 | plugin->peer_id_length = strlen (GNUNET_i2s_full (plugin->env->my_identity)); |
2883 | 2885 | ||
2884 | return GNUNET_OK; | 2886 | return GNUNET_OK; |
2885 | } | 2887 | } |