mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-25 22:14:09 -04:00
Merge branch 'master' of github.com:MightyPirates/OpenComputers into MC1.7
This commit is contained in:
commit
fed7f32ad7
@ -31,11 +31,18 @@ function internet.request(url, data)
|
|||||||
end
|
end
|
||||||
|
|
||||||
return function()
|
return function()
|
||||||
local data, reason = result.read()
|
while true do
|
||||||
if not data and reason then
|
local data, reason = result.read()
|
||||||
error(reason, 2)
|
if not data then
|
||||||
else
|
if reason then
|
||||||
return data
|
error(reason, 2)
|
||||||
|
else
|
||||||
|
return nil -- eof
|
||||||
|
end
|
||||||
|
elseif #data > 0 then
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
-- else: no data, block
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -244,17 +244,22 @@ sandbox._G = sandbox
|
|||||||
-- wrap and isolate it, to make sure it can't be touched by user code.
|
-- wrap and isolate it, to make sure it can't be touched by user code.
|
||||||
-- These functions provide the logic for wrapping and unwrapping (when
|
-- These functions provide the logic for wrapping and unwrapping (when
|
||||||
-- pushed to user code and when pushed back to the host, respectively).
|
-- pushed to user code and when pushed back to the host, respectively).
|
||||||
local wrapUserdata, wrapSingleUserdata, unwrapUserdata
|
local wrapUserdata, wrapSingleUserdata, unwrapUserdata, wrappedUserdataMeta
|
||||||
local wrappedUserdata = setmetatable({}, {
|
wrappedUserdataMeta = {
|
||||||
-- Weak keys, clean up once a proxy is no longer referenced anywhere.
|
-- Weak keys, clean up once a proxy is no longer referenced anywhere.
|
||||||
__mode="k",
|
__mode="k",
|
||||||
-- We need custom persist logic here to avoid ERIS trying to save the
|
-- We need custom persist logic here to avoid ERIS trying to save the
|
||||||
-- userdata referenced in this table directly. It will be repopulated
|
-- userdata referenced in this table directly. It will be repopulated
|
||||||
-- in the load methods of the persisted userdata wrappers (see below).
|
-- in the load methods of the persisted userdata wrappers (see below).
|
||||||
__persist = function()
|
__persist = function()
|
||||||
return function() return {} end
|
return function()
|
||||||
|
-- When using special persistence we have to manually reassign the
|
||||||
|
-- metatable of the persisted value.
|
||||||
|
return setmetatable({}, wrappedUserdataMeta)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
})
|
}
|
||||||
|
local wrappedUserdata = setmetatable({}, wrappedUserdataMeta)
|
||||||
|
|
||||||
local function processArguments(...)
|
local function processArguments(...)
|
||||||
local args = table.pack(...)
|
local args = table.pack(...)
|
||||||
|
@ -269,14 +269,16 @@ object InternetCard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Request(val owner: Option[InternetCard] = None) extends AbstractValue {
|
class Request extends AbstractValue {
|
||||||
|
private var owner: Option[InternetCard] = None
|
||||||
private var url: URL = null
|
private var url: URL = null
|
||||||
private var post: Option[String] = None
|
private var post: Option[String] = None
|
||||||
private var data: Option[Array[Byte]] = None
|
private var data: Option[Array[Byte]] = None
|
||||||
private var error: Option[String] = None
|
private var error: Option[String] = None
|
||||||
|
|
||||||
def this(owner: InternetCard, url: URL, post: Option[String]) {
|
def this(owner: InternetCard, url: URL, post: Option[String]) {
|
||||||
this(Option(owner))
|
this()
|
||||||
|
this.owner = Option(owner)
|
||||||
this.url = url
|
this.url = url
|
||||||
this.post = post
|
this.post = post
|
||||||
scheduleRequest()
|
scheduleRequest()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user