src/java.net.http/share/classes/jdk/internal/net/http/Http1HeaderParser.java
changeset 55392 444b2d3471e9
parent 50681 4254bed3c09d
equal deleted inserted replaced
55391:1afe0cb93482 55392:444b2d3471e9
   192             throw protocolException("Invalid status line: \"%s\"", statusLine);
   192             throw protocolException("Invalid status line: \"%s\"", statusLine);
   193         }
   193         }
   194         if (statusLine.length() < 12) {
   194         if (statusLine.length() < 12) {
   195             throw protocolException("Invalid status line: \"%s\"", statusLine);
   195             throw protocolException("Invalid status line: \"%s\"", statusLine);
   196         }
   196         }
   197         responseCode = Integer.parseInt(statusLine.substring(9, 12));
   197         try {
       
   198             responseCode = Integer.parseInt(statusLine.substring(9, 12));
       
   199         } catch (NumberFormatException nfe) {
       
   200             throw protocolException("Invalid status line: \"%s\"", statusLine);
       
   201         }
       
   202         // response code expected to be a 3-digit integer (RFC-2616, section 6.1.1)
       
   203         if (responseCode < 100) {
       
   204             throw protocolException("Invalid status line: \"%s\"", statusLine);
       
   205         }
   198 
   206 
   199         state = State.STATUS_LINE_END;
   207         state = State.STATUS_LINE_END;
   200     }
   208     }
   201 
   209 
   202     private void maybeStartHeaders(ByteBuffer input) {
   210     private void maybeStartHeaders(ByteBuffer input) {