Changes between Version 4 and Version 5 of develop


Ignore:
Timestamp:
2013-04-14 06:06:52 (11 years ago)
Author:
futzle
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • develop

    v4 v5  
    2626  s:settimeout(timeout) 
    2727  return s 
     28end 
     29}}} 
     30 
     31== Checking that the proxy is running == 
     32 
     33Your plugin should check that the proxy is running, by querying its API version string. 
     34 
     35{{{ 
     36local ProxyApiVersion 
     37local t = {} 
     38local request, code = http.request({ 
     39  url = "http://localhost:2529/version", 
     40  create = socketWithTimeout(2), 
     41  sink = ltn12.sink.table(t) 
     42}) 
     43 
     44if (request == nil and code == "timeout") then 
     45  -- Proxy may be busy (retry). 
     46elseif (request == nil and code ~= "closed") then 
     47  -- Proxy not running. 
     48else 
     49    -- Proxy is running, note its version number. 
     50    ProxyApiVersion = table.concat(t) 
    2851end 
    2952}}}