2 * Copyright (C) 1996-2018 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 virtual Http::Stream
*parseOneRequest();
33 virtual void processParsedRequest(Http::StreamPointer
&context
);
34 virtual void handleReply(HttpReply
*rep
, StoreIOBuffer receivedData
);
35 virtual bool writeControlMsgAndCall(HttpReply
*rep
, AsyncCall::Pointer
&call
);
36 virtual time_t idleTimeout() const;
39 virtual void noteMoreBodySpaceAvailable(BodyPipe::Pointer
);
40 virtual void noteBodyConsumerAborted(BodyPipe::Pointer
);
45 void proceedAfterBodyContinuation(Http::StreamPointer context
);
48 void processHttpRequest(Http::Stream
*const context
);
49 void handleHttpRequestData();
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(Http::StreamPointer
&context
);
57 void setReplyError(Http::StreamPointer
&context
, HttpRequest::Pointer
&request
, const HttpRequestMethod
& method
, err_type requestError
, Http::StatusCode errStatusCode
, const char *requestErrorBytes
);
59 Http1::RequestParserPointer parser_
;
60 HttpRequestMethod method_
; ///< parsed HTTP method
62 /// temporary hack to avoid creating a true HttpsServer class
63 const bool isHttpsServer
;
69 #endif /* SQUID_SRC_SERVERS_HTTP1SERVER_H */