-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Add Websocket Upgrade Test #5613
base: master
Are you sure you want to change the base?
Conversation
If the impelentation of a new monitor breaks an existing monitor, this is a merge blocker. |
Executing curl seems a bit like a bodge.. unsure if this is the way to go. If the service that is being monitored is non compliant, then we should throw an error notifying the user. I would like for this monitor to be the least amount of "special" that we can get away with |
Please also make sure that you add a short little testcase to ensure that this monitor keeps working here. Please also update the docs (the readme) with the new monitoring type |
@PoleTransformer really appreciate your effort, I was about to report the same request and prepare a PR =) |
In my previous implementation, I forced a timeout on curl that closes the connection after 1 second. The ping will only show around 1000ms. I fixed this in my latest implementation.
I agree. After rethinking my ideas, I decided to ditch using curl. It is not native and adds unnecessary dependencies.
I have added a test file that currently tests:
|
@masim05 Thank you. I switched to using |
@CommanderStorm It seems like Macos, Ubuntu, and Windows are unable to establish a insecure ws connection. These platforms fail the insecure testcase, everything else passes. For some reason generic ARM64 passes the test. Do you know why this is? |
I have no clue. If insecure connections don't work on some platforms, we at least have to put up a warning (otherwise, supporting issues caused the monitor would be horrible ^^) |
I am very confused about this. I know browsers won't let you establish insecure connections over an existing secure connection ie http on a https website. Could this be related to security policy set in CI? Im still stumped at why generic arm64 passes the test. I will do further testing and research. I have midterms coming up as well and wish you the best in your studies. |
@CommanderStorm Thanks for all your inputs. Got rid of For now, I simply spin up a ws server in the test file and perform the test that way locally, which passes without issue. |
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma
Tick the checkbox if you understand [x]:
Description
Fixes #805
Uses native Websocket API to upgrade to Websocket connection. If the closing response code is 1000(Normal Closure), returns success. Gives user the choice to test non compliant Websocket servers that don't respond with the correct headers. By default conforms to RFC6455.
Uses curl to send websocket headers and look at the response. If the response is 101(switching protocols), returns success. I couldn't find a super elegant way to close the connection after upgrade, so I set a timeout that closes the connection after 1 second. This breaks the ping feature, which will always return 1024ms all the time. If anyone knows of a better way to close the websocket connection, while keeping the ping feature, please let me know. I initially wanted to use the builtin js websocket library, but some non compliant websocket servers don't return the Sec-WebSocket-Accept header, which causes websocket to error out. I left my implementation commented out in case someone wants to work on it. @louislamType of change
Please delete any options that are not relevant.
Checklist
Screenshots (if any)
Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.