summaryrefslogtreecommitdiff
path: root/src/twister/taler-twister.c
diff options
context:
space:
mode:
authorJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-07-13 00:20:58 -0400
committerJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-07-13 00:20:58 -0400
commit9efab5f6c36567bbd8645e65cb0d7f5c75e6b329 (patch)
tree2557b82de11b36dde94573edb801fd782d9b606d /src/twister/taler-twister.c
parent41d519ef309539aa7e3116195ce87727c87322ff (diff)
downloadtwister-9efab5f6c36567bbd8645e65cb0d7f5c75e6b329.tar.gz
twister-9efab5f6c36567bbd8645e65cb0d7f5c75e6b329.tar.bz2
twister-9efab5f6c36567bbd8645e65cb0d7f5c75e6b329.zip
twister can now modify headers in http responses
Diffstat (limited to 'src/twister/taler-twister.c')
-rw-r--r--src/twister/taler-twister.c51
1 files changed, 42 insertions, 9 deletions
diff --git a/src/twister/taler-twister.c b/src/twister/taler-twister.c
index c59cae2..94a9aa8 100644
--- a/src/twister/taler-twister.c
+++ b/src/twister/taler-twister.c
@@ -86,6 +86,11 @@ static char *modify_path_dl;
static char *modify_path_ul;
/**
+ * Name of the header to modify in the HTTP request.
+ */
+static char *modify_header_dl;
+
+/**
* New value for the object pointed by `modify_path_(ul|dl)`.
*/
static char *modify_value;
@@ -151,7 +156,7 @@ run (void *cls,
{
tth = TALER_TWISTER_connect (cfg);
GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
- NULL);
+ NULL);
if (NULL == tth)
{
GNUNET_break (0);
@@ -172,7 +177,6 @@ run (void *cls,
&handle_acknowledgement,
NULL)))
num_ops++;
-
if (0 != check_alive)
{
@@ -250,6 +254,25 @@ run (void *cls,
num_ops++;
}
+ if (NULL != modify_header_dl)
+ {
+ if (NULL == modify_value)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "New value not given, give -V|--value also\n");
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+
+ if (NULL != TALER_TWISTER_modify_header_dl
+ (tth,
+ modify_header_dl,
+ modify_value,
+ &handle_acknowledgement,
+ NULL))
+ num_ops++;
+ }
+
if (0 == num_ops)
{
fprintf (stderr, "No valid hacks specified!\n");
@@ -291,6 +314,15 @@ main (int argc,
&modify_path_dl),
GNUNET_GETOPT_option_string
+ ('H',
+ "modify-header-dl",
+ "HEADER",
+ gettext_noop
+ ("Modify download HTTP header HEADER,"
+ " require --value.\n"),
+ &modify_header_dl),
+
+ GNUNET_GETOPT_option_string
('F',
"flip-ul",
"PATH",
@@ -360,13 +392,14 @@ main (int argc,
status = 1;
if (GNUNET_OK !=
- GNUNET_PROGRAM_run (argc,
- argv,
- "taler-twister",
- gettext_noop
- ("Control taler-twister service."),
- options,
- &run, NULL))
+ GNUNET_PROGRAM_run (
+ argc,
+ argv,
+ "taler-twister",
+ gettext_noop
+ ("Control taler-twister service."),
+ options,
+ &run, NULL))
return 2;
return status;
}