mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:48:11 +00:00
ProtocolServer+LibWeb: Support more detailed HTTP requests
This patch adds the ability for ProtocolServer clients to specify which HTTP method to use, and also to include an optional HTTP request body.
This commit is contained in:
parent
cfafd4d52d
commit
2946a684ef
21 changed files with 78 additions and 26 deletions
|
@ -139,17 +139,15 @@ RefPtr<DOM::Document> FrameLoader::create_document_from_mime_type(const ByteBuff
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
bool FrameLoader::load(const URL& url, Type type)
|
||||
bool FrameLoader::load(const LoadRequest& request, Type type)
|
||||
{
|
||||
dbg() << "FrameLoader::load: " << url;
|
||||
|
||||
if (!url.is_valid()) {
|
||||
load_error_page(url, "Invalid URL");
|
||||
if (!request.is_valid()) {
|
||||
load_error_page(request.url(), "Invalid request");
|
||||
return false;
|
||||
}
|
||||
|
||||
LoadRequest request;
|
||||
request.set_url(url);
|
||||
auto& url = request.url();
|
||||
|
||||
set_resource(ResourceLoader::the().load_resource(Resource::Type::Generic, request));
|
||||
|
||||
if (type == Type::Navigation)
|
||||
|
@ -180,6 +178,21 @@ bool FrameLoader::load(const URL& url, Type type)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool FrameLoader::load(const URL& url, Type type)
|
||||
{
|
||||
dbg() << "FrameLoader::load: " << url;
|
||||
|
||||
if (!url.is_valid()) {
|
||||
load_error_page(url, "Invalid URL");
|
||||
return false;
|
||||
}
|
||||
|
||||
LoadRequest request;
|
||||
request.set_url(url);
|
||||
|
||||
return load(request, type);
|
||||
}
|
||||
|
||||
void FrameLoader::load_error_page(const URL& failed_url, const String& error)
|
||||
{
|
||||
auto error_page_url = "file:///res/html/error.html";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue