mirror of
https://github.com/curl/curl.git
synced 2025-09-10 22:22:43 +03:00
curl: make --etag-save acknowledge --create-dirs
Add test 693 to verify Fixes #15730 Suggested-by: Tamir Duberstein Closes #15732
This commit is contained in:
parent
3f8452dde7
commit
31c6b50cb2
|
@ -20,3 +20,6 @@ Save an HTTP ETag to the specified file. An ETag is a caching related header,
|
||||||
usually returned in a response. Use this option with a single URL only.
|
usually returned in a response. Use this option with a single URL only.
|
||||||
|
|
||||||
If no ETag is sent by the server, an empty file is created.
|
If no ETag is sent by the server, an empty file is created.
|
||||||
|
|
||||||
|
Starting in curl 8.12.0, using the --create-dirs option can also create
|
||||||
|
missing directory components for the path provided in --etag-save.
|
||||||
|
|
|
@ -1976,6 +1976,12 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config->etag_save_file) {
|
if(config->etag_save_file) {
|
||||||
|
if(config->create_dirs) {
|
||||||
|
result = create_dir_hierarchy(config->etag_save_file, global);
|
||||||
|
if(result)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* open file for output: */
|
/* open file for output: */
|
||||||
if(strcmp(config->etag_save_file, "-")) {
|
if(strcmp(config->etag_save_file, "-")) {
|
||||||
FILE *newfile = fopen(config->etag_save_file, "ab");
|
FILE *newfile = fopen(config->etag_save_file, "ab");
|
||||||
|
|
|
@ -101,7 +101,7 @@ test652 test653 test654 test655 test656 test658 test659 test660 test661 \
|
||||||
test662 test663 test664 test665 test666 test667 test668 test669 test670 \
|
test662 test663 test664 test665 test666 test667 test668 test669 test670 \
|
||||||
test671 test672 test673 test674 test675 test676 test677 test678 test679 \
|
test671 test672 test673 test674 test675 test676 test677 test678 test679 \
|
||||||
test680 test681 test682 test683 test684 test685 test686 test687 test688 \
|
test680 test681 test682 test683 test684 test685 test686 test687 test688 \
|
||||||
test689 test690 test691 test692 \
|
test689 test690 test691 test692 test693 \
|
||||||
\
|
\
|
||||||
test700 test701 test702 test703 test704 test705 test706 test707 test708 \
|
test700 test701 test702 test703 test704 test705 test706 test707 test708 \
|
||||||
test709 test710 test711 test712 test713 test714 test715 test716 test717 \
|
test709 test710 test711 test712 test713 test714 test715 test716 test717 \
|
||||||
|
|
62
tests/data/test693
Normal file
62
tests/data/test693
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
<testcase>
|
||||||
|
<info>
|
||||||
|
<keywords>
|
||||||
|
HTTP
|
||||||
|
HTTP GET
|
||||||
|
etags
|
||||||
|
</keywords>
|
||||||
|
</info>
|
||||||
|
#
|
||||||
|
# Server-side
|
||||||
|
<reply>
|
||||||
|
<data nocheck="yes">
|
||||||
|
HTTP/1.1 200 funky chunky!
|
||||||
|
Server: fakeit/0.9 fakeitbad/1.0
|
||||||
|
Transfer-Encoding: chunked
|
||||||
|
Trailer: chunky-trailer
|
||||||
|
Connection: mooo
|
||||||
|
ETag: W/"asdf"
|
||||||
|
|
||||||
|
40
|
||||||
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
|
30
|
||||||
|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||||
|
21;heresatest=moooo
|
||||||
|
cccccccccccccccccccccccccccccccc
|
||||||
|
|
||||||
|
0
|
||||||
|
chunky-trailer: header data
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</reply>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Client-side
|
||||||
|
<client>
|
||||||
|
<server>
|
||||||
|
http
|
||||||
|
</server>
|
||||||
|
<name>
|
||||||
|
--etag-save with --create-dirs
|
||||||
|
</name>
|
||||||
|
<command>
|
||||||
|
http://%HOSTIP:%HTTPPORT/%TESTNUMBER --etag-save %LOGDIR/moo/boo/etag%TESTNUMBER --create-dirs
|
||||||
|
</command>
|
||||||
|
</client>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Verify data after the test has been "shot"
|
||||||
|
<verify>
|
||||||
|
<protocol>
|
||||||
|
GET /%TESTNUMBER HTTP/1.1
|
||||||
|
Host: %HOSTIP:%HTTPPORT
|
||||||
|
User-Agent: curl/%VERSION
|
||||||
|
Accept: */*
|
||||||
|
|
||||||
|
</protocol>
|
||||||
|
<file name="%LOGDIR/moo/boo/etag%TESTNUMBER">
|
||||||
|
W/"asdf"
|
||||||
|
</file>
|
||||||
|
</verify>
|
||||||
|
|
||||||
|
</testcase>
|
Loading…
Reference in New Issue
Block a user