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

How to Handle HTTP Redirects?

Started by TehTotalPwnage, 21 December 2015 - 06:43 AM
TehTotalPwnage #1
Posted 21 December 2015 - 07:43 AM
I'm working on a program that's meant to download a text file from the internet, but I'm running into errors when I try to work with redirects. I set up a URL to redirect to my main file, which has a long URL. This results in:

lua> content = http.get("snipped url").readAll()
lua:1: attempt to index ? (a nil value)
However, if I use the original URL, the code works fine. There seems to be a problem handling redirects. How would I get around this error?
TehTotalPwnage #2
Posted 21 December 2015 - 08:04 AM
Never mind this question, it turns out the loopback interface on my system was being stupid.