]> git.ipfire.org Git - thirdparty/squid.git/blame - src/forward.h
FwdState::abort can happen mid-connect
[thirdparty/squid.git] / src / forward.h
CommitLineData
2087dca6 1#ifndef SQUID_FORWARD_H
2#define SQUID_FORWARD_H
3cd1350a 3
62ee09ca 4/* forward decls */
5
aa839030 6class ErrorState;
06093389 7class HttpRequest;
62ee09ca 8
a553a5a3 9#include "comm.h"
cfd66529 10#include "comm/Connection.h"
96d89ea0 11#include "ip/Address.h"
cfd66529 12#include "Array.h"
a553a5a3 13
3cd1350a 14class FwdState : public RefCountable
15{
3cd1350a 16public:
17 typedef RefCount<FwdState> Pointer;
3cd1350a 18 ~FwdState();
19 static void initModule();
20
be0c6690 21 static void fwdStart(int fd, StoreEntry *, HttpRequest *);
cfd66529 22 void startComplete();
3cd1350a 23 void fail(ErrorState *err);
24 void unregister(int fd);
25 void complete();
3e8c047e 26 void handleUnregisteredServerEnd();
3cd1350a 27 int reforward();
28 bool reforwardableStatus(http_status s);
29 void serverClosed(int fd);
30 void connectStart();
aed188fd 31 void connectDone(Comm::ConnectionPointer &conn, comm_err_t status, int xerrno);
3cd1350a 32 void connectTimeout(int fd);
33 void initiateSSL();
34 void negotiateSSL(int fd);
35 bool checkRetry();
36 bool checkRetriable();
37 void dispatch();
f9b72e0c 38 void pconnPush(Comm::ConnectionPointer conn, const peer *_peer, const HttpRequest *req, const char *domain, Ip::Address &client_addr);
3cd1350a 39
40 bool dontRetry() { return flags.dont_retry; }
41
42 void dontRetry(bool val) { flags.dont_retry = val; }
43
44 bool ftpPasvFailed() { return flags.ftp_pasv_failed; }
45
46 void ftpPasvFailed(bool val) { flags.ftp_pasv_failed = val; }
47
f9b72e0c 48 Comm::ConnectionPointer conn() const { return paths[0]; };
3cd1350a 49
50private:
7a0fb323 51 // hidden for safer management of self; use static fwdStart
52 FwdState(int fd, StoreEntry *, HttpRequest *);
53 void start(Pointer aSelf);
54
3cd1350a 55 static void logReplyStatus(int tries, http_status status);
74780d33 56 void updateHierarchyInfo();
802a8c1d 57 void completed();
3e8c047e 58 void retryOrBail();
6852be71 59 static void RegisterWithCacheManager(void);
3cd1350a 60
61#if WIP_FWD_LOG
62
63be0a78 63 void uninit /**DOCS_NOSEMI*/
64 static void logRotate /**DOCS_NOSEMI*/
65 void status() /**DOCS_NOSEMI*/
3cd1350a 66#endif
67
68public:
69 StoreEntry *entry;
70 HttpRequest *request;
429871db 71 static void abort(void*);
3cd1350a 72
73private:
3cd1350a 74 Pointer self;
75 ErrorState *err;
76 int client_fd;
77 time_t start_t;
78 int n_tries;
79 int origin_tries;
80#if WIP_FWD_LOG
81
82 http_status last_status;
83#endif
84
26ac0430 85 struct {
3d0ac046
HN
86 unsigned int dont_retry:1;
87 unsigned int ftp_pasv_failed:1;
88 unsigned int forward_completed:1;
2fadd50d 89 } flags;
3cd1350a 90
cfd66529 91 /** possible paths which may be tried (in sequence stored) */
f9b72e0c 92 Comm::Paths paths;
d2bf2f90
AJ
93
94 // NP: keep this last. It plays with private/public
95 CBDATA_CLASS2(FwdState);
3cd1350a 96};
2087dca6 97
d85b8894 98#endif /* SQUID_FORWARD_H */