Hi,
I was trying to use the Websocket Client CLI to connect with Geckodriver / Firefox, but it seems that Geckodriver has an issue with connections from localhost. See here and here for more details.
This is what is shown in the client console --
Here is the captured HTTP request and response --
I've confirmed that the connection is allowed if the "Origin" details are omitted from the HTTP upgrade request. Is there any way to configure sgcWebSocketClient.exe to not include the origin in the HTTP request?
TIA, Dan
I was trying to use the Websocket Client CLI to connect with Geckodriver / Firefox, but it seems that Geckodriver has an issue with connections from localhost. See here and here for more details.
This is what is shown in the client console --
{"event": "error", "description": "Error Decoding Header: Switching Protocols [HTTP/1.1 400 Bad Request]"}
{"event": "disconnected", "code": 0}
Here is the captured HTTP request and response --
Frame 435: 260 bytes on wire (2080 bits), 260 bytes captured (2080 bits) on interface \Device\NPF_Loopback, id 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 56835, Dst Port: 9222, Seq: 1, Ack: 1, Len: 216
Source Port: 56835
Destination Port: 9222
[Stream index: 5]
[Conversation completeness: Complete, WITH_DATA (31)]
[TCP Segment Len: 216]
Sequence Number: 1 (relative sequence number)
Sequence Number (raw): 2973920447
[Next Sequence Number: 217 (relative sequence number)]
Acknowledgment Number: 1 (relative ack number)
Acknowledgment number (raw): 555817769
0101 .... = Header Length: 20 bytes (5)
Flags: 0x018 (PSH, ACK)
Window: 8442
[Calculated window size: 2161152]
[Window size scaling factor: 256]
Checksum: 0xfffa [unverified]
[Checksum Status: Unverified]
Urgent Pointer: 0
[Timestamps]
[SEQ/ACK analysis]
TCP payload (216 bytes)
Hypertext Transfer Protocol
GET /session/afbb4b0c-aed8-45db-b16e-baba587e7369 HTTP/1.1\r\n
Host: 127.0.0.1:9222\r\n
Upgrade: websocket\r\n
Connection: Upgrade\r\n
Sec-WebSocket-Key: Fz/9gz4uVaJHZU8885/ryQ==\r\n
Origin: 127.0.0.1\r\n
Sec-WebSocket-Version: 13\r\n
\r\n
[Full request URI: http://127.0.0.1:9222/session/afbb4b0c-aed8-45db-b16e-baba587e7369]
[HTTP request 1/1]
[Response in frame: 457]
Frame 457: 195 bytes on wire (1560 bits), 195 bytes captured (1560 bits) on interface \Device\NPF_Loopback, id 0
Section number: 1
Interface id: 0 (\Device\NPF_Loopback)
Encapsulation type: NULL/Loopback (15)
Arrival Time: Nov 7, 2022 19:09:33.752941000 Central Standard Time
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1667869773.752941000 seconds
[Time delta from previous captured frame: 0.000023000 seconds]
[Time delta from previous displayed frame: 0.001845000 seconds]
[Time since reference or first frame: 18.164051000 seconds]
Frame Number: 457
Frame Length: 195 bytes (1560 bits)
Capture Length: 195 bytes (1560 bits)
[Frame is marked: True]
[Frame is ignored: False]
[Protocols in frame: null:ip:tcp:http:data-text-lines]
[Coloring Rule Name: HTTP]
[Coloring Rule String: http || tcp.port == 80 || http2]
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
0100 .... = Version: 4
.... 0101 = Header Length: 20 bytes (5)
Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
Total Length: 191
Identification: 0x2918 (10520)
010. .... = Flags: 0x2, Don't fragment
...0 0000 0000 0000 = Fragment Offset: 0
Time to Live: 128
Protocol: TCP (6)
Header Checksum: 0x0000 [validation disabled]
[Header checksum status: Unverified]
Source Address: 127.0.0.1
Destination Address: 127.0.0.1
Transmission Control Protocol, Src Port: 9222, Dst Port: 56835, Seq: 1, Ack: 217, Len: 151
Source Port: 9222
Destination Port: 56835
[Stream index: 5]
[Conversation completeness: Complete, WITH_DATA (31)]
[TCP Segment Len: 151]
Sequence Number: 1 (relative sequence number)
Sequence Number (raw): 555817769
[Next Sequence Number: 152 (relative sequence number)]
Acknowledgment Number: 217 (relative ack number)
Acknowledgment number (raw): 2973920663
0101 .... = Header Length: 20 bytes (5)
Flags: 0x018 (PSH, ACK)
Window: 8441
[Calculated window size: 2160896]
[Window size scaling factor: 256]
Checksum: 0x0b33 [unverified]
[Checksum Status: Unverified]
Urgent Pointer: 0
[Timestamps]
[SEQ/ACK analysis]
TCP payload (151 bytes)
Hypertext Transfer Protocol
HTTP/1.1 400 Bad Request\r\n
[Expert Info (Chat/Sequence): HTTP/1.1 400 Bad Request\r\n]
Response Version: HTTP/1.1
Status Code: 400
[Status Code Description: Bad Request]
Response Phrase: Bad Request
Server: httpd.js\r\n
Content-Type: text/plain\r\n
Content-Length: 59\r\n
\r\n
[HTTP response 1/1]
[Time since request: 0.001871000 seconds]
[Request in frame: 435]
[Request URI: http://127.0.0.1:9222/session/afbb4b0c-aed8-45db-b16e-baba587e7369]
File Data: 59 bytes
Line-based text data: text/plain (1 lines)
The handshake request has incorrect Origin header 127.0.0.1
I've confirmed that the connection is allowed if the "Origin" details are omitted from the HTTP upgrade request. Is there any way to configure sgcWebSocketClient.exe to not include the origin in the HTTP request?
TIA, Dan