I'd guess that if you stuck some more print statements in there (to better track the flow of your script), you'd find the point where it halts is where you call http.get() - presumably it's waiting for a response and, for whatever reason, isn't getting one. This may or may not be related to the user agent.
Bear in mind that if
http.get() decides to fail, it'll return nil, not false.
You could create a version of http.get() which only "waits" a certain amount of time like this:
Spoiler
function http.timedGet(url, headers, time)
http.request(url, headers)
if type(time) == "number" then time = os.startTimer(time) end
while true do
local event, par1, par2 = os.pullEvent()
if event == "http_success" and par1 == url then
return par2
elseif (event == "http_failure" and par == url) or (event == "timer" and par == time) then
return nil
end
end
end
Eg, http.timedGet("
http://base64.netne.net/?b64encode=hello", nil, 5) will return within five seconds, for better or worse.
It may or may not help if you parse "msg" through
textutils.urlEncode().
Personally I use
Package for handling base64, though there are also other APIs that've been posted on these boards for similar purposes. The conversions can be handled easily within Lua, so relying on an external server to handle them seems like more trouble than it's worth?
Just in regards to your semantics, base64
encoding is not a form of
encryption.