~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to src/client_side_reply.h

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2006-11-11 10:32:06 UTC
  • Revision ID: james.westby@ubuntu.com-20061111103206-f3p0r9g0vq44rp3r
Tags: upstream-3.0.PRE5
ImportĀ upstreamĀ versionĀ 3.0.PRE5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*
 
3
 * $Id: client_side_reply.h,v 1.16 2006/10/26 19:42:24 serassio Exp $
 
4
 *
 
5
 *
 
6
 * SQUID Web Proxy Cache          http://www.squid-cache.org/
 
7
 * ----------------------------------------------------------
 
8
 *
 
9
 *  Squid is the result of efforts by numerous individuals from
 
10
 *  the Internet community; see the CONTRIBUTORS file for full
 
11
 *  details.   Many organizations have provided support for Squid's
 
12
 *  development; see the SPONSORS file for full details.  Squid is
 
13
 *  Copyrighted (C) 2001 by the Regents of the University of
 
14
 *  California; see the COPYRIGHT file for full details.  Squid
 
15
 *  incorporates software developed and/or copyrighted by other
 
16
 *  sources; see the CREDITS file for full details.
 
17
 *
 
18
 *  This program is free software; you can redistribute it and/or modify
 
19
 *  it under the terms of the GNU General Public License as published by
 
20
 *  the Free Software Foundation; either version 2 of the License, or
 
21
 *  (at your option) any later version.
 
22
 *  
 
23
 *  This program is distributed in the hope that it will be useful,
 
24
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
25
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
26
 *  GNU General Public License for more details.
 
27
 *  
 
28
 *  You should have received a copy of the GNU General Public License
 
29
 *  along with this program; if not, write to the Free Software
 
30
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
 
31
 *
 
32
 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
 
33
 */
 
34
 
 
35
#ifndef SQUID_CLIENTSIDEREPLY_H
 
36
#define SQUID_CLIENTSIDEREPLY_H
 
37
 
 
38
#include "RefCount.h"
 
39
#include "HttpHeader.h"
 
40
#include "clientStream.h"
 
41
#include "StoreClient.h"
 
42
#include "client_side_request.h"
 
43
 
 
44
 
 
45
class ErrorState;
 
46
 
 
47
/* XXX make static method */
 
48
 
 
49
class clientReplyContext : public RefCountable, public StoreClient
 
50
{
 
51
 
 
52
public:
 
53
    void *operator new (size_t byteCount);
 
54
    void operator delete (void *address);
 
55
    static STCB CacheHit;
 
56
    static STCB HandleIMSReply;
 
57
    static STCB SendMoreData;
 
58
 
 
59
    clientReplyContext(ClientHttpRequest *);
 
60
    ~clientReplyContext();
 
61
 
 
62
    void saveState();
 
63
    void restoreState();
 
64
    void purgeRequest ();
 
65
    void purgeRequestFindObjectToPurge();
 
66
    void purgeDoMissPurge();
 
67
    void purgeFoundGet(StoreEntry *newEntry);
 
68
    void purgeFoundHead(StoreEntry *newEntry);
 
69
    void purgeFoundObject(StoreEntry *entry);
 
70
    void sendClientUpstreamResponse();
 
71
    void purgeDoPurgeGet(StoreEntry *entry);
 
72
    void purgeDoPurgeHead(StoreEntry *entry);
 
73
    void doGetMoreData();
 
74
    void identifyStoreObject();
 
75
    void identifyFoundObject(StoreEntry *entry);
 
76
    int storeOKTransferDone() const;
 
77
    int storeNotOKTransferDone() const;
 
78
 
 
79
    void setReplyToError(err_type, http_status, method_t, char const *, struct IN_ADDR *, HttpRequest *, char *, auth_user_request_t *);
 
80
    void createStoreEntry(method_t m, request_flags flags);
 
81
    void removeStoreReference(store_client ** scp, StoreEntry ** ep);
 
82
    void removeClientStoreReference(store_client **scp, ClientHttpRequest *http);
 
83
    void startError(ErrorState * err);
 
84
    void processExpired();
 
85
    clientStream_status_t replyStatus();
 
86
    void processMiss();
 
87
    void traceReply(clientStreamNode * node);
 
88
 
 
89
    http_status purgeStatus;
 
90
 
 
91
    /* state variable - replace with class to handle storeentries at some point */
 
92
    int lookingforstore;
 
93
    virtual void created (StoreEntry *newEntry);
 
94
 
 
95
    ClientHttpRequest *http;
 
96
    int headers_sz;
 
97
    store_client *sc;           /* The store_client we're using */
 
98
    StoreIOBuffer tempBuffer;   /* For use in validating requests via IMS */
 
99
    int old_reqsize;            /* ... again, for the buffer */
 
100
    size_t reqsize;
 
101
    off_t reqofs;
 
102
    char tempbuf[HTTP_REQBUF_SZ];       /* a temporary buffer if we need working storage */
 
103
#if USE_CACHE_DIGESTS
 
104
 
 
105
    const char *lookup_type;    /* temporary hack: storeGet() result: HIT/MISS/NONE */
 
106
#endif
 
107
 
 
108
    struct
 
109
    {
 
110
 
 
111
unsigned storelogiccomplete: 1;
 
112
 
 
113
unsigned complete: 1;           /* we have read all we can from upstream */
 
114
        bool headersSent;
 
115
    }
 
116
 
 
117
    flags;
 
118
    clientStreamNode *ourNode;  /* This will go away if/when this file gets refactored some more */
 
119
 
 
120
private:
 
121
    CBDATA_CLASS(clientReplyContext);
 
122
    clientStreamNode *getNextNode() const;
 
123
    void makeThisHead();
 
124
    bool errorInStream(StoreIOBuffer const &result, size_t const &sizeToProcess)const ;
 
125
    void sendStreamError(StoreIOBuffer const &result);
 
126
    void pushStreamData(StoreIOBuffer const &result, char *source);
 
127
    void waitForMoreData ();
 
128
    clientStreamNode * next() const;
 
129
    void startSendProcess();
 
130
    StoreIOBuffer holdingBuffer;
 
131
    HttpReply *reply;
 
132
    void processReplyAccess();
 
133
    static PF ProcessReplyAccessResult;
 
134
    void processReplyAccessResult(bool accessAllowed);
 
135
    void buildReply(const char *buf, size_t size);
 
136
    void buildReplyHeader ();
 
137
    bool alwaysAllowResponse(http_status sline) const;
 
138
    int checkTransferDone();
 
139
    void processOnlyIfCachedMiss();
 
140
    void cacheHit(StoreIOBuffer result);
 
141
    void handleIMSReply(StoreIOBuffer result);
 
142
    void sendMoreData(StoreIOBuffer result);
 
143
    void triggerInitialStoreRead();
 
144
    void sendClientOldEntry();
 
145
    void buildMaxBodySize(HttpReply * reply);
 
146
 
 
147
 
 
148
    StoreEntry *old_entry;
 
149
    store_client *old_sc;       /* ... for entry to be validated */
 
150
    bool deleting;
 
151
};
 
152
 
 
153
#endif /* SQUID_CLIENTSIDEREPLY_H */