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 | |
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
-rw-r--r-- | TODO | 99 | ||||
-rw-r--r-- | src/auxiliar.c | 19 | ||||
-rw-r--r-- | src/http.lua | 55 | ||||
-rw-r--r-- | src/luasocket.c | 58 | ||||
-rw-r--r-- | src/luasocket.h | 2 | ||||
-rw-r--r-- | src/tcp.c | 4 | ||||
-rw-r--r-- | src/udp.c | 2 | ||||
-rw-r--r-- | test/httptest.lua | 16 |
8 files changed, 147 insertions, 108 deletions
@@ -1,48 +1,37 @@ | |||
1 | 1 | manual | |
2 | comment the need of a content-length header in the post method... | 2 | add shutdown |
3 | 3 | add gethostname | |
4 | comment the callback.lua module and the new mime module. | 4 | the need of a content-length header in the post method... |
5 | escape and unescape are missing! | 5 | notice the change in callback conventions |
6 | 6 | the callback.lua module and the new mime module. | |
7 | escape and unescape in url, not in code! | ||
8 | add timeout and proxy to request table | ||
9 | change stay to redirect | ||
10 | socket.time and socket.sleep | ||
11 | connect with timeout | ||
12 | local connect | ||
13 | add thanks to 'carlos cassino' and 'david burgess' | ||
14 | add new ip- options and reuseaddr option | ||
15 | |||
16 | tests | ||
17 | checar todos os metodos | ||
18 | checar todas as globais | ||
19 | checar garbage collection | ||
20 | check for interrupts | ||
21 | |||
22 | new option.c module to put all options (TCP and UDP share...)? | ||
23 | testar os options! | ||
7 | add _tostring methods! | 24 | add _tostring methods! |
8 | add callback module to manual | 25 | change all modules to use the new namespace scheme |
9 | change stay to redirect in http.lua and in manual | ||
10 | add timeout to request table | ||
11 | |||
12 | change code to mime | ||
13 | change *all* modules to be namespace independent | ||
14 | 26 | ||
15 | write some utilities that use the code.lua module and put them | 27 | write some utilities that use the code.lua module and put them |
16 | in etc, modify the README.etc file and makefile.dist (eol.lua is done) | 28 | in etc, modify the README.etc file and makefile.dist (eol.lua is done) |
17 | 29 | ||
18 | check for interrupt compliance | 30 | use gethostname it in SMTP |
19 | add connect with timeout | ||
20 | add gethostname and use it in HTTP, SMTP etc, and add manual entry. | ||
21 | add thanks for cassino and david burgess | ||
22 | |||
23 | add local connect, and manual entry | ||
24 | |||
25 | add shutdown manual entry | ||
26 | |||
27 | only allocate in case of success | ||
28 | only call select if io fails... | ||
29 | Proxy support pro http | ||
30 | |||
31 | make REUSEADDR an option... | ||
32 | 31 | ||
33 | make sure modules know if their dependencies are there. | 32 | make sure modules know if their dependencies are there. |
34 | _ | ||
35 | one thing i noticed in usocket.c is that it doesn't check for EINTR | ||
36 | after write(), sendto(), read(), recvfrom() etc. ? the usual trick is | ||
37 | to loop while you get EINTR: | ||
38 | |||
39 | do | ||
40 | ret = write(...); | ||
41 | while(ret < 0 && errno == EINTR) | ||
42 | |||
43 | 33 | ||
44 | Read about | 34 | Read about |
45 | |||
46 | 250-ENHANCEDSTATUSCODES | 35 | 250-ENHANCEDSTATUSCODES |
47 | 250-PIPELINING | 36 | 250-PIPELINING |
48 | 250-8BITMIME | 37 | 250-8BITMIME |
@@ -62,29 +51,30 @@ Make sure nobody can fuck up with the metatables... | |||
62 | 51 | ||
63 | Create a passive mode option for the FTP (good for firewall). | 52 | Create a passive mode option for the FTP (good for firewall). |
64 | 53 | ||
65 | Use environments in module definitions or declare all local and create the | ||
66 | function with exported symbols later? | ||
67 | |||
68 | local P = {} | ||
69 | complex = P | ||
70 | setfenv(1, P) | ||
71 | |||
72 | Modules should return their namespace table in the end of the chunk. | 54 | Modules should return their namespace table in the end of the chunk. |
73 | 55 | ||
74 | Adjust dates in all files | 56 | Adjust dates in all files |
75 | 57 | ||
76 | Test the library on every system possible | 58 | Test the library on every system possible |
77 | 59 | ||
78 | Document socket.time and socket.sleep | ||
79 | |||
80 | Implement time critical stuff from code module in C. | ||
81 | Add service name translation. | 60 | Add service name translation. |
82 | |||
83 | Ajeitar o protocolo da luaopen_socket()... sei lá qual é. | 61 | Ajeitar o protocolo da luaopen_socket()... sei lá qual é. |
84 | 62 | ||
85 | - testar os options! | 63 | |
86 | - adicionar exemplos de expansão: pipe, local, named pipe | 64 | - adicionar exemplos de expansão: pipe, local, named pipe |
87 | 65 | ||
66 | * should be interrupt-safe | ||
67 | * notice the change in callback conventions | ||
68 | * new mime module replacing old code module (faster, more functionality) | ||
69 | * new socket options (many) | ||
70 | * only allocate in case of success | ||
71 | * optimize for success (only call select if fails) | ||
72 | * add proxy support to http | ||
73 | * add gethostname | ||
74 | * local connect | ||
75 | * connect with timeout | ||
76 | * change code to mime | ||
77 | * change stay to redirect | ||
88 | * add shutdown | 78 | * add shutdown |
89 | * change send/recv to avoid using select | 79 | * change send/recv to avoid using select |
90 | * O location do "redirect" pode ser relativo ao servidor atual (não pode, | 80 | * O location do "redirect" pode ser relativo ao servidor atual (não pode, |
@@ -93,24 +83,13 @@ Ajeitar o protocolo da luaopen_socket()... sei lá qual é. | |||
93 | * Padronizar os retornos de funccao | 83 | * Padronizar os retornos de funccao |
94 | * Separar as classes em arquivos | 84 | * Separar as classes em arquivos |
95 | * Retorno de sendto em datagram sockets pode ser refused | 85 | * Retorno de sendto em datagram sockets pode ser refused |
96 | * Fazer compilar com g++ | ||
97 | 86 | ||
87 | - Fazer compilar com g++ | ||
98 | - Thread-safe | 88 | - Thread-safe |
99 | - proteger gethostby*.* com um mutex GLOBAL! | 89 | - proteger gethostby*.* com um mutex GLOBAL! |
100 | - proteger ou atomizar o conjunto (timedout, receive), (timedout, send) | 90 | - proteger ou atomizar o conjunto (timedout, receive), (timedout, send) |
101 | - inet_ntoa também é uma merda. | 91 | - inet_ntoa também é uma merda. |
102 | - SSL | 92 | - SSL |
103 | 93 | ||
104 | - checar operações em closed sockets | ||
105 | - checar teste de writable socket com select | ||
106 | |||
107 | |||
108 | - checar todos os metodos | ||
109 | - checar options em UDP | ||
110 | - checar todas as globais | ||
111 | - checar os metodos virtuais | ||
112 | - checar garbage collection | ||
113 | |||
114 | - unix 92 bytes maximo no endereço, incluindo o zero | 94 | - unix 92 bytes maximo no endereço, incluindo o zero |
115 | - unix 9216 maximo de datagram size | 95 | - unix 9216 maximo de datagram size |
116 | |||
diff --git a/src/auxiliar.c b/src/auxiliar.c index 65425c5..4b3a0f6 100644 --- a/src/auxiliar.c +++ b/src/auxiliar.c | |||
@@ -17,24 +17,7 @@ | |||
17 | \*-------------------------------------------------------------------------*/ | 17 | \*-------------------------------------------------------------------------*/ |
18 | void aux_open(lua_State *L) | 18 | void aux_open(lua_State *L) |
19 | { | 19 | { |
20 | /* create namespace table */ | 20 | ; |
21 | lua_pushstring(L, LUASOCKET_LIBNAME); | ||
22 | lua_newtable(L); | ||
23 | #ifdef LUASOCKET_DEBUG | ||
24 | lua_pushstring(L, "debug"); | ||
25 | lua_pushnumber(L, 1); | ||
26 | lua_rawset(L, -3); | ||
27 | #endif | ||
28 | /* make version string available so scripts */ | ||
29 | lua_pushstring(L, "version"); | ||
30 | lua_pushstring(L, LUASOCKET_VERSION); | ||
31 | lua_rawset(L, -3); | ||
32 | /* store namespace as global */ | ||
33 | lua_settable(L, LUA_GLOBALSINDEX); | ||
34 | /* make sure modules know what is our namespace */ | ||
35 | lua_pushstring(L, "LUASOCKET_LIBNAME"); | ||
36 | lua_pushstring(L, LUASOCKET_LIBNAME); | ||
37 | lua_settable(L, LUA_GLOBALSINDEX); | ||
38 | } | 21 | } |
39 | 22 | ||
40 | /*-------------------------------------------------------------------------*\ | 23 | /*-------------------------------------------------------------------------*\ |
diff --git a/src/http.lua b/src/http.lua index 72bde0a..4d6e426 100644 --- a/src/http.lua +++ b/src/http.lua | |||
@@ -25,7 +25,7 @@ TIMEOUT = 60 | |||
25 | -- default port for document retrieval | 25 | -- default port for document retrieval |
26 | PORT = 80 | 26 | PORT = 80 |
27 | -- user agent field sent in request | 27 | -- user agent field sent in request |
28 | USERAGENT = "LuaSocket 2.0" | 28 | USERAGENT = socket.version |
29 | -- block size used in transfers | 29 | -- block size used in transfers |
30 | BLOCKSIZE = 8192 | 30 | BLOCKSIZE = 8192 |
31 | 31 | ||
@@ -429,8 +429,7 @@ local function authorize(reqt, parsed, respt) | |||
429 | body_cb = reqt.body_cb, | 429 | body_cb = reqt.body_cb, |
430 | headers = reqt.headers, | 430 | headers = reqt.headers, |
431 | timeout = reqt.timeout, | 431 | timeout = reqt.timeout, |
432 | proxyhost = reqt.proxyhost, | 432 | proxy = reqt.proxy, |
433 | proxyport = reqt.proxyport | ||
434 | } | 433 | } |
435 | return request_cb(autht, respt) | 434 | return request_cb(autht, respt) |
436 | end | 435 | end |
@@ -471,8 +470,7 @@ local function redirect(reqt, respt) | |||
471 | body_cb = reqt.body_cb, | 470 | body_cb = reqt.body_cb, |
472 | headers = reqt.headers, | 471 | headers = reqt.headers, |
473 | timeout = reqt.timeout, | 472 | timeout = reqt.timeout, |
474 | proxyhost = reqt.proxyhost, | 473 | proxy = reqt.proxy |
475 | proxyport = reqt.proxyport | ||
476 | } | 474 | } |
477 | respt = request_cb(redirt, respt) | 475 | respt = request_cb(redirt, respt) |
478 | -- we pass the location header as a clue we tried to redirect | 476 | -- we pass the location header as a clue we tried to redirect |
@@ -491,7 +489,7 @@ end | |||
491 | ----------------------------------------------------------------------------- | 489 | ----------------------------------------------------------------------------- |
492 | local function request_uri(reqt, parsed) | 490 | local function request_uri(reqt, parsed) |
493 | local url | 491 | local url |
494 | if not reqt.proxyhost and not reqt.proxyport then | 492 | if not reqt.proxy then |
495 | url = { | 493 | url = { |
496 | path = parsed.path, | 494 | path = parsed.path, |
497 | params = parsed.params, | 495 | params = parsed.params, |
@@ -523,6 +521,39 @@ local function build_request(data) | |||
523 | end | 521 | end |
524 | 522 | ||
525 | ----------------------------------------------------------------------------- | 523 | ----------------------------------------------------------------------------- |
524 | -- Connects to a server, be it a proxy or not | ||
525 | -- Input | ||
526 | -- reqt: the request table | ||
527 | -- parsed: the parsed request url | ||
528 | -- Returns | ||
529 | -- sock: connection socket, or nil in case of error | ||
530 | -- err: error message | ||
531 | ----------------------------------------------------------------------------- | ||
532 | local function try_connect(reqt, parsed) | ||
533 | reqt.proxy = reqt.proxy or PROXY | ||
534 | local host, port | ||
535 | if reqt.proxy then | ||
536 | local pproxy = socket.url.parse(reqt.proxy) | ||
537 | if not pproxy.port or not pproxy.host then | ||
538 | return nil, "invalid proxy" | ||
539 | end | ||
540 | host, port = pproxy.host, pproxy.port | ||
541 | else | ||
542 | host, port = parsed.host, parsed.port | ||
543 | end | ||
544 | local sock, ret, err | ||
545 | sock, err = socket.tcp() | ||
546 | if not sock then return nil, err end | ||
547 | sock:settimeout(reqt.timeout or TIMEOUT) | ||
548 | ret, err = sock:connect(host, port) | ||
549 | if not ret then | ||
550 | sock:close() | ||
551 | return nil, err | ||
552 | end | ||
553 | return sock | ||
554 | end | ||
555 | |||
556 | ----------------------------------------------------------------------------- | ||
526 | -- Sends a HTTP request and retrieves the server reply using callbacks to | 557 | -- Sends a HTTP request and retrieves the server reply using callbacks to |
527 | -- send the request body and receive the response body | 558 | -- send the request body and receive the response body |
528 | -- Input | 559 | -- Input |
@@ -562,18 +593,8 @@ function request_cb(reqt, respt) | |||
562 | -- fill default headers | 593 | -- fill default headers |
563 | reqt.headers = fill_headers(reqt.headers, parsed) | 594 | reqt.headers = fill_headers(reqt.headers, parsed) |
564 | -- try to connect to server | 595 | -- try to connect to server |
565 | sock, respt.error = socket.tcp() | 596 | sock, respt.error = try_connect(reqt, parsed) |
566 | if not sock then return respt end | 597 | if not sock then return respt end |
567 | -- set connection timeout so that we do not hang forever | ||
568 | sock:settimeout(reqt.timeout or TIMEOUT) | ||
569 | ret, respt.error = sock:connect( | ||
570 | reqt.proxyhost or PROXYHOST or parsed.host, | ||
571 | reqt.proxyport or PROXYPORT or parsed.port | ||
572 | ) | ||
573 | if not ret then | ||
574 | sock:close() | ||
575 | return respt | ||
576 | end | ||
577 | -- send request message | 598 | -- send request message |
578 | respt.error = send_request(sock, reqt.method, | 599 | respt.error = send_request(sock, reqt.method, |
579 | request_uri(reqt, parsed), reqt.headers, reqt.body_cb) | 600 | request_uri(reqt, parsed), reqt.headers, reqt.body_cb) |
diff --git a/src/luasocket.c b/src/luasocket.c index 578d65c..73583a8 100644 --- a/src/luasocket.c +++ b/src/luasocket.c | |||
@@ -36,8 +36,63 @@ | |||
36 | #include "mime.h" | 36 | #include "mime.h" |
37 | 37 | ||
38 | /*=========================================================================*\ | 38 | /*=========================================================================*\ |
39 | * Exported functions | 39 | * Declarations |
40 | \*=========================================================================*/ | 40 | \*=========================================================================*/ |
41 | static int global_gethostname(lua_State *L); | ||
42 | static int base_open(lua_State *L); | ||
43 | |||
44 | /* functions in library namespace */ | ||
45 | static luaL_reg func[] = { | ||
46 | {"gethostname", global_gethostname}, | ||
47 | {NULL, NULL} | ||
48 | }; | ||
49 | |||
50 | /*-------------------------------------------------------------------------*\ | ||
51 | * Setup basic stuff. | ||
52 | \*-------------------------------------------------------------------------*/ | ||
53 | static int base_open(lua_State *L) | ||
54 | { | ||
55 | /* create namespace table */ | ||
56 | lua_pushstring(L, LUASOCKET_LIBNAME); | ||
57 | lua_newtable(L); | ||
58 | #ifdef LUASOCKET_DEBUG | ||
59 | lua_pushstring(L, "debug"); | ||
60 | lua_pushnumber(L, 1); | ||
61 | lua_rawset(L, -3); | ||
62 | #endif | ||
63 | /* make version string available so scripts */ | ||
64 | lua_pushstring(L, "version"); | ||
65 | lua_pushstring(L, LUASOCKET_VERSION); | ||
66 | lua_rawset(L, -3); | ||
67 | /* store namespace as global */ | ||
68 | lua_settable(L, LUA_GLOBALSINDEX); | ||
69 | /* make sure modules know what is our namespace */ | ||
70 | lua_pushstring(L, "LUASOCKET_LIBNAME"); | ||
71 | lua_pushstring(L, LUASOCKET_LIBNAME); | ||
72 | lua_settable(L, LUA_GLOBALSINDEX); | ||
73 | /* define library functions */ | ||
74 | luaL_openlib(L, LUASOCKET_LIBNAME, func, 0); | ||
75 | lua_pop(L, 1); | ||
76 | return 0; | ||
77 | } | ||
78 | |||
79 | /*-------------------------------------------------------------------------*\ | ||
80 | * Gets the host name | ||
81 | \*-------------------------------------------------------------------------*/ | ||
82 | static int global_gethostname(lua_State *L) | ||
83 | { | ||
84 | char name[257]; | ||
85 | name[256] = '\0'; | ||
86 | if (gethostname(name, 256) < 0) { | ||
87 | lua_pushnil(L); | ||
88 | lua_pushstring(L, "gethostname failed"); | ||
89 | return 2; | ||
90 | } else { | ||
91 | lua_pushstring(L, name); | ||
92 | return 1; | ||
93 | } | ||
94 | } | ||
95 | |||
41 | /*-------------------------------------------------------------------------*\ | 96 | /*-------------------------------------------------------------------------*\ |
42 | * Initializes all library modules. | 97 | * Initializes all library modules. |
43 | \*-------------------------------------------------------------------------*/ | 98 | \*-------------------------------------------------------------------------*/ |
@@ -45,6 +100,7 @@ LUASOCKET_API int luaopen_socket(lua_State *L) | |||
45 | { | 100 | { |
46 | if (!sock_open()) return 0; | 101 | if (!sock_open()) return 0; |
47 | /* initialize all modules */ | 102 | /* initialize all modules */ |
103 | base_open(L); | ||
48 | aux_open(L); | 104 | aux_open(L); |
49 | tm_open(L); | 105 | tm_open(L); |
50 | buf_open(L); | 106 | buf_open(L); |
diff --git a/src/luasocket.h b/src/luasocket.h index ac26824..81d7b3f 100644 --- a/src/luasocket.h +++ b/src/luasocket.h | |||
@@ -13,7 +13,7 @@ | |||
13 | /*-------------------------------------------------------------------------*\ | 13 | /*-------------------------------------------------------------------------*\ |
14 | * Current luasocket version | 14 | * Current luasocket version |
15 | \*-------------------------------------------------------------------------*/ | 15 | \*-------------------------------------------------------------------------*/ |
16 | #define LUASOCKET_VERSION "LuaSocket 2.0 (alpha)" | 16 | #define LUASOCKET_VERSION "LuaSocket 2.0 (beta)" |
17 | 17 | ||
18 | /*-------------------------------------------------------------------------*\ | 18 | /*-------------------------------------------------------------------------*\ |
19 | * Library's namespace | 19 | * Library's namespace |
@@ -153,7 +153,7 @@ static int opt_keepalive(lua_State *L) | |||
153 | return opt_boolean(L, SOL_SOCKET, SO_KEEPALIVE); | 153 | return opt_boolean(L, SOL_SOCKET, SO_KEEPALIVE); |
154 | } | 154 | } |
155 | 155 | ||
156 | int opt_linger(lua_State *L) | 156 | static int opt_linger(lua_State *L) |
157 | { | 157 | { |
158 | p_tcp tcp = (p_tcp) aux_checkclass(L, "tcp{client}", 1); | 158 | p_tcp tcp = (p_tcp) aux_checkclass(L, "tcp{client}", 1); |
159 | struct linger li; | 159 | struct linger li; |
@@ -334,7 +334,7 @@ static int meth_settimeout(lua_State *L) | |||
334 | /*-------------------------------------------------------------------------*\ | 334 | /*-------------------------------------------------------------------------*\ |
335 | * Creates a master tcp object | 335 | * Creates a master tcp object |
336 | \*-------------------------------------------------------------------------*/ | 336 | \*-------------------------------------------------------------------------*/ |
337 | int global_create(lua_State *L) | 337 | static int global_create(lua_State *L) |
338 | { | 338 | { |
339 | t_sock sock; | 339 | t_sock sock; |
340 | const char *err = inet_trycreate(&sock, SOCK_STREAM); | 340 | const char *err = inet_trycreate(&sock, SOCK_STREAM); |
@@ -417,7 +417,7 @@ static int meth_setsockname(lua_State *L) | |||
417 | /*-------------------------------------------------------------------------*\ | 417 | /*-------------------------------------------------------------------------*\ |
418 | * Creates a master udp object | 418 | * Creates a master udp object |
419 | \*-------------------------------------------------------------------------*/ | 419 | \*-------------------------------------------------------------------------*/ |
420 | int global_create(lua_State *L) | 420 | static int global_create(lua_State *L) |
421 | { | 421 | { |
422 | t_sock sock; | 422 | t_sock sock; |
423 | const char *err = inet_trycreate(&sock, SOCK_DGRAM); | 423 | const char *err = inet_trycreate(&sock, SOCK_DGRAM); |
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, |