Skip to content

Commit 14b1ed5

Browse files
committed
Add spec for comma separated cookies
1 parent f51feb7 commit 14b1ed5

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

spec/lib/rex/proto/http/response_spec.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,22 @@ def get_cookies_test_one_set_cookie_header
116116
HEREDOC
117117
end
118118

119+
def get_cookies_comma_separated
120+
<<-HEREDOC.gsub(/^ {6}/, '')
121+
HTTP/1.1 200 OK
122+
Expires: Thu, 26 Oct 1978 00:00:00 GMT
123+
Content-Length: 8556
124+
Server: CherryPy/3.1.2
125+
Date: Sun, 06 Jul 2014 20:09:28 GMT
126+
Cache-Control: no-store, max-age=0, no-cache, must-revalidate
127+
Content-Type: text/html;charset=utf-8
128+
Set-Cookie: cval=880350187, session_id_8000=83466b1a1a7a27ce13d35f78155d40ca3a1e7a28; expires=Mon, 07 Jul 2014 20:09:28 GMT; httponly; Path=/, uid=348637C4-9B10-485A-BFA9-5E892432FCFD; expires=Fri, 05-Jul-2019 20:09:28 GMT
129+
130+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
131+
<!--[if lt IE 7]> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://www.splunk.com/xhtml-extensions/1.0" xml:lang="en" lang="en" class="no-js lt-ie9 lt-ie8 lt-
132+
HEREDOC
133+
end
134+
119135
def cookie_sanity_check(meth)
120136
resp = described_class.new()
121137
resp.parse(self.send meth)
@@ -185,6 +201,18 @@ def cookie_sanity_check(meth)
185201
cookies_array.should include(*expected_cookies)
186202
end
187203

204+
it 'parses comma separated cookies' do
205+
cookies_array = cookie_sanity_check(:get_cookies_comma_separated)
206+
cookies_array.count.should eq(3)
207+
expected_cookies = %w{
208+
cval=880350187
209+
session_id_8000=83466b1a1a7a27ce13d35f78155d40ca3a1e7a28
210+
uid=348637C4-9B10-485A-BFA9-5E892432FCFD
211+
}
212+
expected_cookies.shuffle!
213+
cookies_array.should include(*expected_cookies)
214+
end
215+
188216
end
189217

190218
end

0 commit comments

Comments
 (0)