ServerBump.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 
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 #include "URL.h"
20 
21 CBDATA_NAMESPACED_CLASS_INIT(Ssl, ServerBump);
22 
24  request(fakeRequest),
25  step(bumpStep1)
26 {
27  debugs(33, 4, "will peek at " << request->url.authority(true));
28  act.step1 = md;
29  act.step2 = act.step3 = Ssl::bumpNone;
30 
31  if (e) {
32  entry = e;
33  entry->lock("Ssl::ServerBump");
34  } else {
35  // XXX: Performance regression. c_str() reallocates
36  SBuf uriBuf(request->effectiveRequestUri());
37  const char *uri = uriBuf.c_str();
39  }
40  // We do not need to be a client because the error contents will be used
41  // later, but an entry without any client will trim all its contents away.
42  sc = storeClientListAdd(entry, this);
43 }
44 
46 {
47  debugs(33, 4, HERE << "destroying");
48  if (entry) {
49  debugs(33, 4, HERE << *entry);
50  storeUnregister(sc, entry, this);
51  entry->unlock("Ssl::ServerBump");
52  }
53 }
54 
55 void
57 {
58  if (serverSession)
59  return;
60 
61  serverSession = s;
62 }
63 
66 {
67  if (!serverSession)
68  return NULL;
69 
70  const Security::CertErrors *errs = static_cast<const Security::CertErrors*>(SSL_get_ex_data(serverSession.get(), ssl_ex_index_ssl_errors));
71  return errs;
72 }
73 
void attachServerSession(const Security::SessionPointer &)
Sets the server TLS session object.
Definition: ServerBump.cc:56
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:23
Definition: SBuf.h:87
HttpRequestMethod method
Definition: HttpRequest.h:102
struct _request * request(char *urlin)
Definition: tcp-banger2.c:291
store_client * storeClientListAdd(StoreEntry *e, void *data)
Definition: store_client.cc:87
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:123
StoreEntry * storeCreateEntry(const char *url, const char *logUrl, const RequestFlags &flags, const HttpRequestMethod &method)
Definition: store.cc:800
SBuf & authority(bool requirePort=false) const
Definition: url.cc:470
const SBuf & effectiveRequestUri() const
RFC 7230 section 5.5 - Effective Request URI.
Definition: HttpRequest.cc:673
const char * c_str()
Definition: SBuf.cc:546
int ssl_ex_index_ssl_errors
store_client * sc
dummy client to prevent entry trimming
Definition: ServerBump.h:57
URL url
the request URI
Definition: HttpRequest.h:103
std::ostream & HERE(std::ostream &s)
Definition: Debug.h:147
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:129
const Security::CertErrors * sslErrors() const
SSL [certificate validation] errors.
Definition: ServerBump.cc:65
HttpRequest::Pointer request
faked, minimal request; required by Client API
Definition: ServerBump.h:43
BumpMode
Definition: support.h:125
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:448

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors