@@ -9,6 +9,7 @@ our $HtmlDir = html_dir;
9
9
10
10
$ENV {TEST_NGINX_MEMCACHED_PORT } ||= 11211;
11
11
$ENV {TEST_NGINX_RESOLVER } ||= ' 8.8.8.8' ;
12
+ $ENV {TEST_NGINX_HTML_DIR } ||= html_dir();
12
13
13
14
# log_level 'warn';
14
15
@@ -21,33 +22,32 @@ __DATA__
21
22
=== TEST 1: sanity
22
23
--- stream_config
23
24
server {
24
- listen 127.0 . 0 . 1 : 9988 ;
25
+ listen unix:$TEST_NGINX_HTML_DIR/nginx.sock ;
25
26
26
27
return testing\npreread\n;
27
28
}
28
29
29
30
--- stream_server_config
30
31
preread_by_lua_block {
31
32
local sock = ngx.socket.tcp()
32
- local port = 9988
33
- local ok , err = sock: connect(" 127.0.0.1" , port)
33
+ local ok, err = sock:connect("unix:$TEST_NGINX_HTML_DIR/nginx.sock")
34
34
if not ok then
35
35
ngx.say("failed to connect: ", err)
36
36
return
37
37
end
38
38
39
39
ngx.say("connected: ", ok)
40
40
41
- local req = " GET /foo HTTP/1.0\r\n Host: localhost\r\n Connection: close\r\n\r\n "
42
- -- req = " OK"
41
+ local req = "GET /foo HTTP/1.0\r\nHost: localhost\r\nConnection: close\r\n\r\n"
42
+ -- req = "OK"
43
43
44
- local bytes , err = sock: send(req)
45
- if not bytes then
46
- ngx. say (" failed to send request: " , err)
47
- return
48
- end
44
+ local bytes, err = sock:send(req)
45
+ if not bytes then
46
+ ngx.say("failed to send request: ", err)
47
+ return
48
+ end
49
49
50
- ngx. say (" request sent: " , bytes )
50
+ ngx.say("request sent: ", bytes)
51
51
52
52
while true do
53
53
local line, err, part = sock:receive()
0 commit comments