summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2006-10-20 15:43:20 +0000
committerStef Walter <stef@memberwebs.com>2006-10-20 15:43:20 +0000
commit87da3655492bb009f84f2e101a08dfb3a0a35592 (patch)
tree225e9e084127f3bae4d5ec853f2a8109bcb50c2c
parent8135e62aa423f7ae08b2cbfcccf4a634ae0cb122 (diff)
- Reconnect to httpauthd when that daemon has been restarted.
-rw-r--r--ChangeLog3
-rw-r--r--java/src/com/memberwebs/httpauth/BaseHttpAuthenticator.java30
-rw-r--r--java/src/com/memberwebs/httpauth/HttpAuthConnection.java3
3 files changed, 18 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 365ee61..cbb64df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,10 @@
-0.5.3
+0.6 ???
- Guarantee unique connection identfier for NTLM when using apache2
- Fix crasher when doing basic auth.
- Allow numbers in handler names.
- In the Jetty authenticator generate a unique authentication identifier
which facilitates NTLM authentication
+ - Reconnect to httpauthd when that daemon has been restarted.
0.5.2
- Better messages when keepalives are not used with NTLM
diff --git a/java/src/com/memberwebs/httpauth/BaseHttpAuthenticator.java b/java/src/com/memberwebs/httpauth/BaseHttpAuthenticator.java
index 8dd15f1..140beec 100644
--- a/java/src/com/memberwebs/httpauth/BaseHttpAuthenticator.java
+++ b/java/src/com/memberwebs/httpauth/BaseHttpAuthenticator.java
@@ -85,8 +85,18 @@ public abstract class BaseHttpAuthenticator
conn.sendLine("AUTH " + args);
sendHeaders(conn, request, authtypes);
- // If above was successful get out of this retry loop
- break;
+ rsp = conn.readResponse(200);
+ copyHeaders(conn, response, authtypes);
+
+ if(rsp.ccode != 200)
+ {
+ setResponseResult(response, rsp.ccode);
+ return null;
+ }
+ else
+ {
+ return rsp.details;
+ }
}
catch(SocketException e)
{
@@ -94,7 +104,7 @@ public abstract class BaseHttpAuthenticator
conn.close();
// Stupid hack but java doesn't let us do any better just now
- if(!e.getMessage().startsWith("Broken pipe"))
+ if(!e.getMessage().toLowerCase().startsWith("broken pipe"))
throw new HttpAuthException("error communicating with httpauthd", e);
}
@@ -106,18 +116,6 @@ public abstract class BaseHttpAuthenticator
m_source.doneWithConnection(conn);
}
- rsp = conn.readResponse(200);
- copyHeaders(conn, response, authtypes);
-
- if(rsp.ccode != 200)
- {
- setResponseResult(response, rsp.ccode);
- return null;
- }
- else
- {
- return rsp.details;
- }
}
catch(IOException e)
{
@@ -127,7 +125,7 @@ public abstract class BaseHttpAuthenticator
conn.close();
}
catch(IOException ex)
- { }
+ { }
throw new HttpAuthException("error communicating with httpauthd", e);
}
diff --git a/java/src/com/memberwebs/httpauth/HttpAuthConnection.java b/java/src/com/memberwebs/httpauth/HttpAuthConnection.java
index e29aaae..b26dc09 100644
--- a/java/src/com/memberwebs/httpauth/HttpAuthConnection.java
+++ b/java/src/com/memberwebs/httpauth/HttpAuthConnection.java
@@ -45,6 +45,7 @@ import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.InetSocketAddress;
import java.net.Socket;
+import java.net.SocketException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -256,7 +257,7 @@ public class HttpAuthConnection
String line = readLine();
if(line == null)
- throw new IOException("unexpected end of data from httpauthd");
+ throw new SocketException("Broken Pipe: unexpected end of data from httpauthd");
String word = parseWord(line);
line = line.substring(word.length());