mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:47:34 +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
33
LibCore/CHttpJob.h
Normal file
33
LibCore/CHttpJob.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibCore/CNetworkJob.h>
|
||||
#include <LibCore/CHttpRequest.h>
|
||||
#include <AK/HashMap.h>
|
||||
|
||||
class CTCPSocket;
|
||||
|
||||
class CHttpJob final : public CNetworkJob {
|
||||
public:
|
||||
explicit CHttpJob(const CHttpRequest&);
|
||||
virtual ~CHttpJob() override;
|
||||
|
||||
virtual void start() override;
|
||||
|
||||
virtual const char* class_name() const override { return "CHttpJob"; }
|
||||
|
||||
private:
|
||||
void on_socket_connected();
|
||||
|
||||
enum class State {
|
||||
InStatus,
|
||||
InHeaders,
|
||||
InBody,
|
||||
Finished,
|
||||
};
|
||||
|
||||
CHttpRequest m_request;
|
||||
CTCPSocket* m_socket { nullptr };
|
||||
State m_state { State::InStatus };
|
||||
int m_code { -1 };
|
||||
HashMap<String, String> m_headers;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue