Skip to content

Commit 47c3774

Browse files
committed
Merge pull request #13 from moteus/master
Rename module name in rockspec and update readme
2 parents 673152f + c2f8fc9 commit 47c3774

4 files changed

Lines changed: 64 additions & 16 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ before_install:
2222
- sudo luarocks install lua-path
2323

2424
install:
25-
- sudo luarocks make rockspecs/lcurl-scm-0.rockspec CFLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs" LIBFLAG="-shared --coverage"
25+
- sudo luarocks make rockspecs/lua-curl-scm-0.rockspec CFLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs" LIBFLAG="-shared --coverage"
2626

2727
script:
2828
- cd test

README.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,38 @@
11
# Lua binding to [libcurl](http://curl.haxx.se/libcurl)
2-
[![Build Status](https://travis-ci.org/Lua-cURL/lua-lcurl.png?branch=master)](https://travis-ci.org/Lua-cURL/lua-lcurl)
3-
[![Coverage Status](https://coveralls.io/repos/Lua-cURL/lua-lcurl/badge.png?branch=master)](https://coveralls.io/r/Lua-cURL/lua-lcurl?branch=master)
2+
[![Build Status](https://travis-ci.org/Lua-cURL/Lua-cURLv3.svg?branch=master)](https://travis-ci.org/Lua-cURL/Lua-cURLv3)
3+
[![Coverage Status](https://coveralls.io/repos/Lua-cURL/Lua-cURLv3/badge.png?branch=master)](https://coveralls.io/r/Lua-cURL/Lua-cURLv3?branch=master)
44
[![Licence](http://img.shields.io/badge/Licence-MIT-brightgreen.svg)](LICENSE)
55

6+
##Status
7+
8+
This module include three layer
9+
10+
1. `lcurl` module provide low level pure C binding to libcurl.<br/>
11+
Almost ready and needs tests. I have no plans to change this API.
12+
13+
2. `cURL` module provide compatibility for Lua-cURLv2 API.<br/>
14+
Almost ready and needs tests.
15+
16+
3. `cURL` module provide new high level API.<br/>
17+
In fact for now it provide `lcurl` API directly and needed to redesign.<br/>
18+
19+
620
## Documentation
7-
[API](http://moteus.github.com/lcurl)<br/>
8-
Also library provide `lcurl.cURL` compatibility module for [Lua-cURL](http://lua-curl.github.io/Lua-cURL) binding.
21+
[lcurl API](http://moteus.github.com/lcurl)<br/>
22+
[Lua-cURLv2 API](http://lua-curl.github.io/Lua-cURL)<br/>
23+
Lua-cURLv3 API - TODO
924

10-
## Why one more curl binding
25+
##
1126

12-
Existing [Lua-cURL](http://lua-curl.github.io/Lua-cURL) binding has several problems:
27+
Lua-cURLv2 binding has several problems:
1328

1429
* it can not return error codes but just raise Lua errors
1530
* it raise Lua error from callback that may result resource leak in libcurl
1631
* it does not provide building multipart/formdata explicitly
1732
* it has memory leak when send multipart/formdata
1833
* it does not save string for curl options that may result crush in libcurl
1934
* there no way to get result for operations in multi interface (e.g. if one of easy operation fail you can not get result code/error message)
20-
* you can not use multi interface for upload operation
35+
* you can not use multi interface for upload operation (?)
2136
* you can not use your own callback function to perform operation with multi interface
2237
* you can not pass your context to callback functions
2338

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
package = "lcurl"
1+
package = "Lua-cURL"
22
version = "scm-0"
33
source = {
4-
url = "https://github.com/moteus/lua-lcurl/archive/master.zip",
5-
dir = "lua-lcurl-master",
4+
url = "https://github.com/Lua-cURL/Lua-cURLv3/archive/master.zip",
5+
dir = "Lua-cURLv3-master",
66
}
77

88
description = {
99
summary = "Lua binding to libcurl",
1010
detailed = [[
1111
]],
12-
homepage = "https://github.com/moteus/lua-lcurl",
13-
license = "MIT/X11"
12+
homepage = "https://github.com/Lua-cURL",
13+
license = "MIT/X11"
1414
}
1515

1616
dependencies = {
17-
"lua >= 5.1"
17+
"lua >= 5.1, < 5.3"
1818
}
1919

2020
external_dependencies = {
@@ -57,15 +57,15 @@ build = {
5757
},
5858

5959
modules = {
60+
cURL = "src/lua/cURL.lua",
6061
lcurl = {
6162
sources = {
6263
"src/l52util.c", "src/lceasy.c", "src/lcerror.c",
6364
"src/lchttppost.c", "src/lcurl.c", "src/lcutils.c",
64-
"src/lcmulti.c", "src/lcshare.c",
65+
"src/lcmulti.c", "src/lcshare.c",
6566
},
6667
incdirs = { "$(CURL_INCDIR)" },
6768
libdirs = { "$(CURL_LIBDIR)" }
6869
},
69-
["lcurl.cURL"] = "src/lua/cURL.lua",
7070
}
7171
}

test/test_safe.lua

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,4 +242,37 @@ end
242242

243243
end
244244

245+
local _ENV = TEST_CASE'objects_have_same_metatables' do
246+
247+
local scurl = require "lcurl.safe"
248+
local curl = require "lcurl"
249+
local e1, e2, m
250+
251+
function teardown()
252+
if m then m:close() end
253+
if e1 then e1:close() end
254+
if e2 then e2:close() end
255+
e1, e2, m = nil
256+
end
257+
258+
function test_1()
259+
e1 = assert(scurl.easy())
260+
e2 = assert(curl.easy())
261+
m = assert(scurl.multi())
262+
263+
assert_equal(m, m:add_handle(e1))
264+
assert_equal(m, m:add_handle(e2))
265+
end
266+
267+
function test_2()
268+
e1 = assert(scurl.easy())
269+
e2 = assert(curl.easy())
270+
m = assert(curl.multi())
271+
272+
assert_equal(m, m:add_handle(e1))
273+
assert_equal(m, m:add_handle(e2))
274+
end
275+
276+
end
277+
245278
if not HAS_RUNNER then lunit.run() end

0 commit comments

Comments
 (0)