aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-01-19 18:22:51 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-01-19 18:22:51 +0000
commit3f1712ed48f9deab4fab67d7d342dc20c2b5b0ce (patch)
tree4843296b98ab3524b9cbed1c6428b101e8107492 /test
parentfbb42b80cb0d299f38e0a4df9b0fa01228b39225 (diff)
downloadluasocket-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.lua16
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
6dofile("noglobals.lua") 6dofile("noglobals.lua")
7 7
8local host, proxyhost, proxyport, request, response 8local host, proxy, request, response
9local ignore, expect, index, prefix, cgiprefix 9local ignore, expect, index, prefix, cgiprefix
10 10
11socket.http.TIMEOUT = 5
12
11local t = socket.time() 13local t = socket.time()
12 14
13host = host or "diego.princeton.edu" 15host = host or "diego.student.dyn.cs.princeton.edu"
14proxyhost = proxyhost or "localhost" 16proxy = proxy or "http://localhost:3128"
15proxyport = proxyport or 3128
16prefix = prefix or "/luasocket-test" 17prefix = prefix or "/luasocket-test"
17cgiprefix = cgiprefix or "/luasocket-test-cgi" 18cgiprefix = cgiprefix or "/luasocket-test-cgi"
18 19
@@ -66,6 +67,7 @@ end
66io.write("testing request uri correctness: ") 67io.write("testing request uri correctness: ")
67local forth = cgiprefix .. "/request-uri?" .. "this+is+the+query+string" 68local forth = cgiprefix .. "/request-uri?" .. "this+is+the+query+string"
68local back, h, c, e = socket.http.get("http://" .. host .. forth) 69local back, h, c, e = socket.http.get("http://" .. host .. forth)
70if not back then fail(e) end
69back = socket.url.parse(back) 71back = socket.url.parse(back)
70if similar(back.query, "this+is+the+query+string") then print("ok") 72if similar(back.query, "this+is+the+query+string") then print("ok")
71else fail() end 73else 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}
135expect = { 136expect = {
136 body = index, 137 body = index,
@@ -170,8 +171,7 @@ check_request(request, expect, ignore)
170io.write("testing proxy with redirection: ") 171io.write("testing proxy with redirection: ")
171request = { 172request = {
172 url = "http://" .. host .. prefix, 173 url = "http://" .. host .. prefix,
173 proxyhost = proxyhost, 174 proxy = proxy
174 proxyport = proxyport
175} 175}
176expect = { 176expect = {
177 body = index, 177 body = index,