aboutsummaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_link.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchange/taler-exchange-httpd_link.c')
-rw-r--r--src/exchange/taler-exchange-httpd_link.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/src/exchange/taler-exchange-httpd_link.c b/src/exchange/taler-exchange-httpd_link.c
index a39e58641..bbb027522 100644
--- a/src/exchange/taler-exchange-httpd_link.c
+++ b/src/exchange/taler-exchange-httpd_link.c
@@ -169,23 +169,13 @@ link_transaction (void *cls,
169} 169}
170 170
171 171
172/**
173 * Handle a "/coins/$COIN_PUB/link" request.
174 *
175 * @param rh context of the handler
176 * @param connection the MHD connection to handle
177 * @param args array of additional options (length: 2, first is the coin_pub, second must be "link")
178 * @return MHD result code
179 */
180MHD_RESULT 172MHD_RESULT
181TEH_handler_link (const struct TEH_RequestHandler *rh, 173TEH_handler_link (struct TEH_RequestContext *rc,
182 struct MHD_Connection *connection,
183 const char *const args[2]) 174 const char *const args[2])
184{ 175{
185 struct HTD_Context ctx; 176 struct HTD_Context ctx;
186 MHD_RESULT mhd_ret; 177 MHD_RESULT mhd_ret;
187 178
188 (void) rh;
189 memset (&ctx, 179 memset (&ctx,
190 0, 180 0,
191 sizeof (ctx)); 181 sizeof (ctx));
@@ -196,22 +186,15 @@ TEH_handler_link (const struct TEH_RequestHandler *rh,
196 sizeof (ctx.coin_pub))) 186 sizeof (ctx.coin_pub)))
197 { 187 {
198 GNUNET_break_op (0); 188 GNUNET_break_op (0);
199 return TALER_MHD_reply_with_error (connection, 189 return TALER_MHD_reply_with_error (rc->connection,
200 MHD_HTTP_BAD_REQUEST, 190 MHD_HTTP_BAD_REQUEST,
201 TALER_EC_EXCHANGE_GENERIC_COINS_INVALID_COIN_PUB, 191 TALER_EC_EXCHANGE_GENERIC_COINS_INVALID_COIN_PUB,
202 args[0]); 192 args[0]);
203 } 193 }
204 ctx.mlist = json_array (); 194 ctx.mlist = json_array ();
205 if (NULL == ctx.mlist) 195 GNUNET_assert (NULL != ctx.mlist);
206 {
207 GNUNET_break (0);
208 return TALER_MHD_reply_with_error (connection,
209 MHD_HTTP_INTERNAL_SERVER_ERROR,
210 TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE,
211 "json_array() call failed");
212 }
213 if (GNUNET_OK != 196 if (GNUNET_OK !=
214 TEH_DB_run_transaction (connection, 197 TEH_DB_run_transaction (rc->connection,
215 "run link", 198 "run link",
216 &mhd_ret, 199 &mhd_ret,
217 &link_transaction, 200 &link_transaction,
@@ -221,7 +204,7 @@ TEH_handler_link (const struct TEH_RequestHandler *rh,
221 json_decref (ctx.mlist); 204 json_decref (ctx.mlist);
222 return mhd_ret; 205 return mhd_ret;
223 } 206 }
224 mhd_ret = TALER_MHD_reply_json (connection, 207 mhd_ret = TALER_MHD_reply_json (rc->connection,
225 ctx.mlist, 208 ctx.mlist,
226 MHD_HTTP_OK); 209 MHD_HTTP_OK);
227 json_decref (ctx.mlist); 210 json_decref (ctx.mlist);