| OLD | NEW |
| 1 #!/usr/bin/perl -wT | 1 #!/usr/bin/perl -wT |
| 2 use strict; | 2 use strict; |
| 3 | 3 |
| 4 if ($ENV{"QUERY_STRING"} eq "clear=1") { | 4 if ($ENV{"QUERY_STRING"} eq "clear=1") { |
| 5 print "Content-Type: text/plain\r\n", | 5 print "Content-Type: text/plain\r\n", |
| 6 "Set-Cookie: WK-websocket-test=0; Path=/; Max-Age=0\r\n", | 6 "Set-Cookie: ws=0; Path=/; Max-Age=0\r\n", |
| 7 "Set-Cookie: WK-websocket-test-httponly=0; Path=/; HttpOnly; Max-Age=0
\r\n", | 7 "Set-Cookie: ws-httponly=0; Path=/; HttpOnly; Max-Age=0\r\n", |
| 8 "\r\n", | 8 "\r\n", |
| 9 "Cookies are cleared."; | 9 "Cookies are cleared."; |
| 10 exit; | 10 exit; |
| 11 } | 11 } |
| 12 | 12 |
| 13 print "Content-Type: text/html\r\n", | 13 print "Content-Type: text/html\r\n", |
| 14 # The "Path" attribute is set to "/" so that the WebSocket created below | 14 # The "Path" attribute is set to "/" so that the WebSocket created below |
| 15 # will receive these cookies. | 15 # will receive these cookies. |
| 16 "Set-Cookie: WK-websocket-test=1; Path=/\r\n", | 16 "Set-Cookie: ws=1; Path=/\r\n", |
| 17 "Set-Cookie: WK-websocket-test-httponly=1; Path=/; HttpOnly\r\n", | 17 "Set-Cookie: ws-httponly=1; Path=/; HttpOnly\r\n", |
| 18 "\r\n"; | 18 "\r\n"; |
| 19 print <<'HTML'; | 19 print <<'HTML'; |
| 20 <!DOCTYPE html> | 20 <!DOCTYPE html> |
| 21 <script src="/js-test-resources/js-test.js"></script> | 21 <script src="/js-test-resources/js-test.js"></script> |
| 22 <script src="resources/get-request-header.js"></script> | 22 <script src="resources/get-request-header.js"></script> |
| 23 <script> | 23 <script> |
| 24 description('Test that WebSocket sends HttpOnly cookies.'); | 24 description('Test that WebSocket sends HttpOnly cookies.'); |
| 25 | 25 |
| 26 window.jsTestIsAsync = true; | 26 window.jsTestIsAsync = true; |
| 27 | 27 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 46 }; | 46 }; |
| 47 xhr.send(null); | 47 xhr.send(null); |
| 48 }); | 48 }); |
| 49 } | 49 } |
| 50 | 50 |
| 51 var cookie; | 51 var cookie; |
| 52 connectAndGetRequestHeader('cookie').then(function(value) | 52 connectAndGetRequestHeader('cookie').then(function(value) |
| 53 { | 53 { |
| 54 cookie = value; | 54 cookie = value; |
| 55 cookie = normalizeCookie(cookie); | 55 cookie = normalizeCookie(cookie); |
| 56 shouldBeEqualToString('cookie', 'WK-websocket-test-httponly=1; WK-websocket-
test=1'); | 56 shouldBeEqualToString('cookie', 'ws-httponly=1; ws=1'); |
| 57 clearCookies().then(finishJSTest); | 57 clearCookies().then(finishJSTest); |
| 58 }, finishAsFailed); | 58 }, finishAsFailed); |
| 59 | 59 |
| 60 setTimeout(finishJSTest, 1000); | 60 setTimeout(finishJSTest, 1000); |
| 61 | 61 |
| 62 </script> | 62 </script> |
| 63 HTML | 63 HTML |
| OLD | NEW |