2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_SRC_SERVERS_HTTP1SERVER_H
10 #define SQUID_SRC_SERVERS_HTTP1SERVER_H
12 #include "servers/forward.h"
19 /// Manages a connection from an HTTP/1 or HTTP/0.9 client.
20 class Server
: public ConnStateData
25 Server(const MasterXaction::Pointer
&xact
, const bool beHttpsServer
);
28 void readSomeHttpData();
31 /* ConnStateData API */
32 Http::Stream
*parseOneRequest() override
;
33 void processParsedRequest(Http::StreamPointer
&context
) override
;
34 void handleReply(HttpReply
*rep
, StoreIOBuffer receivedData
) override
;
35 bool writeControlMsgAndCall(HttpReply
*rep
, AsyncCall::Pointer
&call
) override
;
36 int pipelinePrefetchMax() const override
;
37 time_t idleTimeout() const override
;
38 void noteTakeServerConnectionControl(ServerConnectionContext
) override
;
41 void noteMoreBodySpaceAvailable(BodyPipe::Pointer
) override
;
42 void noteBodyConsumerAborted(BodyPipe::Pointer
) override
;
45 void start() override
;
47 void proceedAfterBodyContinuation(Http::StreamPointer context
);
50 void processHttpRequest(Http::Stream
*const context
);
51 void handleHttpRequestData();
53 /// Handles parsing results. May generate and deliver an error reply
54 /// to the client if parsing is failed, or parses the url and build the
55 /// HttpRequest object using parsing results.
56 /// Return false if parsing is failed, true otherwise.
57 bool buildHttpRequest(Http::StreamPointer
&context
);
59 void setReplyError(Http::StreamPointer
&context
, HttpRequest::Pointer
&request
, err_type requestError
, Http::StatusCode errStatusCode
, const char *requestErrorBytes
);
61 Http1::RequestParserPointer parser_
;
62 HttpRequestMethod method_
; ///< parsed HTTP method
64 /// temporary hack to avoid creating a true HttpsServer class
65 const bool isHttpsServer
;
71 #endif /* SQUID_SRC_SERVERS_HTTP1SERVER_H */