HTTP: Output http response 304 when modified time is too old
authorDerek Higgins <derekh@redhat.com>
Thu, 3 Oct 2013 22:41:56 +0000 (23:41 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 7 Oct 2013 12:16:39 +0000 (14:16 +0200)
When using the -w '%{http_code}' flag and simulating a Not Modified then
304 should be output.

lib/transfer.c

index 760e79d..533e394 100644 (file)
@@ -542,6 +542,10 @@ static CURLcode readwrite_data(struct SessionHandle *data,
 
             if(!Curl_meets_timecondition(data, k->timeofdoc)) {
               *done = TRUE;
+              /* We're simulating a http 304 from server so we return
+                 what should have been returned from the server */
+              data->info.httpcode = 304;
+              infof(data, "Simulate a HTTP 304 response!\n");
               /* we abort the transfer before it is completed == we ruin the
                  re-use ability. Close the connection */
               conn->bits.close = TRUE;