#!/usr/bin/perl -wT use strict; my $originPath = "/websocket/cookie-http-to-ws.pl"; if ($ENV{"QUERY_STRING"} eq "clear=1") { print "Content-Type: text/plain\r\n"; print "Set-Cookie: WK-websocket-test-path=0; Path=${originPath}; Max-Age=0\r\n"; print "Set-Cookie: WK-websocket-test-domain=0; Path=/; Domain=127.0.0.1; Max-Age=0\r\n"; print "\r\n"; print "Cookies are cleared."; exit; } print "Content-Type: text/html\r\n"; # Test that even if the "Path" attribute of a cookie matches the path of the # origin document, the cookie won't be sent in the WebSocket handshake unless # the "Path" attribute matches the WebSocket URL. print "Set-Cookie: WK-websocket-test-path=1; Path=${originPath}\r\n"; # Test that if the "Path" and "Domain" matches the WebSocket URL, the cookie # will be sent in the WebSocket handshake. "Path" is set to / so that the # WebSocket created below can pass "Path" check so that we can test that # "Domain" checking is working. print "Set-Cookie: WK-websocket-test-domain=1; Path=/; Domain=127.0.0.1\r\n"; print "\r\n"; print <

Test How WebSocket handles cookies with cookie-av's.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".

HTML