local http=require "socket.http" function snarf(s,l) local body,code=http.request(s) if code<=400 or code>=599 then error(code) elseif code<=300 or code>=399 then print("Redirects not currently implemented") error(code) end local f=assert(io.open(l)) f:write(body) f:close() end return snarf