]> git.ipfire.org Git - thirdparty/squid.git/blame - src/ssl/ServerBump.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / ssl / ServerBump.cc
CommitLineData
fd4624d7 1/*
bde978a6 2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
fd4624d7 3 *
bbc27441
AJ
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.
fd4624d7
CT
7 */
8
bbc27441
AJ
9/* DEBUG: section 33 Client-side Routines */
10
fd4624d7
CT
11#include "squid.h"
12
13#include "client_side.h"
eb13c21e 14#include "FwdState.h"
fd4624d7
CT
15#include "ssl/ServerBump.h"
16#include "Store.h"
e87137f1 17#include "StoreClient.h"
b1bd952a 18#include "URL.h"
fd4624d7
CT
19
20CBDATA_NAMESPACED_CLASS_INIT(Ssl, ServerBump);
21
d620ae0e 22Ssl::ServerBump::ServerBump(HttpRequest *fakeRequest, StoreEntry *e, Ssl::BumpMode md):
f53969cc
SM
23 request(fakeRequest),
24 sslErrors(NULL),
25 step(bumpStep1)
fd4624d7
CT
26{
27 debugs(33, 4, HERE << "will peek at " << request->GetHost() << ':' << request->port);
a9c2dd2f
CT
28 act.step1 = md;
29 act.step2 = act.step3 = Ssl::bumpNone;
30
b248c2a3 31 const char *uri = urlCanonical(request.getRaw());
2bd84e5f
CT
32 if (e) {
33 entry = e;
1bfe9ade 34 entry->lock("Ssl::ServerBump");
2bd84e5f
CT
35 } else
36 entry = storeCreateEntry(uri, uri, request->flags, request->method);
fd4624d7
CT
37 // We do not need to be a client because the error contents will be used
38 // later, but an entry without any client will trim all its contents away.
39 sc = storeClientListAdd(entry, this);
40}
41
42Ssl::ServerBump::~ServerBump()
43{
44 debugs(33, 4, HERE << "destroying");
45 if (entry) {
46 debugs(33, 4, HERE << *entry);
47 storeUnregister(sc, entry, this);
1bfe9ade 48 entry->unlock("Ssl::ServerBump");
fd4624d7 49 }
7a957a93 50 cbdataReferenceDone(sslErrors);
fd4624d7
CT
51}
52