diff -up ./src/tunnel.cc.orig ./src/tunnel.cc
--- ./src/tunnel.cc.orig 2016-07-01 13:37:50.000000000 +0200
+++ ./src/tunnel.cc 2016-07-15 16:25:07.132823875 +0200
@@ -475,7 +475,9 @@ TunnelStateData::handleConnectResponse(c
*status_ptr = rep.sline.status();
// we need to relay the 401/407 responses when login=PASS(THRU)
- const char *pwd = server.conn->getPeer()->login;
+ CachePeer *peer = server.conn->getPeer();
+ const char *pwd = (peer) ? peer->login : NULL;
+
const bool relay = pwd && (strcmp(pwd, "PASS") != 0 || strcmp(pwd, "PASSTHRU") != 0) &&
(*status_ptr == Http::scProxyAuthenticationRequired ||
*status_ptr == Http::scUnauthorized);