diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-19 18:22:51 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-19 18:22:51 +0000 |
| commit | 3f1712ed48f9deab4fab67d7d342dc20c2b5b0ce (patch) | |
| tree | 4843296b98ab3524b9cbed1c6428b101e8107492 /test | |
| parent | fbb42b80cb0d299f38e0a4df9b0fa01228b39225 (diff) | |
| download | luasocket-3f1712ed48f9deab4fab67d7d342dc20c2b5b0ce.tar.gz luasocket-3f1712ed48f9deab4fab67d7d342dc20c2b5b0ce.tar.bz2 luasocket-3f1712ed48f9deab4fab67d7d342dc20c2b5b0ce.zip | |
Added gethostname.
Cleaned up TODO.
Moved luasocket specific stuff from auxiliar.c to luasocket.c
Diffstat (limited to 'test')
| -rw-r--r-- | test/httptest.lua | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/httptest.lua b/test/httptest.lua index dc90741..44266d5 100644 --- a/test/httptest.lua +++ b/test/httptest.lua | |||
| @@ -5,14 +5,15 @@ | |||
| 5 | -- needs "AllowOverride AuthConfig" on /home/c/diego/tec/luasocket/test/auth | 5 | -- needs "AllowOverride AuthConfig" on /home/c/diego/tec/luasocket/test/auth |
| 6 | dofile("noglobals.lua") | 6 | dofile("noglobals.lua") |
| 7 | 7 | ||
| 8 | local host, proxyhost, proxyport, request, response | 8 | local host, proxy, request, response |
| 9 | local ignore, expect, index, prefix, cgiprefix | 9 | local ignore, expect, index, prefix, cgiprefix |
| 10 | 10 | ||
| 11 | socket.http.TIMEOUT = 5 | ||
| 12 | |||
| 11 | local t = socket.time() | 13 | local t = socket.time() |
| 12 | 14 | ||
| 13 | host = host or "diego.princeton.edu" | 15 | host = host or "diego.student.dyn.cs.princeton.edu" |
| 14 | proxyhost = proxyhost or "localhost" | 16 | proxy = proxy or "http://localhost:3128" |
| 15 | proxyport = proxyport or 3128 | ||
| 16 | prefix = prefix or "/luasocket-test" | 17 | prefix = prefix or "/luasocket-test" |
| 17 | cgiprefix = cgiprefix or "/luasocket-test-cgi" | 18 | cgiprefix = cgiprefix or "/luasocket-test-cgi" |
| 18 | 19 | ||
| @@ -66,6 +67,7 @@ end | |||
| 66 | io.write("testing request uri correctness: ") | 67 | io.write("testing request uri correctness: ") |
| 67 | local forth = cgiprefix .. "/request-uri?" .. "this+is+the+query+string" | 68 | local forth = cgiprefix .. "/request-uri?" .. "this+is+the+query+string" |
| 68 | local back, h, c, e = socket.http.get("http://" .. host .. forth) | 69 | local back, h, c, e = socket.http.get("http://" .. host .. forth) |
| 70 | if not back then fail(e) end | ||
| 69 | back = socket.url.parse(back) | 71 | back = socket.url.parse(back) |
| 70 | if similar(back.query, "this+is+the+query+string") then print("ok") | 72 | if similar(back.query, "this+is+the+query+string") then print("ok") |
| 71 | else fail() end | 73 | else fail() end |
| @@ -129,8 +131,7 @@ request = { | |||
| 129 | method = "POST", | 131 | method = "POST", |
| 130 | body = index, | 132 | body = index, |
| 131 | headers = { ["content-length"] = string.len(index) }, | 133 | headers = { ["content-length"] = string.len(index) }, |
| 132 | proxyport = proxyport, | 134 | proxy= proxy |
| 133 | proxyhost = proxyhost | ||
| 134 | } | 135 | } |
| 135 | expect = { | 136 | expect = { |
| 136 | body = index, | 137 | body = index, |
| @@ -170,8 +171,7 @@ check_request(request, expect, ignore) | |||
| 170 | io.write("testing proxy with redirection: ") | 171 | io.write("testing proxy with redirection: ") |
| 171 | request = { | 172 | request = { |
| 172 | url = "http://" .. host .. prefix, | 173 | url = "http://" .. host .. prefix, |
| 173 | proxyhost = proxyhost, | 174 | proxy = proxy |
| 174 | proxyport = proxyport | ||
| 175 | } | 175 | } |
| 176 | expect = { | 176 | expect = { |
| 177 | body = index, | 177 | body = index, |
