summaryrefslogtreecommitdiff
path: root/src/twister/twister_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/twister/twister_api.c')
-rw-r--r--src/twister/twister_api.c54
1 files changed, 53 insertions, 1 deletions
diff --git a/src/twister/twister_api.c b/src/twister/twister_api.c
index 7087d62..8bb215b 100644
--- a/src/twister/twister_api.c
+++ b/src/twister/twister_api.c
@@ -380,7 +380,7 @@ TALER_TWISTER_flip_upload
GNUNET_break (0);
return NULL;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Will UL-flip: %s\n",
path);
@@ -555,6 +555,58 @@ TALER_TWISTER_modify_path_ul (struct TALER_TWISTER_Handle *h,
return op;
}
+
+/**
+ * Change the HTTP response header of @a header to @a value.
+ *
+ * @param h twister instance to control
+ * @param header the HTTP response header to modify
+ * @param value value to use for @a header
+ * @param cb callback to call once twister gets this instruction.
+ * @param cb_cls closure for @a cb_callback
+ *
+ * @return operation handle.
+ */
+struct TALER_TWISTER_Operation *
+TALER_TWISTER_modify_header_dl (struct TALER_TWISTER_Handle *h,
+ const char *header,
+ const char *value,
+ GNUNET_SCHEDULER_TaskCallback cb,
+ void *cb_cls)
+{
+ struct TALER_TWISTER_Operation *op;
+ struct GNUNET_MQ_Envelope *env;
+ struct TWISTER_ModifyPath *src;
+ uint16_t stralloc;
+
+ stralloc = strlen (header) + strlen (value) + 2;
+ if (sizeof (*src) + stralloc > UINT16_MAX)
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+ op = GNUNET_new (struct TALER_TWISTER_Operation);
+ op->h = h;
+ op->cb = cb;
+ op->cb_cls = cb_cls;
+ GNUNET_CONTAINER_DLL_insert_tail (h->op_head,
+ h->op_tail,
+ op);
+ env = GNUNET_MQ_msg_extra (src,
+ stralloc,
+ TWISTER_MESSAGE_TYPE_MODIFY_HEADER_DL);
+
+ GNUNET_assert
+ (stralloc == GNUNET_STRINGS_buffer_fill ((char *) &src[1],
+ stralloc,
+ 2,
+ header,
+ value));
+ GNUNET_MQ_send (h->mq, env);
+ return op;
+}
+
+
/**
* Change the next response code to @a new_rc.
*