ServerBump.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2019 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(bumpStep1)
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, HERE << "destroying");
52  if (entry) {
53  debugs(33, 4, HERE << *entry);
54  storeUnregister(sc, entry, this);
55  entry->unlock("Ssl::ServerBump");
56  }
57 }
58 
59 void
61 {
62  if (serverSession)
63  return;
64 
65  serverSession = s;
66 }
67 
70 {
71  if (!serverSession)
72  return NULL;
73 
74  const Security::CertErrors *errs = static_cast<const Security::CertErrors*>(SSL_get_ex_data(serverSession.get(), ssl_ex_index_ssl_errors));
75  return errs;
76 }
77 
const Security::CertErrors * sslErrors() const
SSL [certificate validation] errors.
Definition: ServerBump.cc:69
void attachServerSession(const Security::SessionPointer &)
Sets the server TLS session object.
Definition: ServerBump.cc:60
#define assert(EX)
Definition: assert.h:17
SBuf & authority(bool requirePort=false) const
Definition: Uri.cc:470
struct Ssl::ServerBump::@126 act
bumping actions at various bumping steps
CBDATA_NAMESPACED_CLASS_INIT(Ssl, ServerBump)
int unlock(const char *context)
Definition: store.cc:463
Definition: SBuf.h:86
HttpRequestMethod method
Definition: HttpRequest.h:114
store_client * storeClientListAdd(StoreEntry *e, void *data)
void setDelayId(DelayId delay_id)
Security::SessionPointer serverSession
The TLS session object on server side.
Definition: ServerBump.h:57
const SBuf & effectiveRequestUri() const
RFC 7230 section 5.5 - Effective Request URI.
Definition: HttpRequest.cc:707
ServerBump(ClientHttpRequest *http, StoreEntry *e=nullptr, Ssl::BumpMode mode=Ssl::bumpServerFirst)
Definition: ServerBump.cc:23
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:124
StoreEntry * storeCreateEntry(const char *url, const char *logUrl, const RequestFlags &flags, const HttpRequestMethod &method)
Definition: store.cc:782
AnyP::Uri url
the request URI
Definition: HttpRequest.h:115
const char * c_str()
Definition: SBuf.cc:526
int ssl_ex_index_ssl_errors
store_client * sc
dummy client to prevent entry trimming
Definition: ServerBump.h:58
std::ostream & HERE(std::ostream &s)
Definition: Debug.h:153
int storeUnregister(store_client *sc, StoreEntry *e, void *data)
RequestFlags flags
Definition: HttpRequest.h:141
Definition: Xaction.cc:47
HttpRequest::Pointer request
faked, minimal request; required by Client API
Definition: ServerBump.h:44
HttpRequest *const request
BumpMode
Definition: support.h:135
StoreEntry * entry
Definition: ServerBump.h:45
static DelayId DelayClient(ClientHttpRequest *, HttpReply *reply=nullptr)
Definition: DelayId.cc:67
#define NULL
Definition: types.h:166
std::shared_ptr< SSL > SessionPointer
Definition: Session.h:42
void lock(const char *context)
Definition: store.cc:439

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors