CC: Tweaked

CC: Tweaked

57M Downloads

http.get() and http.websocket() - Could not connect

Delpa opened this issue ยท 14 comments

commented

Useful information to include:

  • Minecraft version: 1.14.4 Java and 1.16.4 Java
  • CC: Tweaked version: cc-tweaked-1.14.4-1.89.2.jar and cc-tweaked-1.16.4-1.95.2.jar

Message

Hi, I have an error.
when i run this i can't connect (i test this on minecraft version 1.14.4 and 1.16.4)

print(http.get("https://www.delpaqq.com/")) -> Error said nil Could not connect nil
print(http.get("https://www.google.com/")) -> I succeed
print(http.get("https://www.facebook.com/")) -> Error nil Could not connect nil

Same error when use websockets
local myURL = "wss://sockets.delpaqq.com"
local ws = http.websocket(myURL) -->false Could not connect

I tried this on the website and they are all successful.

In my server(delpaqq.com) with nginx I receive that the connection is with SSLv3 and it is rejected (This SSLv3 version has been rejected for years, now TLSv1 is used up to TLSv1.3)

I appreciate any assistance anyone can provide.
##Logs
2021-01-24-1.log.gz
2021-01-24-2.log.gz
2021-01-24-3.log.gz
2021-01-24-4.log.gz
2021-01-24-5.log.gz

commented

Had another look at this, and I've made the system a little more lenient. I'm afraid I can't really fix the whole problem, so this is as good as it's going to get.

commented

It's CC against Aternos' terms of service? I'm fairly sure they disallow mods with allow users to run code, which CC does.

commented

It's CC against Aternos' terms of service? I'm fairly sure they disallow mods with allow users to run code, which CC does.

Not super familiar with their ToS, but I do know mods have to be added and approved by the people who run Aternos. They wouldn't add a mod that they don't want people to use.

commented

Sorry if this isn't the right place to ask this, but is there a way to work around the Java version requirement? I'm trying to set something up on a server that's being hosted with Aternos, and I don't have control over the server's java version (1.8.0_51).

commented

Not without the server operators intervention, they have to either update Java, or install a mod that adds the Let's Encrypt certificate to it -> https://www.curseforge.com/minecraft/mc-mods/letsencryptcraft

commented

If you haven't already, it's worth updating to the latest Java and making sure the Minecraft launcher is using that version (rather than its built-in one).

Older versions of Java (including the one bundled by the launcher) don't include the Let's Encrypt root cert, and so reject any sites using it.

Edit now that I'm at a computer: You're running 1.8.0_51 - you need 1.8.0_101 or later. The best thing to do is install a version from here and point Minecraft towards it (it's in the "more options" bit of the launcher profile).

commented

Thanks, I have tried updating the minecraft "jre" and the http.get () already works.

With websockets, I still get the message "Could not connect", I have tested on the website using "wss: //sockets.delpaqq.com" and on other online websockets testers and they all connect and receive information.

commented

Well this is fun. Netty is advertising that it supports the permessage-deflate extension in its initial request:

Host: example.tweaked.cc
Sec-websocket-version: 13
Sec-websocket-extensions: permessage-deflate;client_max_window_bits,deflate-frame,x-webkit-deflate-frame
Connection: upgrade
Upgrade: websocket
Sec-websocket-origin: https://example.tweaked.cc
Sec-websocket-key: +wymtKGF86gInmHgxfxh/A==

However, when receiving that extension it claims it doesn't know about it:

io.netty.handler.codec.CodecException: invalid WebSocket Extension handhshake for "permessage-deflate; server_no_context_takeover; client_no_context_takeover; server_max_window_bits=10"
        at io.netty.handler.codec.http.websocketx.extensions.WebSocketClientExtensionHandler.channelRead(WebSocketClientExtensionHandleComputerCraft-Netty-0[1] r.java:111)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)

The issue here is the client_no_context_takeover and server_no_context_takeover extensions, which Netty rejects by default. We'll need to create our own subclass of WebSocketClientCompressionHandler which enables these extensions - it's not entirely clear why they're disabled by default, so probably worth doing some investigation first.

A temporary workaround would be to disable these extensions on your server.

commented

Thanks <3,
I have disabled compression in nginx and node.js of the websocket and it is already working

commented

We'll need to create our own subclass of WebSocketClientCompressionHandler which enables these extensions

Had a look at this last weekend, and it's irritatingly more complex than that. We need to support servers which request this extension, but not request it by default. From what I can tell, Netty has a bit of an all-or-nothing approach.

commented

Tentatively putting this to be fixed in 1.97.1. I'm still not any clearer on quite how websocket extensions are meant to work in netty, but should also have a few days free to look into it.

commented

Hi, same error here, impossible to GET a website who use a let's encrypt cert and I'm using Java 1.8.0.291.

commented

Hi, same error here, impossible to GET a website who use a let's encrypt cert and I'm using Java 1.8.0.291.

I seem to remember fixing this by updating my java version, might be worth a try.

commented

Hi, same error here, impossible to GET a website who use a let's encrypt cert and I'm using Java 1.8.0.291.

I seem to remember fixing this by updating my java version, might be worth a try.

1.8.0.291 is the most recent version.