summaryrefslogtreecommitdiffstats
path: root/src/tests/uri_test.c
diff options
context:
space:
mode:
authorMichael Brown2023-02-28 18:46:13 +0100
committerMichael Brown2023-03-01 13:20:02 +0100
commit96bb6ba441653a30729ade38dc6c23bc9e2d2339 (patch)
tree9a1023d23aabdb096ac7a3d0df5554fbf40d73f7 /src/tests/uri_test.c
parent[params] Rename "form parameter" to "request parameter" (diff)
downloadipxe-96bb6ba441653a30729ade38dc6c23bc9e2d2339.tar.gz
ipxe-96bb6ba441653a30729ade38dc6c23bc9e2d2339.tar.xz
ipxe-96bb6ba441653a30729ade38dc6c23bc9e2d2339.zip
[params] Allow for arbitrary HTTP request headers to be specified
Extend the request parameter mechanism to allow for arbitrary HTTP headers to be specified via e.g.: params param --header Referer http://www.example.com imgfetch http://192.168.0.1/script.ipxe##params Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/tests/uri_test.c')
-rw-r--r--src/tests/uri_test.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/tests/uri_test.c b/src/tests/uri_test.c
index 5e706032..9d2f6dba 100644
--- a/src/tests/uri_test.c
+++ b/src/tests/uri_test.c
@@ -98,6 +98,8 @@ struct uri_params_test_list {
const char *key;
/** Value */
const char *value;
+ /** Flags */
+ unsigned int flags;
};
/** A request parameter URI test */
@@ -428,6 +430,7 @@ static void uri_params_list_okx ( struct uri_params_test *test,
file, line );
okx ( strcmp ( param->value, list->value ) == 0,
file, line );
+ okx ( param->flags == list->flags, file, line );
list++;
}
okx ( list->key == NULL, file, line );
@@ -456,7 +459,8 @@ static void uri_params_okx ( struct uri_params_test *test, const char *file,
okx ( params != NULL, file, line );
if ( params ) {
for ( list = test->list ; list->key ; list++ ) {
- param = add_parameter ( params, list->key, list->value);
+ param = add_parameter ( params, list->key, list->value,
+ list->flags );
okx ( param != NULL, file, line );
}
}
@@ -884,18 +888,22 @@ static struct uri_params_test_list uri_params_list[] = {
{
"vendor",
"10ec",
+ PARAMETER_FORM,
},
{
"device",
"8139",
+ PARAMETER_FORM,
},
{
"uuid",
"f59fac00-758f-498f-9fe5-87d790045d94",
+ PARAMETER_HEADER,
},
{
NULL,
NULL,
+ 0,
}
};
@@ -917,14 +925,17 @@ static struct uri_params_test_list uri_named_params_list[] = {
{
"mac",
"00:1e:65:80:d3:b6",
+ PARAMETER_FORM,
},
{
"serial",
"LXTQ20Z1139322762F2000",
+ PARAMETER_FORM,
},
{
NULL,
NULL,
+ 0,
}
};