aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-11-22 13:24:02 +0100
committerDaniel Stenberg <daniel@haxx.se>2018-11-23 14:50:51 +0100
commita52e46f3900fb02fd45423c35d970703978fe6ff (patch)
treeea4e0d5c812b1133514a8eedee01b533f0281abd /tests
parent2e496108534ed20c82cf96f77443e81605f78f92 (diff)
cookies: create the cookiejar even if no cookies to save
Important for when the file is going to be read again and thus must not contain old contents! Adds test 327 to verify. Reported-by: daboul on github Fixes #3299 Closes #3300
Diffstat (limited to 'tests')
-rw-r--r--tests/data/Makefile.inc2
-rw-r--r--tests/data/test11606
-rw-r--r--tests/data/test32773
3 files changed, 79 insertions, 2 deletions
diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
index e58fb27fb..d100eafb5 100644
--- a/tests/data/Makefile.inc
+++ b/tests/data/Makefile.inc
@@ -56,7 +56,7 @@ test289 test290 test291 test292 test293 test294 test295 test296 test297 \
test298 test299 test300 test301 test302 test303 test304 test305 test306 \
test307 test308 test309 test310 test311 test312 test313 test314 test315 \
test316 test317 test318 test319 test320 test321 test322 test323 test324 \
-test325 test326 \
+test325 test326 test327 \
\
test340 \
\
diff --git a/tests/data/test1160 b/tests/data/test1160
index 26a758c4e..3fe689e96 100644
--- a/tests/data/test1160
+++ b/tests/data/test1160
@@ -43,7 +43,11 @@ Host: %HOSTIP:%HTTPPORT
Accept: */*
</protocol>
-<file name="log/cookies1160.txt">
+<file name="log/cookies1160.txt" mode="text">
+# Netscape HTTP Cookie File
+# https://curl.haxx.se/docs/http-cookies.html
+# This file was generated by libcurl! Edit at your own risk.
+
</file>
</verify>
</testcase>
diff --git a/tests/data/test327 b/tests/data/test327
new file mode 100644
index 000000000..fcb98990f
--- /dev/null
+++ b/tests/data/test327
@@ -0,0 +1,73 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+cookies
+header dump
+</keywords>
+</info>
+
+# This test verifies that the cookie file gets created even if the last cookie
+# has been removed - particularly important when the file is going to be read
+# again and thus must not contain old contents.
+
+# Server-side
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Content-Type: text/html
+Funny-head: yesyes swsclose
+Set-Cookie: foobar=name; expires=Thu, 22 Nov 2028 10:54:11 GMT;
+
+</data>
+<data2>
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Content-Type: text/html
+Funny-head: yesyes swsclose
+Set-Cookie: foobar=name; expires=Thu, 01 Jan 1970 00:00:00 GMT;
+
+</data>
+</reply>
+
+# Client-side
+<client>
+<server>
+http
+</server>
+ <name>
+HTTP with cookiejar without cookies left
+ </name>
+ <command>
+http://%HOSTIP:%HTTPPORT/we/want/327 -b none -c log/cookies327 http://%HOSTIP:%HTTPPORT/we/want/3270002
+</command>
+</client>
+
+# Verify data after the test has been "shot"
+<verify>
+<strip>
+^User-Agent:.*
+</strip>
+<protocol>
+GET /we/want/327 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+GET /we/want/3270002 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+Cookie: foobar=name
+
+</protocol>
+<file name="log/cookies327" mode="text">
+# Netscape HTTP Cookie File
+# https://curl.haxx.se/docs/http-cookies.html
+# This file was generated by libcurl! Edit at your own risk.
+
+</file>
+</verify>
+</testcase>