diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2006-04-03 03:10:56 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2006-04-03 03:10:56 +0000 |
| commit | e9d477aba3bbc084c0a7872e4eaf725e2689e4a6 (patch) | |
| tree | 7f6a514fab405c4de2bb983f601af2dbb3cfdc5d | |
| parent | 71213595260923f9d7cc7d41bb8b7b6227c1da01 (diff) | |
| download | luasocket-e9d477aba3bbc084c0a7872e4eaf725e2689e4a6.tar.gz luasocket-e9d477aba3bbc084c0a7872e4eaf725e2689e4a6.tar.bz2 luasocket-e9d477aba3bbc084c0a7872e4eaf725e2689e4a6.zip | |
Final patches...
| -rw-r--r-- | config | 20 | ||||
| -rw-r--r-- | src/http.lua | 2 | ||||
| -rw-r--r-- | test/auth/.htaccess | 2 | ||||
| -rw-r--r-- | test/auth/.htpasswd | 2 | ||||
| -rw-r--r-- | test/httptest.lua | 17 | ||||
| -rw-r--r-- | test/testmesg.lua | 7 |
6 files changed, 33 insertions, 17 deletions
| @@ -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 | # |
| 40 | CC=gcc | 40 | #CC=gcc |
| 41 | DEF=-DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN | 41 | #DEF=-DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN |
| 42 | CFLAGS= $(LUAINC) -I$(COMPAT) $(DEF) -pedantic -Wall -O2 -fno-common | 42 | #CFLAGS= $(LUAINC) -I$(COMPAT) $(DEF) -pedantic -Wall -O2 -fno-common |
| 43 | LDFLAGS=-bundle -undefined dynamic_lookup | 43 | #LDFLAGS=-bundle -undefined dynamic_lookup |
| 44 | LD=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 | 49 | CC=gcc |
| 50 | #DEF=-DLUASOCKET_DEBUG | 50 | DEF=-DLUASOCKET_DEBUG |
| 51 | #CFLAGS= $(LUAINC) -I$(COMPAT) $(DEF) -pedantic -Wall -O2 -fpic | 51 | CFLAGS= $(LUAINC) -I$(COMPAT) $(DEF) -pedantic -Wall -O2 -fpic |
| 52 | #LDFLAGS=-O -shared | 52 | LDFLAGS=-O -shared |
| 53 | #LD=gcc | 53 | LD=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 = { | |||
| 226 | local function adjustrequest(reqt) | 226 | local 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 @@ | |||
| 1 | AuthName "Test Realm" | 1 | AuthName "Test Realm" |
| 2 | AuthType Basic | 2 | AuthType Basic |
| 3 | AuthUserFile /Users/diego/tec/luasocket/test/auth/.htpasswd | 3 | AuthUserFile /home/diego/tec/luasocket/test/auth/.htpasswd |
| 4 | require valid-user | 4 | require 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 | ||
| 23 | local t = socket.gettime() | 23 | local t = socket.gettime() |
| 24 | 24 | ||
| 25 | host = host or "diego.student.princeton.edu" | 25 | --host = host or "diego.student.princeton.edu" |
| 26 | host = host or "dell-diego" | ||
| 26 | proxy = proxy or "http://localhost:3128" | 27 | proxy = proxy or "http://localhost:3128" |
| 27 | prefix = prefix or "/luasocket-test" | 28 | prefix = prefix or "/luasocket-test" |
| 28 | cgiprefix = cgiprefix or "/luasocket-test-cgi" | 29 | cgiprefix = 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)) |
| 126 | print("ok") | 127 | print("ok") |
| 127 | 128 | ||
| 129 | io.write("testing invalid empty port: ") | ||
| 130 | request = { | ||
| 131 | url = "http://" .. host .. ":" .. prefix .. "/index.html" | ||
| 132 | } | ||
| 133 | expect = { | ||
| 134 | body = index, | ||
| 135 | code = 200 | ||
| 136 | } | ||
| 137 | ignore = { | ||
| 138 | status = 1, | ||
| 139 | headers = 1 | ||
| 140 | } | ||
| 141 | check_request(request, expect, ignore) | ||
| 142 | |||
| 128 | ------------------------------------------------------------------------ | 143 | ------------------------------------------------------------------------ |
| 129 | io.write("testing post method: ") | 144 | io.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 | ||
| 91 | print(r, e) | 92 | print(r, e) |
