aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http_server.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-06-22 23:14:54 +0000
committerChristian Grothoff <christian@grothoff.org>2014-06-22 23:14:54 +0000
commitcb863a5e320484410fcd386b47216951ea10c8ca (patch)
tree783b1648d7752865248f3f245b6c538b6d6f21d2 /src/transport/plugin_transport_http_server.c
parent7114c13aa08b9843277f08ce401e23e2a4a75953 (diff)
downloadgnunet-cb863a5e320484410fcd386b47216951ea10c8ca.tar.gz
gnunet-cb863a5e320484410fcd386b47216951ea10c8ca.zip
-fix regex
Diffstat (limited to 'src/transport/plugin_transport_http_server.c')
-rw-r--r--src/transport/plugin_transport_http_server.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index 29ae6224e..3d2ba2bfb 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -947,7 +947,7 @@ server_parse_url (struct HTTP_Server_Plugin *plugin,
947 947
948 /* URL parsing */ 948 /* URL parsing */
949#define URL_REGEX \ 949#define URL_REGEX \
950 ("^.*/([0-9A-V]+);([0-9]+)(,[0-9]+)?$") 950 ("^.*/([0-9A-Z]+);([0-9]+)(,[0-9]+)?$")
951 951
952 if (NULL == url) 952 if (NULL == url)
953 { 953 {
@@ -957,8 +957,9 @@ server_parse_url (struct HTTP_Server_Plugin *plugin,
957 957
958 if (regexec(&plugin->url_regex, url, 4, matches, 0)) 958 if (regexec(&plugin->url_regex, url, 4, matches, 0))
959 { 959 {
960 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 960 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
961 "URL `%s' did not match regex\n", url); 961 plugin->name,
962 "URL `%s' did not match regex\n", url);
962 return GNUNET_SYSERR; 963 return GNUNET_SYSERR;
963 } 964 }
964 965
@@ -975,31 +976,37 @@ server_parse_url (struct HTTP_Server_Plugin *plugin,
975 } 976 }
976 if (rc == 0) 977 if (rc == 0)
977 { 978 {
978 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 979 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
980 plugin->name,
979 "URL tag is zero\n"); 981 "URL tag is zero\n");
980 return GNUNET_SYSERR; 982 return GNUNET_SYSERR;
981 } 983 }
982 if ((rc == ULONG_MAX) && (ERANGE == errno)) 984 if ((rc == ULONG_MAX) && (ERANGE == errno))
983 { 985 {
984 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 986 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
987 plugin->name,
985 "URL tag > ULONG_MAX\n"); 988 "URL tag > ULONG_MAX\n");
986 return GNUNET_SYSERR; 989 return GNUNET_SYSERR;
987 } 990 }
988 if (rc > UINT32_MAX) 991 if (rc > UINT32_MAX)
989 { 992 {
990 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 993 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
994 plugin->name,
991 "URL tag > UINT32_MAX\n"); 995 "URL tag > UINT32_MAX\n");
992 return GNUNET_SYSERR; 996 return GNUNET_SYSERR;
993 } 997 }
994 (*tag) = (uint32_t)rc; 998 (*tag) = (uint32_t)rc;
995 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 999 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
996 "Found tag `%u' in url\n", *tag); 1000 plugin->name,
1001 "Found tag `%u' in url\n",
1002 *tag);
997 1003
998 /* convert peer id */ 1004 /* convert peer id */
999 hash_length = matches[1].rm_eo - matches[1].rm_so; 1005 hash_length = matches[1].rm_eo - matches[1].rm_so;
1000 if (hash_length != plugin->peer_id_length) 1006 if (hash_length != plugin->peer_id_length)
1001 { 1007 {
1002 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1008 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
1009 plugin->name,
1003 "URL target is %u bytes, expecting %u\n", 1010 "URL target is %u bytes, expecting %u\n",
1004 hash_length, plugin->peer_id_length); 1011 hash_length, plugin->peer_id_length);
1005 return GNUNET_SYSERR; 1012 return GNUNET_SYSERR;