~ubuntu-branches/ubuntu/oneiric/squid3/oneiric-security

« back to all changes in this revision

Viewing changes to src/whois.cc

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2007-05-13 16:03:16 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070513160316-2h6kn6h1z0q1fvyo
Tags: 3.0.PRE6-1
* New upstream release
  - Removed patches integrated upsteam:
    + 04-m68k-ftbfs

* debian/rules
  - Enable delay pools (Closes: #410785)
  - Enable cache digests (Closes: #416631)
  - Enable ICAP client
  - Raised Max Filedescriptor limit to 65536

* debian/control
  - Added real package dependency for httpd in squid3-cgi

* debian/patches/02-makefile-defaults
  - Fix default configuration file for cachemgr.cgi (Closes: #416630)

* debian/squid3.postinst
  - Fixed bashish in postinst (Closes: #411797)

* debian/patches/05-helpers-typo
  - Added upstream patch fixing compilation error in src/helpers.cc

* debian/patches/06-mem-obj-reference
  - Added upstream patch fixing a mem_obj reference in src/store.cc

* debian/patches/07-close-icap-connections
  - Added upstream patch fixing icap connection starvation

* debian/squid3.rc
  - Added LSB-compliant description to rc script

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
/*
3
 
 * $Id: whois.cc,v 1.38 2006/09/19 07:56:57 adrian Exp $
 
3
 * $Id: whois.cc,v 1.43 2007/04/30 16:56:09 wessels Exp $
4
4
 *
5
5
 * DEBUG: section 75    WHOIS protocol
6
6
 * AUTHOR: Duane Wessels, Kostas Anagnostakis
54
54
    StoreEntry *entry;
55
55
    HttpRequest *request;
56
56
    FwdState::Pointer fwd;
57
 
    char buf[BUFSIZ];
 
57
    char buf[BUFSIZ+1];         /* readReply adds terminating NULL */
58
58
    bool dataWritten;
59
59
};
60
60
 
89
89
    p->request = fwd->request;
90
90
    p->entry = fwd->entry;
91
91
    p->fwd = fwd;
92
 
    p->dataWritten = 0;
 
92
    p->dataWritten = false;
93
93
 
94
94
    p->entry->lock()
95
95
 
113
113
whoisTimeout(int fd, void *data)
114
114
{
115
115
    WhoisState *p = (WhoisState *)data;
116
 
    debug(75, 1) ("whoisTimeout: %s\n", storeUrl(p->entry));
 
116
    debugs(75, 1, "whoisTimeout: " << p->entry->url()  );
117
117
    whoisClose(fd, p);
118
118
}
119
119
 
128
128
WhoisState::setReplyToOK(StoreEntry *entry)
129
129
{
130
130
    HttpReply *reply = new HttpReply;
131
 
    storeBuffer(entry);
 
131
    entry->buffer();
132
132
    HttpVersion version(1, 0);
133
133
    reply->setHeaders(version, HTTP_OK, "Gatewaying", "text/plain", -1, -1, -2);
134
134
    entry->replaceHttpReply(reply);
146
146
    }
147
147
 
148
148
    buf[len] = '\0';
149
 
    debug(75, 3) ("whoisReadReply: FD %d read %d bytes\n", fd, (int)len);
150
 
    debug(75, 5) ("{%s}\n", buf);
 
149
    debugs(75, 3, "whoisReadReply: FD " << fd << " read " << len << " bytes");
 
150
    debugs(75, 5, "{" << buf << "}");
151
151
 
152
152
    if (flag == COMM_OK && len > 0) {
153
153
        if (!dataWritten)
158
158
        kb_incr(&statCounter.server.http.kbytes_in, len);
159
159
 
160
160
        /* No range support, we always grab it all */
161
 
        dataWritten = 1;
162
 
 
163
 
        storeAppend(entry, buf, len);
164
 
 
165
 
        storeBufferFlush(entry);
 
161
        dataWritten = true;
 
162
 
 
163
        entry->append(buf, len);
 
164
 
 
165
        entry->flush();
166
166
 
167
167
        do_next_read = 1;
168
168
    } else if (flag != COMM_OK || len < 0) {
169
 
        debug(50, 2) ("whoisReadReply: FD %d: read failure: %s.\n",
170
 
                      fd, xstrerror());
 
169
        debugs(50, 2, "whoisReadReply: FD " << fd << ": read failure: " << xstrerror() << ".");
171
170
 
172
171
        if (ignoreErrno(errno)) {
173
172
            do_next_read = 1;
180
179
            do_next_read = 0;
181
180
        }
182
181
    } else {
183
 
        storeTimestampsSet(entry);
184
 
        storeBufferFlush(entry);
 
182
        entry->timestampsSet();
 
183
        entry->flush();
185
184
 
186
185
        if (!EBIT_TEST(entry->flags, RELEASE_REQUEST))
187
 
            storeSetPublicKey(entry);
 
186
            entry->setPublicKey();
188
187
 
189
188
        fwd->complete();
190
189
 
191
 
        debug(75, 3) ("whoisReadReply: Done: %s\n", storeUrl(entry));
 
190
        debugs(75, 3, "whoisReadReply: Done: " << entry->url()  );
192
191
 
193
192
        comm_close(fd);
194
193
 
203
202
whoisClose(int fd, void *data)
204
203
{
205
204
    WhoisState *p = (WhoisState *)data;
206
 
    debug(75, 3) ("whoisClose: FD %d\n", fd);
 
205
    debugs(75, 3, "whoisClose: FD " << fd);
207
206
    p->entry->unlock();
208
207
    cbdataFree(p);
209
208
}