From 09909c0a3b326efd6a2b87df95d0e73c1e394c29 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Sat, 9 Sep 2023 00:19:39 +0200 Subject: http: Allow multiple non-file Content-Disposition Now, slweb accepts requests such as: --boundary Content-Disposition: form-data; name="field1" value1 --boundary Content-Disposition: form-data; name="field2" value2 --boundary Content-Disposition: form-data; name="field3"; filename="example.txt" The following breaking changes have been introduced: Member "dir" from struct http_post was a leftover from the days where slcl and slweb were one project. It did not make sense for slweb, since it should not decide which Content-Disposition names are allowed. In other words, "dir" was only relevant in the scope of slcl. Member "n" from struct http_post used to have two meanings: - The length of a URL-encoded request. - The number of files on a multipart/form-data request. Since "npairs" had to be introduced to struct http_post, it did not make sense to keep this dual meaning any more. Therefore, "n" has been restricted to the former, whereas a new member, called "nfiles", has been introduced for the latter. --- include/slweb/http.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/slweb/http.h b/include/slweb/http.h index ac1f51a..db2c0b6 100644 --- a/include/slweb/http.h +++ b/include/slweb/http.h @@ -26,8 +26,12 @@ struct http_payload { bool expect_continue; const void *data; - size_t n; - const char *dir; + size_t n, nfiles, npairs; + + const struct http_post_pair + { + const char *name, *value; + } *pairs; const struct http_post_file { -- cgit v1.2.3