This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 9cb1998dc42dc575fc680d1a4b1e029b02d7a582 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 5d4366e..ca68f4d 100644 --- a/test/org/apache/catalina/startup/SimpleHttpClient.java +++ b/test/org/apache/catalina/startup/SimpleHttpClient.java @@ -90,6 +90,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; @@ -129,6 +130,10 @@ public abstract class SimpleHttpClient { return useCookies; } + public void setUseHttp09(boolean theUseHttp09Flag) { + useHttp09 = theUseHttp09Flag; + } + public void setRequestPause(int theRequestPause) { requestPause = theRequestPause; } @@ -237,23 +242,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