blob: e30e836b6651a784f20ab7debe3636067e9149dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
};
|