Skip to content

Commit d7a9848

Browse files
committed
Merge pull request #17 from moteus/master
Change. multi iterator returns response code as data for `done` row
2 parents caa1b28 + a50ffe9 commit d7a9848

File tree

16 files changed

+18
-15
lines changed

16 files changed

+18
-15
lines changed

examples/Lua-cURL/browser.lua renamed to examples/cURLv2/browser.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-- RCS ID: $Id: browser.lua,v 0.1 2011/03/11 23:55:20 kai Exp $
55
-----------------------------------------------------------------------------
66

7-
local cURL = require("lcurl.cURL")
7+
local cURL = require("cURL")
88
local string = require("string")
99
local table = require("table")
1010
local base = _G

examples/Lua-cURL/file.lua renamed to examples/cURLv2/file.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local cURL = require("lcurl.cURL")
1+
local cURL = require("cURL")
22

33
-- open output file
44
f = io.open("example_homepage", "w")
@@ -7,9 +7,9 @@ c = cURL.easy_init()
77
-- setup url
88
c:setopt_url("http://www.example.com/")
99
-- perform, invokes callbacks
10-
c:perform({writefunction = function(str)
11-
f:write(str)
12-
end})
10+
c:perform{writefunction = function(str)
11+
f:write(str)
12+
end}
1313

1414
-- close output file
1515
f:close()
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
local cURL = require("lcurl.cURL")
1+
local cURL = require("cURL")
22

33
-- setup easy
4-
c = cURL.easy_init()
4+
c1 = cURL.easy_init()
55
c2 = cURL.easy_init()
66

77
-- setup url
8-
c:setopt_url("http://www.lua.org/")
8+
c1:setopt_url("http://www.lua.org/")
99
c2:setopt_url("http://luajit.org/")
1010

1111
m = cURL.multi_init()
12-
m:add_handle(c)
12+
m:add_handle(c1)
1313
m:add_handle(c2)
1414

1515
local f1 = io.open("lua.html","a+")
1616
local f2 = io.open("luajit.html","a+")
1717

1818
for data, type, easy in m:perform() do
1919
-- if (type == "header") then print(data) end
20-
if (type == "data" and c == easy) then f1:write(data) end
20+
if (type == "data" and c1 == easy) then f1:write(data) end
2121
if (type == "data" and c2 == easy) then f2:write(data) end
2222
end

examples/Lua-cURL/post_stream.lua renamed to examples/cURLv2/post_stream.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local cURL = require("lcurl.cURL")
1+
local cURL = require("cURL")
22

33
-- returns size and reader
44
local function make_stream(ch, n, m)

examples/Lua-cURL/rss.lua renamed to examples/cURLv2/rss.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- use LuaExpat and Lua-CuRL together for On-The-Fly XML parsing
22
local lxp = require("lxp")
3-
local cURL = require("lcurl.cURL")
3+
local cURL = require("cURL")
44

55
tags = {}
66
items = {}
@@ -14,12 +14,13 @@ function callback.StartElement(parser, tagname)
1414
end
1515
end
1616

17-
function callback.CharacterData(parser, str)
17+
function callback.CharacterData(parser, str)
1818
if (tags[#tags -1] == "item") then
1919
--we are parsing a item, get rid of trailing whitespace
2020
items[#items][tags[#tags]] = string.gsub(str, "%s*$", "")
2121
end
2222
end
23+
2324
function callback.EndElement(parser, tagname)
2425
--assuming well formed xml
2526
tags[#tags] = nil
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)