ServerBump.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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 #include "anyp/Uri.h"
13 #include "client_side.h"
14 #include "client_side_request.h"
15 #include "FwdState.h"
16 #include "http/Stream.h"
17 #include "ssl/ServerBump.h"
18 #include "Store.h"
19 #include "StoreClient.h"
20 
22 
24  step(XactionStep::tlsBump1)
25 {
26  assert(http->request);
27  request = http->request;
28  debugs(33, 4, "will peek at " << request->url.authority(true));
29  act.step1 = md;
30  act.step2 = act.step3 = Ssl::bumpNone;
31 
32  if (e) {
33  entry = e;
34  entry->lock("Ssl::ServerBump");
35  } else {
36  // XXX: Performance regression. c_str() reallocates
37  SBuf uriBuf(request->effectiveRequestUri());
38  const char *uri = uriBuf.c_str();
40  }
41  // We do not need to be a client because the error contents will be used
42  // later, but an entry without any client will trim all its contents away.
43  sc = storeClientListAdd(entry, this);
44 #if USE_DELAY_POOLS
46 #endif
47 }
48 
50 {
51  debugs(33, 4, "destroying");
52  if (entry) {
53  debugs(33, 4, *entry);
54  storeUnregister(sc, entry, this);
55  entry->unlock("Ssl::ServerBump");
56  }
57 }
58 
59 void
61 {
62  serverSession = s;
63 }
64 
67 {
68  if (!serverSession)
69  return nullptr;
70 
71  return static_cast<Security::CertErrors*>(SSL_get_ex_data(serverSession.get(), ssl_ex_index_ssl_errors));
72 }
73 
static DelayId DelayClient(ClientHttpRequest *, HttpReply *reply=nullptr)
Definition: DelayId.cc:68
AnyP::Uri url
the request URI
Definition: HttpRequest.h:115
int ssl_ex_index_ssl_errors
store_client * sc
dummy client to prevent entry trimming
Definition: ServerBump.h:67
RequestFlags flags
Definition: HttpRequest.h:141
void lock(const char *context)
Definition: store.cc:445
Definition: SBuf.h:93
BumpMode
Definition: support.h:132
Security::CertErrors * sslErrors() const
SSL [certificate validation] errors.
Definition: ServerBump.cc:66
StoreEntry * entry
Definition: ServerBump.h:54
HttpRequest::Pointer request
faked, minimal request; required by Client API
Definition: ServerBump.h:53
XactionStep
Definition: XactionStep.h:12
void attachServerSession(const Security::SessionPointer &)
Sets the server TLS session object.
Definition: ServerBump.cc:60
CBDATA_NAMESPACED_CLASS_INIT(Ssl, ServerBump)
Definition: Xaction.cc:39
#define assert(EX)
Definition: assert.h:17
static int sc[16]
Definition: smbdes.c:121
const char * c_str()
Definition: SBuf.cc:516
SBuf & authority(bool requirePort=false) const
Definition: Uri.cc:689
StoreEntry * storeCreateEntry(const char *url, const char *logUrl, const RequestFlags &flags, const HttpRequestMethod &method)
Definition: store.cc:759
HttpRequestMethod method
Definition: HttpRequest.h:114
std::shared_ptr< SSL > SessionPointer
Definition: Session.h:53
@ bumpNone
Definition: support.h:132
struct Ssl::ServerBump::@110 act
bumping actions at various bumping steps
void setDelayId(DelayId delay_id)
int storeUnregister(store_client *sc, StoreEntry *e, void *data)
const SBuf & effectiveRequestUri() const
RFC 7230 section 5.5 - Effective Request URI.
Definition: HttpRequest.cc:744
ServerBump(ClientHttpRequest *http, StoreEntry *e=nullptr, Ssl::BumpMode mode=Ssl::bumpServerFirst)
Definition: ServerBump.cc:23
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:192
store_client * storeClientListAdd(StoreEntry *e, void *data)
HttpRequest *const request

 

Introduction

Documentation

Support

Miscellaneous