]>
Commit | Line | Data |
---|---|---|
fd4624d7 | 1 | /* |
ef57eb7b | 2 | * Copyright (C) 1996-2016 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" |
d3dddfb5 | 15 | #include "http/Stream.h" |
fd4624d7 CT |
16 | #include "ssl/ServerBump.h" |
17 | #include "Store.h" | |
e87137f1 | 18 | #include "StoreClient.h" |
b1bd952a | 19 | #include "URL.h" |
fd4624d7 CT |
20 | |
21 | CBDATA_NAMESPACED_CLASS_INIT(Ssl, ServerBump); | |
22 | ||
d620ae0e | 23 | Ssl::ServerBump::ServerBump(HttpRequest *fakeRequest, StoreEntry *e, Ssl::BumpMode md): |
f53969cc | 24 | request(fakeRequest), |
f53969cc | 25 | step(bumpStep1) |
fd4624d7 | 26 | { |
5c51bffb | 27 | debugs(33, 4, "will peek at " << request->url.authority(true)); |
a9c2dd2f CT |
28 | act.step1 = md; |
29 | act.step2 = act.step3 = Ssl::bumpNone; | |
30 | ||
2bd84e5f CT |
31 | if (e) { |
32 | entry = e; | |
1bfe9ade | 33 | entry->lock("Ssl::ServerBump"); |
851feda6 AJ |
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 | } | |
fd4624d7 CT |
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); | |
1bfe9ade | 50 | entry->unlock("Ssl::ServerBump"); |
fd4624d7 | 51 | } |
fd4624d7 CT |
52 | } |
53 | ||
088f0761 CT |
54 | void |
55 | Ssl::ServerBump::attachServerSSL(SSL *ssl) | |
56 | { | |
57 | if (serverSSL.get()) | |
58 | return; | |
59 | ||
014a9017 | 60 | serverSSL.resetAndLock(ssl); |
088f0761 CT |
61 | } |
62 | ||
63 | const Ssl::CertErrors * | |
64 | Ssl::ServerBump::sslErrors() const | |
65 | { | |
66 | if (!serverSSL.get()) | |
67 | return NULL; | |
68 | ||
69 | const Ssl::CertErrors *errs = static_cast<const Ssl::CertErrors*>(SSL_get_ex_data(serverSSL.get(), ssl_ex_index_ssl_errors)); | |
70 | return errs; | |
fd4624d7 CT |
71 | } |
72 |