e.l.j.w.RequestResponseWebSocketSampler: Http upgrade error in sampler 'WebSocket request-response Sampler'. eu.luminis.websocket.HttpUpgradeException: Got unexpected status 403 with statusLine:HTTP/1.0 403 Forbidden

Issue #214 closed
benoit.boirel created an issue

Hello,

i try to use your Websocket plugin but it does not work with the Websocket Implement what i have to test.

i joined the template.jmx and the jmeter.log.

i don’t undertand why the websocket answer is eu.luminis.websocket.HttpUpgradeException.

Please help me.

Comments (8)

  1. benoit.boirel reporter
      <div class="preview-container wiki-content"><!-- loaded via ajax --></div>
      <div class="mask"></div>
    </div>
    

    </div> </form>

  2. Peter Doornbosch repo owner

    Because the server denies your request. As the message says: 403 Forbidden. Apparently you are not allowed to access that URL. You do know that a WebSocket connection always starts with a Http request and that the Http connection is upgraded to a WebSocket connection, don’t you?

  3. benoit.boirel reporter

    i understand how the websocket works.

    when i compare the headers request between web navigator and your plugin, i don’t see the difference.

    this is the log in jmeter with debug websocket plugin:

    Starting TLS connection.
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> GET /entreprise/coliship/ws HTTP/1.1
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> Host: www.coliship.colissimo.fr:443
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> Origin: https://www.coliship.colissimo.fr
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> Cookie: csrf=efb71e809d1a16bf5824136f552e6e57961e2643-1627654020588-62e590bf23daf6d4732851f0; PLAY_SESSION=eyJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7InRva2VuIjoiN2MyNzFiNDhmZTAwY2VlNjM5NjYzMjc3YzRmOTYzOTciLCJ1c2VySWQiOiI4MzExNjVfQ09MSVNISVAxMSIsInV1aWQiOiJhNTYzOGNiYS1hMWZkLTQwNzItOWRlZC01ZGM4N2M0YjhhYzUifSwibmJmIjoxNjI3NjU0MDIxLCJpYXQiOjE2Mjc2NTQwMjF9.IGjoPTqxdWmrEREKpwaLx_uVOYoeJlhjbJ4NgqFueyo
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> Accept: /
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> Cache-Control: no-cache
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> Sec-Fetch-Dest: websocket
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> Sec-Fetch-Site: same-origin
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> Accept-Language: q=0.9,en-US;q=0.8,en;q=0.7
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> Pragma: no-cache
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> Accept-Encoding: gzip, deflate, br
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> Sec-Fetch-Mode: websocket
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> Upgrade: websocket
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> Connection: Upgrade
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> Sec-WebSocket-Key: AoOIBJvRlphFnfHJqpzmTg==
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >> Sec-WebSocket-Version: 13
    2021-07-30 16:07:03,615 DEBUG e.l.w.WebSocketClient: >>
    2021-07-30 16:07:03,735 DEBUG e.l.w.WebSocketClient: << HTTP/1.0 403 Forbidden
    2021-07-30 16:07:03,737 DEBUG e.l.j.w.SingleWriteWebSocketSampler: Http upgrade error in sampler 'WebSocket Single Write Sampler'.
    eu.luminis.websocket.HttpUpgradeException: Got unexpected status 403 with statusLine:HTTP/1.0 403 Forbidden

    and following are the headers from web navigator

    GET /entreprise/coliship/ws HTTP/1.1
    Host: www.coliship.colissimo.fr
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0
    Accept: /
    Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
    Accept-Encoding: gzip, deflate, br
    Sec-WebSocket-Version: 13
    Origin: https://www.coliship.colissimo.fr
    Sec-WebSocket-Extensions: permessage-deflate
    Sec-WebSocket-Key: BG0K4XVxSFZPuJ8DCqzpwQ==
    DNT: 1
    Connection: keep-alive, Upgrade
    Cookie: csrf=8e925f23a556a6389327d2d8c5f7ffab1cb4c26e-1627651913232-0d761e1db39b922c08614ce6; PLAY_SESSION=eyJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7InRva2VuIjoiNTJiODk0ZjY5MDQzNjkzZjU2Y2IzMTNkMTU4YWQxYzIiLCJ1c2VySWQiOiI4MzExNjVfQ09MSVNISVAxMSIsInV1aWQiOiJlYTRiY2Y0ZS1jNzg0LTRiYjctOGE1Zi01M2YxMWJjYWVjNjkifSwibmJmIjoxNjI3NjUxOTIzLCJpYXQiOjE2Mjc2NTE5MjN9.EVZLnrhNHLwdM-6XBmI-Fzrozh72mjxIR9ig8z8zTQo; atidvisitor=%7B%22name%22%3A%22atidvisitor%22%2C%22val%22%3A%7B%22vrn%22%3A%22-616688--568606-%22%7D%2C%22options%22%3A%7B%22path%22%3A%22%2F%22%2C%22session%22%3A15724800%2C%22end%22%3A15724800%7D%7D
    Sec-Fetch-Dest: websocket
    Sec-Fetch-Mode: websocket
    Sec-Fetch-Site: same-origin
    Pragma: no-cache
    Cache-Control: no-cache
    Upgrade: websocket

  4. benoit.boirel reporter

    we don’t understand why the websocket-key does not appear in View Results. is it normal?

    View Results of Jmeter gui:

    Origin: https://www.coliship.colissimo.fr
    Cookie: csrf=efb71e809d1a16bf5824136f552e6e57961e2643-1627654020588-62e590bf23daf6d4732851f0; PLAY_SESSION=eyJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7InRva2VuIjoiN2MyNzFiNDhmZTAwY2VlNjM5NjYzMjc3YzRmOTYzOTciLCJ1c2VySWQiOiI4MzExNjVfQ09MSVNISVAxMSIsInV1aWQiOiJhNTYzOGNiYS1hMWZkLTQwNzItOWRlZC01ZGM4N2M0YjhhYzUifSwibmJmIjoxNjI3NjU0MDIxLCJpYXQiOjE2Mjc2NTQwMjF9.IGjoPTqxdWmrEREKpwaLx_uVOYoeJlhjbJ4NgqFueyo
    Accept: /
    Cache-Control: no-cache
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36
    Sec-Fetch-Dest: websocket
    Sec-Fetch-Site: same-origin
    Accept-Language: q=0.9,en-US;q=0.8,en;q=0.7
    Pragma: no-cache
    Accept-Encoding: gzip, deflate, br
    Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
    Sec-Fetch-Mode: websocket

  5. Peter Doornbosch repo owner

    Maybe you should add the csrf cookie or the play_session header to your (WebSocket connection) request, you can use the HTTP header manager for that.

    The Sec-WebSocket-Key header does not appear in the View Results, because it is not sent by the server, this header is only used in the client request. If you mean that it does not appear in the Request Headers tab in the View Results, that is indeed expected behaviour (the header is added by the websocket protocol implementation; for JMeter users this is an implementation detail they should not (have to) worry about).

    Hth,
    Peter

  6. Log in to comment