#1288 when simulating not-modified --write-out outputs a http 200

closed-fixed
None
5
2013-10-07
2013-10-03
No

When curl is simulating a "304 Not Modified" after chcking the Last-Modified, if write-out is being used curl outputs a "200", this behaviour is different from what happens if server actually returned a 304. Since the "200" case is simulating a 304 it should probably output a 304.

snipit of curl output below

GET http://mirrors.nebo.edu/public/fedora/linux/releases/19/Images/i386/Fedora-i386-19-20130627-sda.qcow2 HTTP/1.1
User-Agent: curl/7.27.0
Host: mirrors.nebo.edu
Accept: /
Proxy-Connection: Keep-Alive
If-Modified-Since: Thu, 03 Oct 2013 19:51:39 GMT

< HTTP/1.1 200 OK
< Date: Thu, 03 Oct 2013 19:48:14 GMT
< Server: Apache/2.2.15 (CentOS)
< Last-Modified: Thu, 27 Jun 2013 18:25:54 GMT
< ETag: "fe1851-e0a0000-4e026e482d080"
< Accept-Ranges: bytes
< Content-Length: 235536384
< Content-Type: text/plain; charset=UTF-8
< X-Cache: MISS from rhev-i16c-02.mpc.lab.eng.bos.redhat.com
< X-Cache-Lookup: MISS from rhev-i16c-02.mpc.lab.eng.bos.redhat.com:3128
< Via: 1.1 rhev-i16c-02.mpc.lab.eng.bos.redhat.com (squid/3.2.13)
< Connection: keep-alive
<
The requested document is not new enough
0 224M 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
Closing connection #0
200

I made an attempt at a fix and attached it but probably missed something, can try again if thats the case.

1 Attachments

Discussion

  • Daniel Stenberg

    Daniel Stenberg - 2013-10-07
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
     When curl is simulating a "304 Not Modified" after chcking the Last-Modified, if write-out is being used curl outputs a "200", this behaviour is different from what happens if server actually returned a 304. Since the "200" case is simulating a 304 it should probably output a 304.
    
     snipit of curl output below
    
    • status: open --> open-confirmed
    • assigned_to: Daniel Stenberg
     
  • Daniel Stenberg

    Daniel Stenberg - 2013-10-07

    Thanks!

    Yeah, I believe that's a decent fix. I'll add a log output explaining it though so that it may be less of a surprise to users. I'll also write up a test case first before I push this.

     
  • Daniel Stenberg

    Daniel Stenberg - 2013-10-07
    • status: open-confirmed --> closed-fixed
     
  • Daniel Stenberg

    Daniel Stenberg - 2013-10-07

    Merged as commit 4cd444e01ad0d. Case closed!

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks