Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] cannot complete WebSocket handshake: parse_via: bad char <1> on state 100 #3525

Open
yujb-come opened this issue Nov 20, 2024 · 2 comments
Labels

Comments

@yujb-come
Copy link

yujb-come commented Nov 20, 2024

OpenSIPS version
opensips :2.4

Describe
When our system A establishes a websocket connection with opensips,
opensips fails to verify because the received connection information carries the <Via: 1.1 default.fqdn> header,and the wss handshake fails.

Relevant System Logs
opensips error log is as follows:

==================================================
Nov 15 23:08:00 [58] ERROR:core:parse_via: bad char <1> on state 100

Nov 15 23:08:00 [58] ERROR:core:parse_via: <1.1 default.fqdn

X-Forwarded-For: 10.1.1.1

Front-end-https: on

Nov 15 23:08:00 [58] ERROR:core:parse_via: via parse failed

Nov 15 23:08:00 [58] ERROR:core:get_hdr_field: bad via

Nov 15 23:08:00 [58] INFO:core:parse_headers: bad header field

Nov 15 23:08:00 [58] ERROR:proto_wss:ws_parse_req_handshake: cannot parse headers

Host: xxxx:8443

Connection: Upgrade

Pragma: no-cache

Cache-Control: no-cache

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36

Upgrade: websocket

Origin: https://xxx/

Sec-WebSocket-Version: 13

Accept-Encoding: gzip, deflate, br, zstd

Accept-Language: en-GB,en;q=0.9

Cookie: _ga=GA1.1.2080369201.1731xxx33; _ga_BC6KRKZDR1=GS1.1.1731681733.1.1.173xxx83215.60.0.0

Sec-WebSocket-Key: XoHK1r7h+nfqssssvQJiAg==

Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

Sec-WebSocket-Protocol: sip

X-Client-Ip: 10.x.xx

X-Authenticated-User: xxx

X-Authenticated-Groups: NAP_ALL_ALLOWED

Via: 1.1 default.fqdn

X-Forwarded-For: 10.x.x.x

Front-end-https: on

Nov 15 23:08:00 [58] ERROR:proto_wss:wss_read_req: cannot complete WebSocket handshake

==================================================

Expected behavior
Websocket connection can successfully establish a connection even if Via is included in the header like “Via: 1.1 default.fqdn”

Confirming the opensips source code,
it is found that even in the websocket handshake stage,
the header verification is carried out according to the rules of SIP message Via. Is this reasonable?
(trace: ws_parse_req_handshake--> parse_headers -->get_hdr_field /parse_via)

Can the handshake failure in this case be avoided?

OS/environment information

  • Operating System: centos8

Additional context
Note: The message headers from system A itself does not contain the Via header, it may be that the intermediate component of the network layer carries the Via header

@ChrisZhangJin
Copy link

HI i'm also expecting this issue to be checked by the opensips team. :)

Copy link

github-actions bot commented Dec 5, 2024

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

@github-actions github-actions bot added the stale label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants