Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--header "If-Modified-Since:" doesn't suppress that header #4103

Closed
psimonyi opened this issue Jul 10, 2019 · 1 comment

Comments

@psimonyi
Copy link

commented Jul 10, 2019

I did this

touch hello.txt
curl --silent --verbose --time-cond hello.txt --header "If-Modified-Since:" --remote-name http://localhost:8080/hello.txt

i.e. use --time-cond but suppress the header it generates with --header as described in the man page: "Remove an internal header by giving a replacement without content on the right side of the colon".

(For context, I'm also adding the If-None-Match header, so I do want the 304-means-keep-file behaviour that --time-cond provides, just with a different header.)

I expected the following

The generated If-Modified-Since header would be suppressed, like so:

GET /hello.txt HTTP/1.1
Host: localhost:8080
User-Agent: curl/7.64.0
Accept: */*

curl/libcurl version

$ curl -V
curl 7.64.0 (x86_64-redhat-linux-gnu) libcurl/7.64.0 OpenSSL/1.1.1c zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.20.2 (+libidn2/2.0.5) libssh/0.8.7/openssl/zlib nghttp2/1.38.0
Release-Date: 2019-02-06
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz brotli TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL Metalink

operating system

Fedora 30

psimonyi pushed a commit to psimonyi/curl that referenced this issue Jul 11, 2019

Peter Simonyi
http: allow overriding timecond with custom header
With CURLOPT_TIMECONDITION set, a header is automatically added (e.g.
If-Modified-Since).  Allow this to be replaced or suppressed with
CURLOPT_HTTPHEADER.

Closes curl#4103
@psimonyi

This comment has been minimized.

Copy link
Author

commented Jul 11, 2019

I decided to take a stab at this myself :)

psimonyi pushed a commit to psimonyi/curl that referenced this issue Jul 12, 2019

Peter Simonyi
http: allow overriding timecond with custom header
With CURLOPT_TIMECONDITION set, a header is automatically added (e.g.
If-Modified-Since).  Allow this to be replaced or suppressed with
CURLOPT_HTTPHEADER.

Closes curl#4103

@bagder bagder closed this in 855887a Jul 14, 2019

caraitto added a commit to caraitto/curl that referenced this issue Jul 23, 2019

http: allow overriding timecond with custom header
With CURLOPT_TIMECONDITION set, a header is automatically added (e.g.
If-Modified-Since).  Allow this to be replaced or suppressed with
CURLOPT_HTTPHEADER.

Fixes curl#4103
Closes curl#4109
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.