Skip to content

tests: corrected the handshake flag position. #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions t/ssl-session-fetch.t
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,6 @@ $/s,

local sid = ssl.get_session_id()
print("session id: ", sid)

ngx.shared.done:set("handshake", true)
}

ssl_session_fetch_by_lua_block {
Expand All @@ -430,8 +428,6 @@ $/s,
if not ok or err then
print("failed to resume session: ", err)
end

-- ngx.shared.done:set("handshake", true)
}

server {
Expand All @@ -440,6 +436,12 @@ $/s,
ssl_session_tickets off;
ssl_certificate $TEST_NGINX_CERT_DIR/cert/test.crt;
ssl_certificate_key $TEST_NGINX_CERT_DIR/cert/test.key;

location / {
content_by_lua_block {
ngx.shared.done:set("handshake", true)
}
}
}
--- config
lua_ssl_trusted_certificate $TEST_NGINX_CERT_DIR/cert/test.crt;
Expand All @@ -451,12 +453,13 @@ $/s,
ngx.shared.done:delete("handshake")
local addr = ngx.var.addr;
local sess = ngx.var.sess_file
local req = "'GET / HTTP/1.0\r\nHost: test.com\r\nConnection: close\r\n\r\n'"
local f, err
if not package.loaded.session then
f, err = io.popen("echo 'Q' | timeout 3s openssl s_client -connect " .. addr .. " -sess_out " .. sess)
f, err = io.popen("echo -n " .. req .. " | timeout 3s openssl s_client -connect " .. addr .. " -sess_out " .. sess)
package.loaded.session = true
else
f, err = io.popen("echo 'Q' | timeout 3s openssl s_client -connect " .. addr .. " -sess_in " .. sess)
f, err = io.popen("echo -n " .. req .. " | timeout 3s openssl s_client -connect " .. addr .. " -sess_in " .. sess)
end

if not f then
Expand All @@ -465,7 +468,7 @@ $/s,
end

local step = 0.001
while step < 1 do
while step < 2 do
ngx.sleep(step)
step = step * 2

Expand Down
11 changes: 5 additions & 6 deletions t/ssl.t
Original file line number Diff line number Diff line change
Expand Up @@ -2211,13 +2211,11 @@ client ip: 127.0.0.1
ngx.log(ngx.ERR, "failed to set DER cert: ", err)
return
end

ngx.shared.done:set("handshake", true)
}

location /foo {
location / {
content_by_lua_block {
ngx.exit(201)
ngx.shared.done:set("handshake", true)
}
}
}
Expand All @@ -2228,14 +2226,15 @@ client ip: 127.0.0.1
content_by_lua_block {
ngx.shared.done:delete("handshake")
local addr = ngx.var.addr;
local f, err = io.popen("echo 'Q' | timeout 3s openssl s_client -connect 127.0.0.1:$TEST_NGINX_SERVER_SSL_PORT")
local req = "'GET / HTTP/1.0\r\nHost: test.com\r\nConnection: close\r\n\r\n'"
local f, err = io.popen("echo -n " .. req .. " | timeout 3s openssl s_client -connect 127.0.0.1:$TEST_NGINX_SERVER_SSL_PORT")
if not f then
ngx.say(err)
return
end

local step = 0.001
while step < 1 do
while step < 2 do
ngx.sleep(step)
step = step * 2

Expand Down