This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 28bb01fdad00aa32bc5c700a594c22fa04846459 Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Mar 10 12:43:46 2020 +0000 Update test client to handle HTTP 0.9 requests and responses --- .../apache/catalina/startup/SimpleHttpClient.java | 38 +++++++++++++--------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/test/org/apache/catalina/startup/SimpleHttpClient.java b/test/org/apache/catalina/startup/SimpleHttpClient.java index a5ced3e..79ab7b2 100644 --- a/test/org/apache/catalina/startup/SimpleHttpClient.java +++ b/test/org/apache/catalina/startup/SimpleHttpClient.java @@ -95,6 +95,7 @@ public abstract class SimpleHttpClient { private String[] request; private boolean useContinue = false; private boolean useCookies = true; + private boolean useHttp09 = false; private int requestPause = 1000; private String responseLine; @@ -134,6 +135,10 @@ public abstract class SimpleHttpClient { return useCookies; } + public void setUseHttp09(boolean theUseHttp09Flag) { + useHttp09 = theUseHttp09Flag; + } + public void setRequestPause(int theRequestPause) { requestPause = theRequestPause; } @@ -242,23 +247,26 @@ public abstract class SimpleHttpClient { bodyUriElements.clear(); } - // Read the response status line - responseLine = readLine(); - - // Is a 100 continue response expected? - if (useContinue) { - if (isResponse100()) { - // Skip the blank after the 100 Continue response - readLine(); - // Now get the final response - responseLine = readLine(); - } else { - throw new IOException("No 100 Continue response"); + // HTTP 0.9 has neither response line nor headers + if (!useHttp09) { + // Read the response status line + responseLine = readLine(); + + // Is a 100 continue response expected? + if (useContinue) { + if (isResponse100()) { + // Skip the blank after the 100 Continue response + readLine(); + // Now get the final response + responseLine = readLine(); + } else { + throw new IOException("No 100 Continue response"); + } } - } - // Put the headers into a map, and process interesting ones - processHeaders(); + // Put the headers into a map, and process interesting ones + processHeaders(); + } // Read the body, if requested and if one exists processBody(wantBody); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org