On 22/06/2023 21:49, Christopher Schultz wrote:
--- a/test/org/apache/catalina/startup/SimpleHttpClient.java
+++ b/test/org/apache/catalina/startup/SimpleHttpClient.java
@@ -150,6 +150,13 @@ public abstract class SimpleHttpClient {
return responseLine;
}
+ public int getStatusCode() {
+ if (responseLine.length() < 13) {
+ throw new IllegalStateException();
+ }
+ return Integer.parseInt(responseLine.substring(9, 12));
+ }
+
This seems fragile. I know the only major versions of HTTP so far have
been 0.9, 1.0, 1.1, and 2(.0) which doesn't use text-based status-lines,
but a spec-compliant parser would have to grab everything in between the
first and second spaces on the line.
https://datatracker.ietf.org/doc/html/rfc2616#section-3.1
I'm perfectly happy to have you say "we'll fix it if it ever breaks" but
I know sometimes you have to balance your desire to be spec-compliant
with your desire to not have to do stupid things.
:)
Sorry, should have replied to this comment as well. I'm going to fix
this if it ever breaks on the basis SimpleHttpClient has a clear health
warning at the top that it isn't spec compliant.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org