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

Getting 426 Error when connecting via curl command #386

Closed
LanceLake opened this issue Nov 5, 2019 · 11 comments
Closed

Getting 426 Error when connecting via curl command #386

LanceLake opened this issue Nov 5, 2019 · 11 comments

Comments

@LanceLake
Copy link

Issue type

Bug report

Description

When I execute the following code (CFML)..

it returns an error code 426.
https://prnt.sc/pstskv

It shouldn't fail to process because a patch is out (speaking of which, does anyone know how to solve this issue on a windows machine)?

Steps to reproduce and other useful info

Execute above code which connects to the server and it returns a 426.

2019-11-05 07-17-56.txt

Technical information
  • Operating System : Windows 10
  • OBS Studio version : 24.0.1
@Palakis
Copy link
Collaborator

Palakis commented Nov 7, 2019

@LanceLake obs-websocket doesn't support plain http requests right now.

It shouldn't fail to process because a patch is out

What patch?

@LanceLake
Copy link
Author

obs-websocket doesn't support plain http requests right now.

Well, it's responding to a call and there are websites out there that do calls to it. For example..

https://t2t2.github.io/obs-tablet-remote/

So yeah. It does allow for http requests.

What patch?

Please see first link.

Upgrade Required Server: Websocket++/0.8.1

Please see here (https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/426) for more info about the error.

"The HTTP 426 Upgrade Required client error response code indicates that the server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol."

So how do I solve this issue?

@Palakis
Copy link
Collaborator

Palakis commented Nov 7, 2019

Well, it's responding to a call and there are websites out there that do calls to it. For example..
https://t2t2.github.io/obs-tablet-remote/

t2t2's obs-tablet-remote uses WebSockets, not plain HTTP calls.

@LanceLake
Copy link
Author

Correct. I'm also using a websocket call. Hence the error.

@dodgepong
Copy link
Member

I think your OP is missing information:

When I execute the following code (CFML)..

it returns an error code 426.

There is no code provided in that blank.

@LanceLake
Copy link
Author

LanceLake commented Nov 7, 2019

It is a HTTP code.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/426

"The HTTP 426 Upgrade Required client error response code indicates that the server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol."

The plugin is refusing the request using the current protocol and it needs to be upgraded to Websocket++/0.8.1 as that is now the standard for websocket connections thru HTTP.

@dodgepong
Copy link
Member

I know what an HTTP response code is. I'm saying that the way your OP is worded, it sounds like you were trying to insert a code sample of CFML, but nothing appeared in the post.

"When I execute the following code..." What code are you executing? You've reported the error code but not the code that generated it. Your reproduction steps say "Execute above code which connects to the server and it returns a 426" but there is no code to execute to reproduce.

Regardless, if the error you're getting is a 426, that means the code on your side needs to be upgraded, not on the obs-websocket side. Your code is the client, obs-websocket is the server, and the client is what needs to be upgraded. What version of ColdFusion are you running?

@Palakis
Copy link
Collaborator

Palakis commented Nov 7, 2019

@LanceLake What websockets library/function do you use in your code?

@LanceLake
Copy link
Author

LanceLake commented Nov 8, 2019

This is the code I'm using..

<cfhttp method="Get" url="http://[IP ADDRESS AND PORT DELETED FOR SECURITY REASONS]/">
	<cfhttpparam name="request-type" type="body" value='{"GetAuthRequired":""}'> 
	<cfhttpparam name="message-id" type="body" value='1'> 
</cfhttp> 

<cfdump var="#cfhttp#">

There is no webserver set up on the computer. If I don't run OBS, it's not connecting (as expected).

When I run the code again, I get this error..

HTTP/1.1 426 Upgrade Required Server: WebSocket++/0.8.1

The server I'm checking from is running Lucee 5.3.2.77 with Lucee Websockets extension of 2.0.3. Considering how it didn't work at all when OBS wasn't started and my websockets are as up to date as possible, perhaps when it says server, it meant the plugin since that's where I'm pulling pages from. Am I mistaken?

@LanceLake
Copy link
Author

Failing that.. Is there any way to be able to call remotely having a source turn on? That's all I want to do.. Have an alert in streamelements run some JS code to contact my computer and activate a source when it's run (via an alert).

@ItsFlo
Copy link

ItsFlo commented Dec 4, 2019

Well, it's responding to a call and there are websites out there that do calls to it.

It´s responding because for a websocket you send a normal http header but with a request to upgrade the protocol.
After that it´s not http anymore, so it doesn´t send a body and the connection stays open.

In your request you didn´t upgrade the protocol.
Since this plugin only accepts websocket requests and doesn´t serve http requests you get the error that the upgrade is REQUIRED.

cfhttp sends a normal http request, waits for it to complete and returns the result body.
So if you send the right headers for a websocket upgrade, it just times out because the http request is never finished by the server.

The plugin is refusing the request using the current protocol and it needs to be upgraded to Websocket++/0.8.1 as that is now the standard for websocket connections thru HTTP.

HTTP/1.1 426 Upgrade Required Server: WebSocket++/0.8.1

The response header "Server: WebSocket++/0.8.1" is just an information that the underlying websocket-server, that is used in this plugin, sends (WebSocket++ is the name of the project and 0.8.1 is the current version that is running.) .
This doesn´t have anything to do with the http-error, it is in every response header by this server.

The server I'm checking from is running Lucee 5.3.2.77 with Lucee Websockets extension of 2.0.3.

The websocket extension afaik only adds a websocket server, but no client functionality.

Instead of these cfml tags you could use plain Javascript

var socket = new Websocket("ws://localhost:4444");
socket.send( "requests as stated in docs/generated/protocol.md" );
socket.close();

@tt2468 tt2468 closed this as completed Apr 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants