aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2006-04-03 03:10:56 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2006-04-03 03:10:56 +0000
commite9d477aba3bbc084c0a7872e4eaf725e2689e4a6 (patch)
tree7f6a514fab405c4de2bb983f601af2dbb3cfdc5d
parent71213595260923f9d7cc7d41bb8b7b6227c1da01 (diff)
downloadluasocket-e9d477aba3bbc084c0a7872e4eaf725e2689e4a6.tar.gz
luasocket-e9d477aba3bbc084c0a7872e4eaf725e2689e4a6.tar.bz2
luasocket-e9d477aba3bbc084c0a7872e4eaf725e2689e4a6.zip
Final patches...
-rw-r--r--config20
-rw-r--r--src/http.lua2
-rw-r--r--test/auth/.htaccess2
-rw-r--r--test/auth/.htpasswd2
-rw-r--r--test/httptest.lua17
-rw-r--r--test/testmesg.lua7
6 files changed, 33 insertions, 17 deletions
diff --git a/config b/config
index f26b12e..3954974 100644
--- a/config
+++ b/config
@@ -37,20 +37,20 @@ INSTALL_EXEC=cp
37# Compiler and linker settings 37# Compiler and linker settings
38# for Mac OS X 38# for Mac OS X
39# 39#
40CC=gcc 40#CC=gcc
41DEF=-DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN 41#DEF=-DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN
42CFLAGS= $(LUAINC) -I$(COMPAT) $(DEF) -pedantic -Wall -O2 -fno-common 42#CFLAGS= $(LUAINC) -I$(COMPAT) $(DEF) -pedantic -Wall -O2 -fno-common
43LDFLAGS=-bundle -undefined dynamic_lookup 43#LDFLAGS=-bundle -undefined dynamic_lookup
44LD=export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc 44#LD=export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc
45 45
46#------ 46#------
47# Compiler and linker settings 47# Compiler and linker settings
48# for Linux 48# for Linux
49#CC=gcc 49CC=gcc
50#DEF=-DLUASOCKET_DEBUG 50DEF=-DLUASOCKET_DEBUG
51#CFLAGS= $(LUAINC) -I$(COMPAT) $(DEF) -pedantic -Wall -O2 -fpic 51CFLAGS= $(LUAINC) -I$(COMPAT) $(DEF) -pedantic -Wall -O2 -fpic
52#LDFLAGS=-O -shared 52LDFLAGS=-O -shared
53#LD=gcc 53LD=gcc
54 54
55#------ 55#------
56# End of makefile configuration 56# End of makefile configuration
diff --git a/src/http.lua b/src/http.lua
index e002a8c..bfa0345 100644
--- a/src/http.lua
+++ b/src/http.lua
@@ -226,9 +226,9 @@ local default = {
226local function adjustrequest(reqt) 226local function adjustrequest(reqt)
227 -- parse url if provided 227 -- parse url if provided
228 local nreqt = reqt.url and url.parse(reqt.url, default) or {} 228 local nreqt = reqt.url and url.parse(reqt.url, default) or {}
229 local t = url.parse(reqt.url, default)
230 -- explicit components override url 229 -- explicit components override url
231 for i,v in base.pairs(reqt) do nreqt[i] = v end 230 for i,v in base.pairs(reqt) do nreqt[i] = v end
231 if nreqt.port == "" then nreqt.port = 80 end
232 socket.try(nreqt.host, "invalid host '" .. base.tostring(nreqt.host) .. "'") 232 socket.try(nreqt.host, "invalid host '" .. base.tostring(nreqt.host) .. "'")
233 -- compute uri if user hasn't overriden 233 -- compute uri if user hasn't overriden
234 nreqt.uri = reqt.uri or adjusturi(nreqt) 234 nreqt.uri = reqt.uri or adjusturi(nreqt)
diff --git a/test/auth/.htaccess b/test/auth/.htaccess
index 31e1123..b9f100e 100644
--- a/test/auth/.htaccess
+++ b/test/auth/.htaccess
@@ -1,4 +1,4 @@
1AuthName "Test Realm" 1AuthName "Test Realm"
2AuthType Basic 2AuthType Basic
3AuthUserFile /Users/diego/tec/luasocket/test/auth/.htpasswd 3AuthUserFile /home/diego/tec/luasocket/test/auth/.htpasswd
4require valid-user 4require valid-user
diff --git a/test/auth/.htpasswd b/test/auth/.htpasswd
index 824bac9..fd9002b 100644
--- a/test/auth/.htpasswd
+++ b/test/auth/.htpasswd
@@ -1 +1 @@
luasocket:JFMQjUyOPu3yk luasocket:l8n2npozPB.sQ
diff --git a/test/httptest.lua b/test/httptest.lua
index c05b4cc..92528b2 100644
--- a/test/httptest.lua
+++ b/test/httptest.lua
@@ -22,7 +22,8 @@ http.TIMEOUT = 10
22 22
23local t = socket.gettime() 23local t = socket.gettime()
24 24
25host = host or "diego.student.princeton.edu" 25--host = host or "diego.student.princeton.edu"
26host = host or "dell-diego"
26proxy = proxy or "http://localhost:3128" 27proxy = proxy or "http://localhost:3128"
27prefix = prefix or "/luasocket-test" 28prefix = prefix or "/luasocket-test"
28cgiprefix = cgiprefix or "/luasocket-test-cgi" 29cgiprefix = cgiprefix or "/luasocket-test-cgi"
@@ -125,6 +126,20 @@ assert(r == nil and e == re, tostring(r) ..", " .. tostring(re) ..
125 " vs " .. tostring(e)) 126 " vs " .. tostring(e))
126print("ok") 127print("ok")
127 128
129io.write("testing invalid empty port: ")
130request = {
131 url = "http://" .. host .. ":" .. prefix .. "/index.html"
132}
133expect = {
134 body = index,
135 code = 200
136}
137ignore = {
138 status = 1,
139 headers = 1
140}
141check_request(request, expect, ignore)
142
128------------------------------------------------------------------------ 143------------------------------------------------------------------------
129io.write("testing post method: ") 144io.write("testing post method: ")
130-- wanted to test chunked post, but apache doesn't support it... 145-- wanted to test chunked post, but apache doesn't support it...
diff --git a/test/testmesg.lua b/test/testmesg.lua
index 5bec026..ab85c93 100644
--- a/test/testmesg.lua
+++ b/test/testmesg.lua
@@ -83,9 +83,10 @@ r, e = smtp.send{
83 "<diego@princeton.edu>" }, 83 "<diego@princeton.edu>" },
84 from = "<diego@princeton.edu>", 84 from = "<diego@princeton.edu>",
85 source = ltn12.source.chain(source, filter), 85 source = ltn12.source.chain(source, filter),
86 --server = "mail.cs.princeton.edu" 86 server = "mail.cs.princeton.edu",
87 server = "localhost", 87 --server = "localhost",
88 port = 2525 88 --port = 2525
89 port = 25
89} 90}
90 91
91print(r, e) 92print(r, e)