]> git.ipfire.org Git - thirdparty/squid.git/blob - src/servers/Http1Server.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / servers / Http1Server.h
1 /*
2 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #ifndef SQUID_SRC_SERVERS_HTTP1SERVER_H
10 #define SQUID_SRC_SERVERS_HTTP1SERVER_H
11
12 #include "servers/forward.h"
13
14 namespace Http
15 {
16 namespace One
17 {
18
19 /// Manages a connection from an HTTP/1 or HTTP/0.9 client.
20 class Server: public ConnStateData
21 {
22 CBDATA_CLASS(Server);
23
24 public:
25 Server(const MasterXaction::Pointer &xact, const bool beHttpsServer);
26 virtual ~Server() {}
27
28 void readSomeHttpData();
29
30 protected:
31 /* ConnStateData API */
32 virtual ClientSocketContext *parseOneRequest();
33 virtual void processParsedRequest(ClientSocketContext *context);
34 virtual void handleReply(HttpReply *rep, StoreIOBuffer receivedData);
35 virtual void writeControlMsgAndCall(HttpReply *rep, AsyncCall::Pointer &call);
36 virtual time_t idleTimeout() const;
37
38 /* BodyPipe API */
39 virtual void noteMoreBodySpaceAvailable(BodyPipe::Pointer);
40 virtual void noteBodyConsumerAborted(BodyPipe::Pointer);
41
42 /* AsyncJob API */
43 virtual void start();
44
45 void proceedAfterBodyContinuation(ClientSocketContext::Pointer context);
46
47 private:
48 void processHttpRequest(ClientSocketContext *const context);
49 void handleHttpRequestData();
50
51 /// Handles parsing results. May generate and deliver an error reply
52 /// to the client if parsing is failed, or parses the url and build the
53 /// HttpRequest object using parsing results.
54 /// Return false if parsing is failed, true otherwise.
55 bool buildHttpRequest(ClientSocketContext *context);
56
57 Http1::RequestParserPointer parser_;
58 HttpRequestMethod method_; ///< parsed HTTP method
59
60 /// temporary hack to avoid creating a true HttpsServer class
61 const bool isHttpsServer;
62 };
63
64 } // namespace One
65 } // namespace Http
66
67 #endif /* SQUID_SRC_SERVERS_HTTP1SERVER_H */
68