{"record":{"id":"7fd2a28322afb281","repo":"TooTallNate/Java-WebSocket","slug":"invalid-status-line-received-s-status-line-s","errorCode":null,"errorMessage":"Invalid status line received: %s Status line: %s","messagePattern":"Invalid status line received: (.+?) Status line: (.+?)","errorType":"exception","errorClass":"InvalidHandshakeException","httpStatus":null,"severity":"error","filePath":"src/main/java/org/java_websocket/drafts/Draft.java","lineNumber":149,"sourceCode":"    return handshake;\n  }\n\n  /**\n   * Checking the handshake for the role as server\n   *\n   * @param firstLineTokens the token of the first line split as as an string array\n   * @param line            the whole line\n   * @return a handshake\n   */\n  private static HandshakeBuilder translateHandshakeHttpServer(String[] firstLineTokens,\n      String line) throws InvalidHandshakeException {\n    // translating/parsing the request from the CLIENT\n    if (!\"GET\".equalsIgnoreCase(firstLineTokens[0])) {\n      throw new InvalidHandshakeException(String\n          .format(\"Invalid request method received: %s Status line: %s\", firstLineTokens[0], line));\n    }\n    if (!\"HTTP/1.1\".equalsIgnoreCase(firstLineTokens[2])) {\n      throw new InvalidHandshakeException(String\n          .format(\"Invalid status line received: %s Status line: %s\", firstLineTokens[2], line));\n    }\n    ClientHandshakeBuilder clienthandshake = new HandshakeImpl1Client();\n    clienthandshake.setResourceDescriptor(firstLineTokens[1]);\n    return clienthandshake;\n  }\n\n  /**\n   * Checking the handshake for the role as client\n   *\n   * @param firstLineTokens the token of the first line split as as an string array\n   * @param line            the whole line\n   * @return a handshake\n   */\n  private static HandshakeBuilder translateHandshakeHttpClient(String[] firstLineTokens,\n      String line) throws InvalidHandshakeException {\n    // translating/parsing the response from the SERVER\n    if (!\"101\".equals(firstLineTokens[1])) {","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/TooTallNate/Java-WebSocket/blob/afeacbf8c0f6f6a761c9d9daed8c813dd3b8ed7d/src/main/java/org/java_websocket/drafts/Draft.java#L131-L167","documentation":"This guard fires in Draft.translateHandshakeHttpServer when the third token of the request's first line is not 'HTTP/1.1'. The WebSocket handshake (RFC 6455) requires HTTP/1.1; a request line ending in HTTP/1.0 or any other protocol token cannot carry the required upgrade semantics, so the handshake is rejected with InvalidHandshakeException. The faulty input is a client request whose status line declares a protocol/version other than HTTP/1.1.","triggerScenarios":"Thrown at src/main/java/org/java_websocket/drafts/Draft.java:149 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the connecting client uses HTTP/1.1 for the upgrade request (WebSocket requires it, not HTTP/1.0)","Check for old HTTP client libraries, embedded devices, or proxies downgrading the request to HTTP/1.0","Verify the request line is well formed with exactly three tokens: METHOD resource HTTP/1.1","If supporting legacy clients is required, upgrade them or terminate the connection gracefully at the plain-HTTP layer instead"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"afeacbf8c0f6f6a761c9d9daed8c813dd3b8ed7d","analyzedAt":"2026-09-09T14:39:47.546Z","contentChangedAt":"2026-09-09T14:39:47.546Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}