]> git.ipfire.org Git - thirdparty/squid.git/blob - src/ssl/ServerBump.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / ssl / ServerBump.cc
1 /*
2 * Copyright (C) 1996-2016 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 /* DEBUG: section 33 Client-side Routines */
10
11 #include "squid.h"
12
13 #include "client_side.h"
14 #include "FwdState.h"
15 #include "ssl/ServerBump.h"
16 #include "Store.h"
17 #include "StoreClient.h"
18 #include "URL.h"
19
20 CBDATA_NAMESPACED_CLASS_INIT(Ssl, ServerBump);
21
22 Ssl::ServerBump::ServerBump(HttpRequest *fakeRequest, StoreEntry *e, Ssl::BumpMode md):
23 request(fakeRequest),
24 sslErrors(NULL),
25 step(bumpStep1)
26 {
27 debugs(33, 4, "will peek at " << request->url.authority(true));
28 act.step1 = md;
29 act.step2 = act.step3 = Ssl::bumpNone;
30
31 if (e) {
32 entry = e;
33 entry->lock("Ssl::ServerBump");
34 } else {
35 // XXX: Performance regression. c_str() reallocates
36 SBuf uri(request->effectiveRequestUri());
37 entry = storeCreateEntry(uri.c_str(), uri.c_str(), request->flags, request->method);
38 }
39 // We do not need to be a client because the error contents will be used
40 // later, but an entry without any client will trim all its contents away.
41 sc = storeClientListAdd(entry, this);
42 }
43
44 Ssl::ServerBump::~ServerBump()
45 {
46 debugs(33, 4, HERE << "destroying");
47 if (entry) {
48 debugs(33, 4, HERE << *entry);
49 storeUnregister(sc, entry, this);
50 entry->unlock("Ssl::ServerBump");
51 }
52 cbdataReferenceDone(sslErrors);
53 }
54