*) fixed proxy authentication bug:

http://www.yacy-forum.de/viewtopic.php?t=174

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@95 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 20 years ago
parent 10a4a2741d
commit 92a65874d6

@ -262,13 +262,13 @@ public final class httpd implements serverHandler {
if (allowProxy) { if (allowProxy) {
if (proxyAccountBase64MD5 == null) proxyAccountBase64MD5 = switchboard.getConfig("proxyAccountBase64MD5", ""); if (proxyAccountBase64MD5 == null) proxyAccountBase64MD5 = switchboard.getConfig("proxyAccountBase64MD5", "");
if ((proxyAccountBase64MD5.length() == 0) || if ((proxyAccountBase64MD5.length() == 0) ||
(proxyAccountBase64MD5.equals(serverCodings.standardCoder.encodeMD5Hex(((String) header.get("Authorization", "xxxxxx")).trim().substring(6))))) { (proxyAccountBase64MD5.equals(serverCodings.standardCoder.encodeMD5Hex(((String) header.get("Proxy-Authorization", "xxxxxx")).trim().substring(6))))) {
// we are authorized or no authenticate requested // we are authorized or no authenticate requested
if (proxyHandler != null) proxyHandler.doGet(prop, header, this.session.out); if (proxyHandler != null) proxyHandler.doGet(prop, header, this.session.out);
} else { } else {
// ask for authenticate // ask for authenticate
session.out.write((httpVersion + " 407 Proxy Authentication Required" + serverCore.crlfString + session.out.write((httpVersion + " 407 Proxy Authentication Required" + serverCore.crlfString +
"WWW-Authenticate: Basic realm=\"log-in\"" + serverCore.crlfString + "Proxy-Authenticate: Basic realm=\"log-in\"" + serverCore.crlfString +
serverCore.crlfString).getBytes()); serverCore.crlfString).getBytes());
return serverCore.TERMINATE_CONNECTION; return serverCore.TERMINATE_CONNECTION;
} }
@ -335,13 +335,13 @@ public final class httpd implements serverHandler {
if (allowProxy) { if (allowProxy) {
if (proxyAccountBase64MD5 == null) proxyAccountBase64MD5 = switchboard.getConfig("proxyAccountBase64MD5", ""); if (proxyAccountBase64MD5 == null) proxyAccountBase64MD5 = switchboard.getConfig("proxyAccountBase64MD5", "");
if ((proxyAccountBase64MD5.length() == 0) || if ((proxyAccountBase64MD5.length() == 0) ||
(proxyAccountBase64MD5.equals(serverCodings.standardCoder.encodeMD5Hex(((String) header.get("Authorization", "xxxxxx")).trim().substring(6))))) { (proxyAccountBase64MD5.equals(serverCodings.standardCoder.encodeMD5Hex(((String) header.get("Proxy-Authorization", "xxxxxx")).trim().substring(6))))) {
// we are authorized or no authenticate requested // we are authorized or no authenticate requested
if (proxyHandler != null) proxyHandler.doHead(prop, header, this.session.out); if (proxyHandler != null) proxyHandler.doHead(prop, header, this.session.out);
} else { } else {
// ask for authenticate // ask for authenticate
session.out.write((httpVersion + " 407 Proxy Authentication Required" + serverCore.crlfString + session.out.write((httpVersion + " 407 Proxy Authentication Required" + serverCore.crlfString +
"WWW-Authenticate: Basic realm=\"log-in\"" + serverCore.crlfString + "Proxy-Authenticate: Basic realm=\"log-in\"" + serverCore.crlfString +
serverCore.crlfString).getBytes()); serverCore.crlfString).getBytes());
return serverCore.TERMINATE_CONNECTION; return serverCore.TERMINATE_CONNECTION;
} }
@ -413,13 +413,13 @@ public final class httpd implements serverHandler {
if (allowProxy) { if (allowProxy) {
if (proxyAccountBase64MD5 == null) proxyAccountBase64MD5 = switchboard.getConfig("proxyAccountBase64MD5", ""); if (proxyAccountBase64MD5 == null) proxyAccountBase64MD5 = switchboard.getConfig("proxyAccountBase64MD5", "");
if ((proxyAccountBase64MD5.length() == 0) || if ((proxyAccountBase64MD5.length() == 0) ||
(proxyAccountBase64MD5.equals(serverCodings.standardCoder.encodeMD5Hex(((String) header.get("Authorization", "xxxxxx")).trim().substring(6))))) { (proxyAccountBase64MD5.equals(serverCodings.standardCoder.encodeMD5Hex(((String) header.get("Proxy-Authorization", "xxxxxx")).trim().substring(6))))) {
// we are authorized or no authenticate requested // we are authorized or no authenticate requested
if (proxyHandler != null) proxyHandler.doPost(prop, header, this.session.out, this.session.in); if (proxyHandler != null) proxyHandler.doPost(prop, header, this.session.out, this.session.in);
} else { } else {
// ask for authenticate // ask for authenticate
session.out.write((httpVersion + " 407 Proxy Authentication Required" + serverCore.crlfString + session.out.write((httpVersion + " 407 Proxy Authentication Required" + serverCore.crlfString +
"WWW-Authenticate: Basic realm=\"log-in\"" + serverCore.crlfString + "Proxy-Authenticate: Basic realm=\"log-in\"" + serverCore.crlfString +
serverCore.crlfString).getBytes()); serverCore.crlfString).getBytes());
return serverCore.TERMINATE_CONNECTION; return serverCore.TERMINATE_CONNECTION;
} }
@ -483,13 +483,13 @@ public final class httpd implements serverHandler {
if (allowProxy) { if (allowProxy) {
if (proxyAccountBase64MD5 == null) proxyAccountBase64MD5 = switchboard.getConfig("proxyAccountBase64MD5", ""); if (proxyAccountBase64MD5 == null) proxyAccountBase64MD5 = switchboard.getConfig("proxyAccountBase64MD5", "");
if ((proxyAccountBase64MD5.length() == 0) || if ((proxyAccountBase64MD5.length() == 0) ||
(proxyAccountBase64MD5.equals(serverCodings.standardCoder.encodeMD5Hex(((String) header.get("Authorization", "xxxxxx")).trim().substring(6))))) { (proxyAccountBase64MD5.equals(serverCodings.standardCoder.encodeMD5Hex(((String) header.get("Proxy-Authorization", "xxxxxx")).trim().substring(6))))) {
// we are authorized or no authenticate requested // we are authorized or no authenticate requested
if (proxyHandler != null) proxyHandler.doConnect(prop, header, (InputStream) this.session.in, this.session.out); if (proxyHandler != null) proxyHandler.doConnect(prop, header, (InputStream) this.session.in, this.session.out);
} else { } else {
// ask for authenticate // ask for authenticate
session.out.write((httpVersion + " 407 Proxy Authentication Required" + serverCore.crlfString + session.out.write((httpVersion + " 407 Proxy Authentication Required" + serverCore.crlfString +
"WWW-Authenticate: Basic realm=\"log-in\"" + serverCore.crlfString + "Proxy-Authenticate: Basic realm=\"log-in\"" + serverCore.crlfString +
serverCore.crlfString).getBytes()); serverCore.crlfString).getBytes());
} }
} else { } else {

Loading…
Cancel
Save