if (answer == ACCESS_ALLOWED && (answer.kind != Ssl::bumpNone && answer.kind != Ssl::bumpSplice)) {
debugs(33, 2, "sslBump needed for " << connState->clientConnection << " method " << answer.kind);
connState->sslBumpMode = static_cast<Ssl::BumpMode>(answer.kind);
- httpsEstablish(connState, NULL, (Ssl::BumpMode)answer.kind);
} else {
debugs(33, 2, HERE << "sslBump not needed for " << connState->clientConnection);
connState->sslBumpMode = Ssl::bumpNone;
+ }
- // fake a CONNECT request to force connState to tunnel
- static char ip[MAX_IPSTRLEN];
- connState->clientConnection->local.toUrl(ip, sizeof(ip));
- // Pre-pend this fake request to the TLS bits already in the buffer
- SBuf retStr;
- retStr.append("CONNECT ").append(ip).append(" HTTP/1.1\r\nHost: ").append(ip).append("\r\n\r\n");
- connState->in.buf = retStr.append(connState->in.buf);
- bool ret = connState->handleReadData();
- if (ret)
- ret = connState->clientParseRequests();
-
- if (!ret) {
- debugs(33, 2, HERE << "Failed to start fake CONNECT request for ssl bumped connection: " << connState->clientConnection);
- connState->clientConnection->close();
- }
+ // fake a CONNECT request to force connState to tunnel
+ static char ip[MAX_IPSTRLEN];
+ connState->clientConnection->local.toUrl(ip, sizeof(ip));
+ // Pre-pend this fake request to the TLS bits already in the buffer
+ SBuf retStr;
+ retStr.append("CONNECT ").append(ip).append(" HTTP/1.1\r\nHost: ").append(ip).append("\r\n\r\n");
+ connState->in.buf = retStr.append(connState->in.buf);
+ bool ret = connState->handleReadData();
+ if (ret)
+ ret = connState->clientParseRequests();
+
+ if (!ret) {
+ debugs(33, 2, "Failed to start fake CONNECT request for SSL bumped connection: " << connState->clientConnection);
+ connState->clientConnection->close();
}
}
#include "acl/FilledChecklist.h"
#include "acl/Gadgets.h"
#include "anyp/PortCfg.h"
+#include "base/AsyncJobCalls.h"
#include "client_side.h"
#include "client_side_reply.h"
#include "client_side_request.h"
if (bumpMode != Ssl::bumpEnd) {
debugs(85, 5, HERE << "SslBump already decided (" << bumpMode <<
"), " << "ignoring ssl_bump for " << http->getConn());
+ http->sslBumpNeed(bumpMode); // for processRequest() to bump if needed
http->al->ssl.bumpMode = bumpMode; // inherited from bumped connection
return false;
}
"-bumped CONNECT tunnel on FD " << getConn()->clientConnection);
getConn()->sslBumpMode = sslBumpNeed_;
+ AsyncCall::Pointer bumpCall = commCbCall(85, 5, "ClientSocketContext::sslBumpEstablish",
+ CommIoCbPtrFun(&SslBumpEstablish, this));
+
+ if (request->flags.interceptTproxy || request->flags.intercepted) {
+ CommIoCbParams ¶ms = GetCommParams<CommIoCbParams>(bumpCall);
+ params.flag = Comm::OK;
+ params.conn = getConn()->clientConnection;
+ ScheduleCallHere(bumpCall);
+ return;
+ }
+
// send an HTTP 200 response to kick client SSL negotiation
// TODO: Unify with tunnel.cc and add a Server(?) header
static const char *const conn_established = "HTTP/1.1 200 Connection established\r\n\r\n";
- AsyncCall::Pointer call = commCbCall(85, 5, "ClientSocketContext::sslBumpEstablish",
- CommIoCbPtrFun(&SslBumpEstablish, this));
- Comm::Write(getConn()->clientConnection, conn_established, strlen(conn_established), call, NULL);
+ Comm::Write(getConn()->clientConnection, conn_established, strlen(conn_established), bumpCall, NULL);
}
#endif
StoreEntry *e= storeCreateEntry(storeUri, storeUri, request->flags, request->method);
#if USE_OPENSSL
if (sslBumpNeeded()) {
+ // We have to serve an error, so bump the client first.
+ sslBumpNeed(Ssl::bumpClientFirst);
// set final error but delay sending until we bump
Ssl::ServerBump *srvBump = new Ssl::ServerBump(request, e);
errorAppendEntry(e, calloutContext->error);