ServerBump.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 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 "FwdState.h"
15 #include "http/Stream.h"
16 #include "ssl/ServerBump.h"
17 #include "Store.h"
18 #include "StoreClient.h"
19 
20 CBDATA_NAMESPACED_CLASS_INIT(Ssl, ServerBump);
21 
23  request(fakeRequest),
24  step(bumpStep1)
25 {
26  debugs(33, 4, "will peek at " << request->url.authority(true));
27  act.step1 = md;
28  act.step2 = act.step3 = Ssl::bumpNone;
29 
30  if (e) {
31  entry = e;
32  entry->lock("Ssl::ServerBump");
33  } else {
34  // XXX: Performance regression. c_str() reallocates
35  SBuf uriBuf(request->effectiveRequestUri());
36  const char *uri = uriBuf.c_str();
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 
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 }
53 
54 void
56 {
57  if (serverSession)
58  return;
59 
60  serverSession = s;
61 }
62 
65 {
66  if (!serverSession)
67  return NULL;
68 
69  const Security::CertErrors *errs = static_cast<const Security::CertErrors*>(SSL_get_ex_data(serverSession.get(), ssl_ex_index_ssl_errors));
70  return errs;
71 }
72 
void attachServerSession(const Security::SessionPointer &)
Sets the server TLS session object.
Definition: ServerBump.cc:55
static int sc[16]
Definition: smbdes.c:121
CBDATA_NAMESPACED_CLASS_INIT(Ssl, ServerBump)
ServerBump(HttpRequest *fakeRequest, StoreEntry *e=NULL, Ssl::BumpMode mode=Ssl::bumpServerFirst)
Definition: ServerBump.cc:22
Definition: SBuf.h:86
HttpRequestMethod method
Definition: HttpRequest.h:106
struct _request * request(char *urlin)
Definition: tcp-banger2.c:291
store_client * storeClientListAdd(StoreEntry *e, void *data)
#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:776
const SBuf & effectiveRequestUri() const
RFC 7230 section 5.5 - Effective Request URI.
Definition: HttpRequest.cc:687
AnyP::Uri url
the request URI
Definition: HttpRequest.h:107
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:57
std::ostream & HERE(std::ostream &s)
Definition: Debug.h:153
struct Ssl::ServerBump::@127 act
bumping actions at various bumping steps
int storeUnregister(store_client *sc, StoreEntry *e, void *data)
RequestFlags flags
Definition: HttpRequest.h:133
const Security::CertErrors * sslErrors() const
SSL [certificate validation] errors.
Definition: ServerBump.cc:64
HttpRequest::Pointer request
faked, minimal request; required by Client API
Definition: ServerBump.h:43
BumpMode
Definition: support.h:130
SBuf & authority(bool requirePort=false) const
Definition: Uri.cc:470
StoreEntry * entry
Definition: ServerBump.h:44
#define NULL
Definition: types.h:166
std::shared_ptr< SSL > SessionPointer
Definition: Session.h:41
void lock(const char *context)
Definition: store.cc:433

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors