LibWeb: Include the Content-Type boundary directive in form submissions

The spec requires that "multipart/form-data" Content-Type headers also
include a boundary directive. This allows the content server to validate
the submitted form data.

Google Lens, for example, rejects forms missing this directive.
This commit is contained in:
Timothy Flynn 2024-08-21 15:18:28 -04:00 committed by Andreas Kling
commit b16b9709b9
Notes: github-actions[bot] 2024-08-22 12:22:09 +00:00
3 changed files with 27 additions and 6 deletions

View file

@ -7,6 +7,9 @@
#pragma once
#include <AK/ByteBuffer.h>
#include <AK/String.h>
#include <AK/StringView.h>
#include <AK/Vector.h>
namespace Web::HTML {
@ -26,6 +29,12 @@ struct POSTResource {
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#post-resource-request-content-type
// A request content-type, which is `application/x-www-form-urlencoded`, `multipart/form-data`, or `text/plain`.
RequestContentType request_content_type {};
struct Directive {
StringView type;
String value;
};
Vector<Directive> request_content_type_directives {};
};
}