diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-02-26 23:43:32 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-02-26 23:43:32 +0100 |
commit | 502c9a0fc36bf8ee81e294827c7403519e174249 (patch) | |
tree | 5d8d2b4fae22181feb8018f6339f243669895958 | |
parent | c520b0b86ffc128a982cee42d947e321b34de8a8 (diff) |
more precise logging
-rw-r--r-- | src/exchange/taler-exchange-httpd.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index 5374dbd5e..051fb9696 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -358,6 +358,7 @@ proceed_with_handler (const struct TEH_RequestHandler *rh, if (rh->nargs > 0) { unsigned int i; + const char *fin; /* make a copy of 'url' because 'strtok()' will modify */ memcpy (d, @@ -372,13 +373,24 @@ proceed_with_handler (const struct TEH_RequestHandler *rh, that there is no excess data in 'd' afterwards */ if ( (i != rh->nargs) || (NULL == args[i - 1]) || - (NULL != strtok (NULL, "/")) ) + (NULL != (fin = strtok (NULL, "/"))) ) { + char emsg[128 + 512]; + + GNUNET_snprintf (emsg, + sizeof (emsg), + "Got %u/%u segments for %s request ('%s')", + (NULL == args[i - 1]) + ? i - 1 + : i + ((NULL != fin) ? 1 : 0), + rh->nargs, + rh->url, + url); GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, TALER_EC_WRONG_NUMBER_OF_SEGMENTS, - "Number of segments does not match"); + emsg); } } @@ -471,7 +483,7 @@ handle_mhd_request (void *cls, }, /* Return key material and fundamental properties for this exchange */ { - .url = "/keys", + .url = "keys", .method = MHD_HTTP_METHOD_GET, .handler.get = &TEH_KS_handler_keys, }, @@ -590,10 +602,15 @@ handle_mhd_request (void *cls, if (NULL != ecls->rh) { int ret; + const char *start; + if ('\0' == url[0]) + /* strange, should start with '/', treat as just "/" */ + url = "/"; + start = strchr (url + 1, '/'); ret = proceed_with_handler (ecls->rh, connection, - url, + start, inner_cls, upload_data, upload_data_size); @@ -619,7 +636,7 @@ handle_mhd_request (void *cls, rest = strchr (tok, '/'); if (NULL == rest) { - tok_size = 0; + tok_size = strlen (tok); } else { |