From e50a2002bd450a4800a165d2874ed79c95b33a07 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 4 Oct 2018 23:53:32 +0200 Subject: FILE: fix CURLOPT_NOBODY and CURLOPT_HEADER output Now FILE transfers send headers to the header callback like HTTP and other protocols. Also made curl_easy_getinfo(...CURLINFO_PROTOCOL...) work for FILE in the callbacks. Makes "curl -i file://.." and "curl -I file://.." work like before again. Applied the bold header logic to them too. Regression from c1c2762 (7.61.0) Reported-by: Shaun Jackman Fixes #3083 Closes #3101 --- tests/data/test1016 | 2 +- tests/data/test1017 | 2 +- tests/data/test1018 | 2 +- tests/data/test1019 | 2 +- tests/data/test1020 | 2 +- tests/data/test1029 | 2 +- tests/data/test1146 | 2 +- tests/data/test1220 | 2 +- tests/data/test200 | 2 +- tests/data/test2000 | 2 +- tests/data/test2001 | 13 +------------ tests/data/test2002 | 13 +------------ tests/data/test2003 | 26 ++------------------------ tests/data/test2004 | 2 +- tests/data/test2006 | 8 ++++++++ tests/data/test2007 | 8 ++++++++ tests/data/test2008 | 8 ++++++++ tests/data/test2009 | 8 ++++++++ tests/data/test2010 | 8 ++++++++ tests/data/test202 | 2 +- tests/data/test203 | 2 +- tests/data/test204 | 2 +- tests/data/test205 | 2 +- tests/data/test2070 | 2 +- tests/data/test2071 | 2 +- tests/data/test2072 | 2 +- tests/data/test210 | 2 +- tests/data/test231 | 2 +- tests/data/test288 | 2 +- 29 files changed, 65 insertions(+), 69 deletions(-) (limited to 'tests/data') diff --git a/tests/data/test1016 b/tests/data/test1016 index b404cacb6..4927f9eaa 100644 --- a/tests/data/test1016 +++ b/tests/data/test1016 @@ -22,7 +22,7 @@ file X-Y range on a file:// URL to stdout - + -r 1-4 file://localhost/%PWD/log/test1016.txt diff --git a/tests/data/test1017 b/tests/data/test1017 index 6fbc38ab2..cfdd80f9e 100644 --- a/tests/data/test1017 +++ b/tests/data/test1017 @@ -23,7 +23,7 @@ file 0-Y range on a file:// URL to stdout - + -r 0-3 file://localhost/%PWD/log/test1017.txt diff --git a/tests/data/test1018 b/tests/data/test1018 index 28a7027d9..57487014f 100644 --- a/tests/data/test1018 +++ b/tests/data/test1018 @@ -22,7 +22,7 @@ file X-X range on a file:// URL to stdout - + -r 4-4 file://localhost/%PWD/log/test1018.txt diff --git a/tests/data/test1019 b/tests/data/test1019 index 4d9872a2d..054e38d5d 100644 --- a/tests/data/test1019 +++ b/tests/data/test1019 @@ -23,7 +23,7 @@ file X- range on a file:// URL to stdout - + -r 7- file://localhost/%PWD/log/test1019.txt diff --git a/tests/data/test1020 b/tests/data/test1020 index 61032fb17..8e03a1758 100644 --- a/tests/data/test1020 +++ b/tests/data/test1020 @@ -23,7 +23,7 @@ file -Y range on a file:// URL to stdout - + -r -9 file://localhost/%PWD/log/test1020.txt diff --git a/tests/data/test1029 b/tests/data/test1029 index 2ffc7c64a..c77209cad 100644 --- a/tests/data/test1029 +++ b/tests/data/test1029 @@ -29,7 +29,7 @@ http HTTP Location: and 'redirect_url' check - + http://%HOSTIP:%HTTPPORT/we/want/our/1029 -w '%{redirect_url}\n' diff --git a/tests/data/test1146 b/tests/data/test1146 index 43f33b793..636748ee5 100644 --- a/tests/data/test1146 +++ b/tests/data/test1146 @@ -24,7 +24,7 @@ file --proto-default file - + --proto-default file %PWD/log/test1146.txt diff --git a/tests/data/test1220 b/tests/data/test1220 index 959abbf70..6752eb580 100644 --- a/tests/data/test1220 +++ b/tests/data/test1220 @@ -20,7 +20,7 @@ file file:// URLs with query string - + file://localhost/%PWD/log/test1220.txt?a_query=foobar#afragment diff --git a/tests/data/test200 b/tests/data/test200 index 8be1de0c7..c27f7c095 100644 --- a/tests/data/test200 +++ b/tests/data/test200 @@ -23,7 +23,7 @@ file basic file:// file - + file://localhost/%PWD/log/test200.txt diff --git a/tests/data/test2000 b/tests/data/test2000 index d3edb16e5..db1ba1330 100644 --- a/tests/data/test2000 +++ b/tests/data/test2000 @@ -31,7 +31,7 @@ file FTP RETR followed by FILE - + ftp://%HOSTIP:%FTPPORT/2000 file://localhost/%PWD/log/test2000.txt diff --git a/tests/data/test2001 b/tests/data/test2001 index 68c0df784..88a258ebb 100644 --- a/tests/data/test2001 +++ b/tests/data/test2001 @@ -48,7 +48,7 @@ file HTTP GET followed by FTP RETR followed by FILE - + http://%HOSTIP:%HTTPPORT/20010001 ftp://%HOSTIP:%FTPPORT/20010002 file://localhost/%PWD/log/test2001.txt @@ -81,17 +81,6 @@ RETR 20010002 QUIT -HTTP/1.1 200 OK -Date: Thu, 09 Nov 2010 14:49:00 GMT -Server: test-server/fake -Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT -ETag: "21025-dc7-39462498" -Accept-Ranges: bytes -Content-Length: 6 -Connection: close -Content-Type: text/html -Funny-head: yesyes - -foo- data to diff --git a/tests/data/test2002 b/tests/data/test2002 index db96bfea8..6dd2f9310 100644 --- a/tests/data/test2002 +++ b/tests/data/test2002 @@ -57,7 +57,7 @@ tftp HTTP GET followed by FTP RETR followed by FILE followed by TFTP RRQ - + http://%HOSTIP:%HTTPPORT/20020001 ftp://%HOSTIP:%FTPPORT/20020002 file://localhost/%PWD/log/test2002.txt tftp://%HOSTIP:%TFTPPORT//20020003 @@ -96,17 +96,6 @@ filename: /20020003 QUIT -HTTP/1.1 200 OK -Date: Thu, 09 Nov 2010 14:49:00 GMT -Server: test-server/fake -Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT -ETag: "21025-dc7-39462498" -Accept-Ranges: bytes -Content-Length: 6 -Connection: close -Content-Type: text/html -Funny-head: yesyes - -foo- data to diff --git a/tests/data/test2003 b/tests/data/test2003 index 59a743f85..09bee8e22 100644 --- a/tests/data/test2003 +++ b/tests/data/test2003 @@ -57,8 +57,8 @@ tftp HTTP GET followed by FTP RETR followed by FILE followed by TFTP RRQ then again in reverse order - -http://%HOSTIP:%HTTPPORT/20030001 ftp://%HOSTIP:%FTPPORT/20030002 file://localhost/%PWD/log/test2003.txt tftp://%HOSTIP:%TFTPPORT//20030003 tftp://%HOSTIP:%TFTPPORT//20030003 file://localhost/%PWD/log/test2003.txt ftp://%HOSTIP:%FTPPORT/20030002 http://%HOSTIP:%HTTPPORT/20030001 + +http://%HOSTIP:%HTTPPORT/20030001 ftp://%HOSTIP:%FTPPORT/20030002 file://localhost/%PWD/log/test2003.txt tftp://%HOSTIP:%TFTPPORT//20030003 tftp://%HOSTIP:%TFTPPORT//20030003 file://localhost/%PWD/log/test2003.txt ftp://%HOSTIP:%FTPPORT/20030002 http://%HOSTIP:%HTTPPORT/20030001 foo @@ -109,17 +109,6 @@ Accept: */* QUIT -HTTP/1.1 200 OK -Date: Thu, 09 Nov 2010 14:49:00 GMT -Server: test-server/fake -Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT -ETag: "21025-dc7-39462498" -Accept-Ranges: bytes -Content-Length: 6 -Connection: close -Content-Type: text/html -Funny-head: yesyes - -foo- data to @@ -151,17 +140,6 @@ data that FTP works so does it? -HTTP/1.1 200 OK -Date: Thu, 09 Nov 2010 14:49:00 GMT -Server: test-server/fake -Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT -ETag: "21025-dc7-39462498" -Accept-Ranges: bytes -Content-Length: 6 -Connection: close -Content-Type: text/html -Funny-head: yesyes - -foo- diff --git a/tests/data/test2004 b/tests/data/test2004 index 4773f6903..b17890b0f 100644 --- a/tests/data/test2004 +++ b/tests/data/test2004 @@ -29,7 +29,7 @@ sftp TFTP RRQ followed by SFTP retrieval followed by FILE followed by SCP retrieval then again in reverse order - + --key curl_client_key --pubkey curl_client_key.pub -u %USER: tftp://%HOSTIP:%TFTPPORT//2004 sftp://%HOSTIP:%SSHPORT%POSIX_PWD/log/test2004.txt file://localhost/%PWD/log/test2004.txt scp://%HOSTIP:%SSHPORT%POSIX_PWD/log/test2004.txt file://localhost/%PWD/log/test2004.txt sftp://%HOSTIP:%SSHPORT%POSIX_PWD/log/test2004.txt tftp://%HOSTIP:%TFTPPORT//2004 --insecure diff --git a/tests/data/test2006 b/tests/data/test2006 index e25556fcc..3acbdaee2 100644 --- a/tests/data/test2006 +++ b/tests/data/test2006 @@ -4,6 +4,7 @@ Metalink HTTP HTTP GET +FILE @@ -85,6 +86,10 @@ Accept: */* Some data delivered from an HTTP resource +Content-Length: 496 +Accept-ranges: bytes + + HTTP/1.1 200 OK Date: Thu, 21 Jun 2012 14:49:01 GMT Server: test-server/fake @@ -105,6 +110,9 @@ Metalink: fetching (log/download2006) from (http://%HOSTIP:%HTTPPORT/2006) OK Metalink: validating (log/download2006)... Metalink: validating (log/download2006) [sha-256] OK + +s/Last-Modified:.*// + $_ = '' if (($_ !~ /^Metalink: /) && ($_ !~ /error/i) && ($_ !~ /warn/i)) diff --git a/tests/data/test2007 b/tests/data/test2007 index cc4bd8c32..b169c4906 100644 --- a/tests/data/test2007 +++ b/tests/data/test2007 @@ -5,6 +5,7 @@ Metalink HTTP HTTP GET -J +FILE @@ -85,7 +86,14 @@ Accept: */* Something delivered from an HTTP resource + +s/Last-Modified:.*// + +Content-Length: 496 +Accept-ranges: bytes + + HTTP/1.1 200 OK Date: Thu, 21 Jun 2012 14:50:02 GMT Server: test-server/fake diff --git a/tests/data/test2008 b/tests/data/test2008 index 584379260..012f221c4 100644 --- a/tests/data/test2008 +++ b/tests/data/test2008 @@ -4,6 +4,7 @@ Metalink HTTP HTTP GET +FILE @@ -77,7 +78,14 @@ Accept: */* Some stuff delivered from an HTTP resource + +s/Last-Modified:.*// + +Content-Length: 496 +Accept-ranges: bytes + + HTTP/1.1 200 OK Date: Thu, 21 Jun 2012 15:23:48 GMT Server: test-server/fake diff --git a/tests/data/test2009 b/tests/data/test2009 index 84482ce89..b0e5c6c66 100644 --- a/tests/data/test2009 +++ b/tests/data/test2009 @@ -5,6 +5,7 @@ Metalink HTTP HTTP GET -J +FILE @@ -78,7 +79,14 @@ Accept: */* Some contents delivered from an HTTP resource + +s/Last-Modified:.*// + +Content-Length: 496 +Accept-ranges: bytes + + HTTP/1.1 200 OK Date: Thu, 21 Jun 2012 16:27:17 GMT Server: test-server/fake diff --git a/tests/data/test2010 b/tests/data/test2010 index 91a83f4dc..33bb309eb 100644 --- a/tests/data/test2010 +++ b/tests/data/test2010 @@ -4,6 +4,7 @@ Metalink HTTP HTTP GET +FILE @@ -77,7 +78,14 @@ Accept: */* Contents delivered from an HTTP resource + +s/Last-Modified:.*// + +Content-Length: 496 +Accept-ranges: bytes + + HTTP/1.1 200 OK Date: Thu, 21 Jun 2012 17:37:27 GMT Server: test-server/fake diff --git a/tests/data/test202 b/tests/data/test202 index f863ec507..0b324b1d8 100644 --- a/tests/data/test202 +++ b/tests/data/test202 @@ -19,7 +19,7 @@ file two file:// URLs to stdout - + file://localhost/%PWD/log/test202.txt FILE://localhost/%PWD/log/test202.txt diff --git a/tests/data/test203 b/tests/data/test203 index 366cc2cd0..393842656 100644 --- a/tests/data/test203 +++ b/tests/data/test203 @@ -24,7 +24,7 @@ file file:/path URL with a single slash - + file:%PWD/log/test203.txt diff --git a/tests/data/test204 b/tests/data/test204 index 9cc7b0154..0ed94512f 100644 --- a/tests/data/test204 +++ b/tests/data/test204 @@ -15,7 +15,7 @@ file "upload" with file:// - + file://localhost/%PWD/log/result204.txt -T log/upload204.txt diff --git a/tests/data/test205 b/tests/data/test205 index 4af93f642..f83c53157 100644 --- a/tests/data/test205 +++ b/tests/data/test205 @@ -16,7 +16,7 @@ file "upload" with file:// - + file://localhost/%PWD/log/nonexisting/result205.txt -T log/upload205.txt diff --git a/tests/data/test2070 b/tests/data/test2070 index bc3898ab3..655cd8a39 100644 --- a/tests/data/test2070 +++ b/tests/data/test2070 @@ -23,7 +23,7 @@ file basic file:// file with no authority - + file:%PWD/log/test2070.txt diff --git a/tests/data/test2071 b/tests/data/test2071 index 997dfffeb..eddfa4df7 100644 --- a/tests/data/test2071 +++ b/tests/data/test2071 @@ -23,7 +23,7 @@ file basic file:// file with "127.0.0.1" hostname - + file://127.0.0.1/%PWD/log/test2070.txt diff --git a/tests/data/test2072 b/tests/data/test2072 index cd26f22bd..1bab15888 100644 --- a/tests/data/test2072 +++ b/tests/data/test2072 @@ -23,7 +23,7 @@ file file:// with unix path resolution behavior for the case of extra slashes - + file:////%PWD/log/test2072.txt diff --git a/tests/data/test210 b/tests/data/test210 index e90456754..c6fb70309 100644 --- a/tests/data/test210 +++ b/tests/data/test210 @@ -22,7 +22,7 @@ ftp Get two FTP files from the same remote dir: no second CWD - + ftp://%HOSTIP:%FTPPORT/a/path/210 ftp://%HOSTIP:%FTPPORT/a/path/210 diff --git a/tests/data/test231 b/tests/data/test231 index 6994957c1..3d4bc7730 100644 --- a/tests/data/test231 +++ b/tests/data/test231 @@ -22,7 +22,7 @@ file file:// with resume - + file://localhost/%PWD/log/test231.txt -C 10 diff --git a/tests/data/test288 b/tests/data/test288 index ff4db6a47..9f8f6e121 100644 --- a/tests/data/test288 +++ b/tests/data/test288 @@ -30,7 +30,7 @@ file:// with (unsupported) proxy, authentication and range all_proxy=http://fake:user@%HOSTIP:%HTTPPORT/ - + file://localhost/%PWD/log/test288.txt -- cgit v1.2.1