[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-twister] 02/02: check Content-Type before parsing
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-twister] 02/02: check Content-Type before parsing |
Date: |
Wed, 12 Jun 2019 22:16:47 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository twister.
commit 5edfaa88e348dca84658fbdd2f9cc526c4310fe8
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Jun 12 22:16:36 2019 +0200
check Content-Type before parsing
---
src/twister/taler-twister-service.c | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/src/twister/taler-twister-service.c
b/src/twister/taler-twister-service.c
index 0fe47a6..66b298e 100644
--- a/src/twister/taler-twister-service.c
+++ b/src/twister/taler-twister-service.c
@@ -1519,22 +1519,31 @@ create_response (void *cls,
(con,
MHD_HEADER_KIND,
MHD_HTTP_HEADER_CONTENT_ENCODING);
+
if ((NULL != ce) && (0 == strcmp ("deflate", ce)))
GNUNET_assert (Z_OK == inflate_data (hr));
- json_error_t error;
- hr->json = json_loadb (hr->io_buf,
- hr->io_len,
- JSON_DECODE_ANY,
- &error);
- if (NULL == hr->json)
+ ce = MHD_lookup_connection_value
+ (con,
+ MHD_HEADER_KIND,
+ MHD_HTTP_HEADER_CONTENT_TYPE);
+
+ if ((NULL != ce) && (0 == strcmp ("application/json", ce)))
{
- TALER_LOG_ERROR
- ("Could not parse JSON from client: %s (%s)\n",
- error.text,
- error.source);
- /* Quick and dirty. */
- return MHD_NO;
+ json_error_t error;
+ hr->json = json_loadb (hr->io_buf,
+ hr->io_len,
+ JSON_DECODE_ANY,
+ &error);
+ if (NULL == hr->json)
+ {
+ TALER_LOG_ERROR
+ ("Could not parse JSON from client: %s (%s)\n",
+ error.text,
+ error.source);
+ /* Quick and dirty. */
+ return MHD_NO;
+ }
}
}
}
--
To stop receiving notification emails like this one, please contact
address@hidden.