summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/src/com/memberwebs/httpauth/BaseHttpAuthenticator.java30
-rw-r--r--java/src/com/memberwebs/httpauth/HttpAuthConnection.java3
2 files changed, 16 insertions, 17 deletions
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());