Http1Server.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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 "client_side.h"
13 #include "http/one/RequestParser.h"
14 #include "http/Stream.h"
15 #include "servers/forward.h"
16 
17 namespace Http
18 {
19 namespace One
20 {
21 
23 class Server: public ConnStateData
24 {
26 
27 public:
28  Server(const MasterXaction::Pointer &xact, const bool beHttpsServer);
29  ~Server() override {}
30 
31  void readSomeHttpData();
32 
33 protected:
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;
42 
43  /* BodyPipe API */
46 
47  /* AsyncJob API */
48  void start() override;
49 
51 
52 private:
53  void processHttpRequest(Http::Stream *const context);
54  void handleHttpRequestData();
55 
61 
62  void setReplyError(Http::StreamPointer &context, HttpRequest::Pointer &request, err_type requestError, Http::StatusCode errStatusCode, const char *requestErrorBytes);
63 
66 
68  const bool isHttpsServer;
69 };
70 
71 } // namespace One
72 } // namespace Http
73 
74 #endif /* SQUID_SRC_SERVERS_HTTP1SERVER_H */
75 
void setReplyError(Http::StreamPointer &context, HttpRequest::Pointer &request, err_type requestError, Http::StatusCode errStatusCode, const char *requestErrorBytes)
Definition: Http1Server.cc:204
Http::Stream * parseOneRequest() override
Definition: Http1Server.cc:74
void handleHttpRequestData()
Server(const MasterXaction::Pointer &xact, const bool beHttpsServer)
Definition: Http1Server.cc:28
void processParsedRequest(Http::StreamPointer &context) override
start processing a freshly parsed request
Definition: Http1Server.cc:241
~Server() override
Definition: Http1Server.h:29
void noteMoreBodySpaceAvailable(BodyPipe::Pointer) override
Definition: Http1Server.cc:61
StatusCode
Definition: StatusCode.h:20
err_type
Definition: forward.h:14
Definition: forward.h:17
void noteTakeServerConnectionControl(ServerConnectionContext) override
Definition: Http1Server.cc:376
time_t idleTimeout() const override
timeout to use when waiting for the next request
Definition: Http1Server.cc:36
void handleReply(HttpReply *rep, StoreIOBuffer receivedData) override
Definition: Http1Server.cc:296
HttpRequestMethod method_
parsed HTTP method
Definition: Http1Server.h:65
const bool isHttpsServer
temporary hack to avoid creating a true HttpsServer class
Definition: Http1Server.h:68
void noteBodyConsumerAborted(BodyPipe::Pointer) override
Definition: Http1Server.cc:289
int pipelinePrefetchMax() const override
returning N allows a pipeline of 1+N requests (see pipeline_prefetch)
Definition: Http1Server.cc:230
void start() override
called by AsyncStart; do not call directly
Definition: Http1Server.cc:42
bool writeControlMsgAndCall(HttpReply *rep, AsyncCall::Pointer &call) override
handle a control message received by context from a peer and call back
Definition: Http1Server.cc:328
bool buildHttpRequest(Http::StreamPointer &context)
Definition: Http1Server.cc:95
Http1::RequestParserPointer parser_
Definition: Http1Server.h:64
void processHttpRequest(Http::Stream *const context)
Manages a connection from an HTTP/1 or HTTP/0.9 client.
Definition: Http1Server.h:23
void proceedAfterBodyContinuation(Http::StreamPointer context)
Definition: Http1Server.cc:223

 

Introduction

Documentation

Support

Miscellaneous