This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Mirodin's profile picture

HTTP-API and SSL

Started by Mirodin, 22 July 2014 - 08:41 AM
Mirodin #1
Posted 22 July 2014 - 10:41 AM
Hello community,

maybe my question was asked before and I used the wrong querys. My case is that I got a server and use SSL for all my applications. Now I made myself a script in my early days with LUA to download it in a similar way Linux repos work from a http source.

The problem is, that my code does not work with my SSL-secured server so I wonder if there is a way to make CC communicate with a server using SSL.

Thanks for helping
Regards Mirodin
theoriginalbit #2
Posted 22 July 2014 - 11:28 AM
Unfortunately in order to use the Secure Socket Layer (SSL) you require the ability to create and maintain sockets, something which cannot be done in ComputerCraft.
Mirodin #3
Posted 22 July 2014 - 11:31 AM
Too bad but thanks for the answer.
theoriginalbit #4
Posted 22 July 2014 - 11:33 AM
depending on the ComputerCraft version you're using I do believe there was a Sockets Peripheral mod a few versions back, take a look int the Peripherals section.
Lyqyd #5
Posted 22 July 2014 - 03:31 PM
Um, what? It should work just fine, if you're using https. How else could we fetch files from github?
Mirodin #6
Posted 22 July 2014 - 04:07 PM
When I use the HTTP-API I get following output:


lua> a = http.get("https://[MyServer]/CC-Scripts/Script2.lua")
lua> print(type(a))
nil
1
lua>
Edited on 22 July 2014 - 02:08 PM
Anavrins #7
Posted 22 July 2014 - 04:14 PM
When I use the HTTP-API I get following output:


lua> a = http.get("https://[MyServer]/CC-Scripts/Script2.lua")
lua> print(type(a))
nil
1
lua>

That's weird, that should work, you sure that this URL works correctly when used in a browser?
Lyqyd #8
Posted 22 July 2014 - 06:06 PM
What version of ComputerCraft are you using?
Mirodin #9
Posted 22 July 2014 - 07:12 PM
That's weird, that should work, you sure that this URL works correctly when used in a browser?
Yes, if I enter this link in my Browser it prompts a Save as popup since my Firefox does not detect .lua files as plain text. I also copied this link from my browser window to avoid typos but I got the same result.

What version of ComputerCraft are you using?
Currently I am playing Direwolf20 Pack of Feed the Beast with CC Version 1.57.
zacekjakub #10
Posted 24 July 2014 - 01:39 AM
Did u try http? Is it working?
Mirodin #11
Posted 24 July 2014 - 08:48 AM
Normal HTTP requests do work, but my server is set to force https for all connections so I can not use HTTP. For said testing I disabled SSL for a short periode just to check it out.
H4X0RZ #12
Posted 24 July 2014 - 02:11 PM
maybe you block java from connecting?
zacekjakub #13
Posted 24 July 2014 - 02:13 PM
Then are you sure your firewall does not block your requests from mc server on 443? Look at apache access log for the ip you are connecting from..
Bomb Bloke #14
Posted 24 July 2014 - 02:20 PM
Wouldn't that cause problems accessing the link from a browser (something which apparently works)?
zacekjakub #15
Posted 24 July 2014 - 02:26 PM
Sry didn` t see post about that. But it still could be something about java.. What about selinux btw? Checked?
Mirodin #16
Posted 25 July 2014 - 10:56 PM
Ok, I checked my apache access.log but as far as I can see, there never was a request by CC, when I ran a http.get()… If I open the exact same address with my browser I got messages in the access.log.
Really weird imho…
zacekjakub #17
Posted 28 July 2014 - 11:08 PM
Do you have more network devices on the server? Maybe mc use any kind of bad interface? Did you check the selinux like i said before?
Mirodin #18
Posted 31 July 2014 - 10:12 AM
Do you have more network devices on the server? Maybe mc use any kind of bad interface? Did you check the selinux like i said before?

No, it is just my Apache2.
What do you mean by checking my selinux? The server is a Ubuntu 14.04 in headless mode in case you need this information.
zacekjakub #19
Posted 11 August 2014 - 12:26 AM
Selinux is not installed in Ubuntu by default, so it should not be the problem. Is it a virtual server? I have no idea what should cause this problem, maybe if you would be able to post a hdd snapshot or provide some kind of restricted acces, I could find the problem. I am getting interested in it now. :)/>
Mirodin #20
Posted 11 August 2014 - 10:21 AM
I really appreciate your help but unfortunately I can not give you access to the server (yes, it is a vserver) because I share it with my family :(/>
But if you want I can send you configs/logs you need to solve the problem. If you find a solution it can be posted here.

Cheers and thank you
Mirodin
zacekjakub #21
Posted 12 August 2014 - 01:55 AM
Ok, can you send me all mc-server directory? I can start the server myself and try if it is problem in the os or mc installation… But I gues it is problem in os…
Mirodin #22
Posted 12 August 2014 - 11:48 AM
Well, the folder is about 200MB.
Do you need the content of the "world" folder? If not, this could save ~90MB.
zacekjakub #23
Posted 13 August 2014 - 05:10 AM
No, I don't need the world. But 200mb is not a problem at all. :)/>))