mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:38:11 +00:00
LibCore: Move HTTP classes from LibGUI to LibCore.
This commit is contained in:
parent
cfd6e6cc36
commit
ab1c84cf53
15 changed files with 92 additions and 93 deletions
|
@ -1,45 +0,0 @@
|
|||
#include <LibGUI/GHttpRequest.h>
|
||||
#include <LibGUI/GHttpJob.h>
|
||||
#include <LibGUI/GEventLoop.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
|
||||
GHttpRequest::GHttpRequest()
|
||||
{
|
||||
}
|
||||
|
||||
GHttpRequest::~GHttpRequest()
|
||||
{
|
||||
}
|
||||
|
||||
GNetworkJob* GHttpRequest::schedule()
|
||||
{
|
||||
auto* job = new GHttpJob(*this);
|
||||
job->start();
|
||||
return job;
|
||||
}
|
||||
|
||||
String GHttpRequest::method_name() const
|
||||
{
|
||||
switch (m_method) {
|
||||
case Method::GET:
|
||||
return "GET";
|
||||
case Method::HEAD:
|
||||
return "HEAD";
|
||||
case Method::POST:
|
||||
return "POST";
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
ByteBuffer GHttpRequest::to_raw_request() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append(method_name());
|
||||
builder.append(' ');
|
||||
builder.append(m_path);
|
||||
builder.append(" HTTP/1.0\nHost: ");
|
||||
builder.append(m_hostname);
|
||||
builder.append("\n\n");
|
||||
return builder.to_byte_buffer();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue