mirror of
https://github.com/RGBCube/serenity
synced 2026-01-17 10:31:05 +00:00
31 lines
675 B
C++
31 lines
675 B
C++
#pragma once
|
|
|
|
#include <LibGUI/GNetworkJob.h>
|
|
#include <LibGUI/GHttpRequest.h>
|
|
#include <AK/HashMap.h>
|
|
|
|
class GTCPSocket;
|
|
|
|
class GHttpNetworkJob final : public GNetworkJob {
|
|
public:
|
|
explicit GHttpNetworkJob(const GHttpRequest&);
|
|
virtual ~GHttpNetworkJob() override;
|
|
|
|
virtual void start() override;
|
|
|
|
virtual const char* class_name() const override { return "GHttpNetworkJob"; }
|
|
|
|
private:
|
|
enum class State {
|
|
InStatus,
|
|
InHeaders,
|
|
InBody,
|
|
Finished,
|
|
};
|
|
|
|
GHttpRequest m_request;
|
|
GTCPSocket* m_socket { nullptr };
|
|
State m_state { State::InStatus };
|
|
int m_code { -1 };
|
|
HashMap<String, String> m_headers;
|
|
};
|