2 * Copyright (C) 1996-2023 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 "client_side.h"
13 #include "http/one/RequestParser.h"
14 #include "http/Stream.h"
15 #include "servers/forward.h"
22 /// Manages a connection from an HTTP/1 or HTTP/0.9 client.
23 class Server
: public ConnStateData
28 Server(const MasterXaction::Pointer
&xact
, const bool beHttpsServer
);
31 void readSomeHttpData();
34 /* ConnStateData API */
35 Http::Stream
*parseOneRequest() override
;
36 void processParsedRequest(Http::StreamPointer
&context
) override
;
37 void handleReply(HttpReply
*rep
, StoreIOBuffer receivedData
) override
;
38 bool writeControlMsgAndCall(HttpReply
*rep
, AsyncCall::Pointer
&call
) override
;
39 int pipelinePrefetchMax() const override
;
40 time_t idleTimeout() const override
;
41 void noteTakeServerConnectionControl(ServerConnectionContext
) override
;
44 void noteMoreBodySpaceAvailable(BodyPipe::Pointer
) override
;
45 void noteBodyConsumerAborted(BodyPipe::Pointer
) override
;
48 void start() override
;
50 void proceedAfterBodyContinuation(Http::StreamPointer context
);
53 void processHttpRequest(Http::Stream
*const context
);
54 void handleHttpRequestData();
56 /// Handles parsing results. May generate and deliver an error reply
57 /// to the client if parsing is failed, or parses the url and build the
58 /// HttpRequest object using parsing results.
59 /// Return false if parsing is failed, true otherwise.
60 bool buildHttpRequest(Http::StreamPointer
&context
);
62 void setReplyError(Http::StreamPointer
&context
, HttpRequest::Pointer
&request
, err_type requestError
, Http::StatusCode errStatusCode
, const char *requestErrorBytes
);
64 Http1::RequestParserPointer parser_
;
65 HttpRequestMethod method_
; ///< parsed HTTP method
67 /// temporary hack to avoid creating a true HttpsServer class
68 const bool isHttpsServer
;
74 #endif /* SQUID_SRC_SERVERS_HTTP1SERVER_H */