aboutsummaryrefslogtreecommitdiff
path: root/src/mint/taler-mint-httpd_responses.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mint/taler-mint-httpd_responses.c')
-rw-r--r--src/mint/taler-mint-httpd_responses.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/mint/taler-mint-httpd_responses.c b/src/mint/taler-mint-httpd_responses.c
index 8f886c3d9..bad4991da 100644
--- a/src/mint/taler-mint-httpd_responses.c
+++ b/src/mint/taler-mint-httpd_responses.c
@@ -138,6 +138,71 @@ TALER_MINT_reply_arg_missing (struct MHD_Connection *connection,
138} 138}
139 139
140 140
141/**
142 * Send a response indicating an internal error.
143 *
144 * @param connection the MHD connection to use
145 * @param hint hint about the internal error's nature
146 * @return a MHD result code
147 */
148int
149TALER_MINT_reply_internal_error (struct MHD_Connection *connection,
150 const char *hint)
151{
152 json_t *json;
153
154 json = json_pack ("{ s:s, s:s }",
155 "error",
156 "internal error",
157 "hint",
158 hint);
159 return TALER_MINT_reply_json (connection,
160 json,
161 MHD_HTTP_BAD_REQUEST);
162}
163
164
165/**
166 * Send a response indicating that the request was too big.
167 *
168 * @param connection the MHD connection to use
169 * @return a MHD result code
170 */
171int
172TALER_MINT_reply_request_too_large (struct MHD_Connection *connection)
173{
174 struct MHD_Response *resp;
175 int ret;
176
177 resp = MHD_create_response_from_buffer (0,
178 NULL,
179 MHD_RESPMEM_PERSISTENT);
180 if (NULL == resp)
181 return MHD_NO;
182 ret = MHD_queue_response (connection,
183 MHD_HTTP_REQUEST_ENTITY_TOO_LARGE,
184 resp);
185 MHD_destroy_response (resp);
186 return ret;
187}
188
189
190/**
191 * Send a response indicating that the JSON was malformed.
192 *
193 * @param connection the MHD connection to use
194 * @return a MHD result code
195 */
196int
197TALER_MINT_reply_invalid_json (struct MHD_Connection *connection)
198{
199 return TALER_MINT_reply_json_pack (connection,
200 MHD_HTTP_BAD_REQUEST,
201 "{s:s}",
202 "error",
203 "invalid json");
204}
205
141 206
142 207
143 208