Add support for additional 500 error codes.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 21 Jun 2010 17:52:25 +0000 (17:52 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 21 Jun 2010 17:52:25 +0000 (17:52 +0000)
Allow responses to include blank lines

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@956653 13f79535-47bb-0310-9956-ffa450edef68

test/org/apache/catalina/startup/SimpleHttpClient.java

index bcd6507..3040e48 100644 (file)
@@ -44,7 +44,9 @@ public abstract class SimpleHttpClient {
 
     public static final String OK_200 = "HTTP/1.1 200";
     public static final String FAIL_404 = "HTTP/1.1 404";
+    public static final String FAIL_50X = "HTTP/1.1 50";
     public static final String FAIL_500 = "HTTP/1.1 500";
+    public static final String FAIL_501 = "HTTP/1.1 501";
     
     private Socket socket;
     private Writer writer;
@@ -121,7 +123,7 @@ public abstract class SimpleHttpClient {
         StringBuilder builder = new StringBuilder();
         if (readBody) {
             line = readLine();
-            while (line != null && line.length() > 0) {
+            while (line != null) {
                 builder.append(line);
                 line = readLine();
             }
@@ -161,10 +163,18 @@ public abstract class SimpleHttpClient {
         return getResponseLine().startsWith(FAIL_404);
     }
 
+    public boolean isResponse50x() {
+        return getResponseLine().startsWith(FAIL_50X);
+    }
+    
     public boolean isResponse500() {
         return getResponseLine().startsWith(FAIL_500);
     }
     
+    public boolean isResponse501() {
+        return getResponseLine().startsWith(FAIL_501);
+    }
+    
     public Socket getSocket() {
         return socket;
     }