Skip to content

Missing carriage return character (\r) in error message. #1017

Closed

Description

@pawankgupta-se

Hi,
I noticed that there in error message Content-Type content you have missed \r at one place. Which is causing issue on some platform/library (used by client). Class WebSocketImpl

private ByteBuffer generateHttpResponseDueToError( int errorCode ) {
		String errorCodeDescription;
		switch(errorCode) {
			case 404:
				errorCodeDescription = "404 WebSocket Upgrade Failure";
				break;
			case 500:
			default:
				errorCodeDescription = "500 Internal Server Error";
		}
		return ByteBuffer.wrap( Charsetfunctions.asciiBytes( "HTTP/1.1 " + errorCodeDescription + "\r\nContent-Type: text/html\nServer: TooTallNate Java-WebSocket\r\nContent-Length: " + ( 48 + errorCodeDescription.length() ) + "\r\n\r\n<html><head></head><body><h1>" + errorCodeDescription + "</h1></body></html>" ) );
	}

Activity

  1. marci4 commented on May 11, 2020

    @marci4
    Collaborator

    Hey,

    just out of curiosity, which lib has a problem with that?

    Any PR is welcome!

    Best regards,
    Marcel

  2. pawankgupta-se commented on May 11, 2020

    @pawankgupta-se
    Author

    Hey,
    We are using "websocket-sharp" https://github.com/sta/websocket-sharp for windows client.
    Given a PR.

    Thanks
    Pawan

  3. added a commit that references this issue on May 11, 2020
  4. added this to the Release 1.5.2 milestone on May 11, 2020
  5. added a commit that references this issue on May 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions