mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
25 lines
580 B
C++
25 lines
580 B
C++
|
|
#include <LibCore/CHttpJob.h>
|
||
|
|
#include <LibCore/CHttpRequest.h>
|
||
|
|
#include <ProtocolServer/HttpDownload.h>
|
||
|
|
#include <ProtocolServer/HttpProtocol.h>
|
||
|
|
|
||
|
|
HttpProtocol::HttpProtocol()
|
||
|
|
: Protocol("http")
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
HttpProtocol::~HttpProtocol()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
RefPtr<Download> HttpProtocol::start_download(PSClientConnection& client, const URL& url)
|
||
|
|
{
|
||
|
|
CHttpRequest request;
|
||
|
|
request.set_method(CHttpRequest::Method::GET);
|
||
|
|
request.set_url(url);
|
||
|
|
auto job = request.schedule();
|
||
|
|
if (!job)
|
||
|
|
return nullptr;
|
||
|
|
return HttpDownload::create_with_job({}, client, (CHttpJob&)*job);
|
||
|
|
}
|