HTTP: Output http response 304 when modified time is too old

When using the -w '%{http_code}' flag and simulating a Not Modified then
304 should be output.
This commit is contained in:
Derek Higgins 2013-10-03 23:41:56 +01:00 committed by Daniel Stenberg
parent 8264478490
commit 4cd444e01a

View File

@ -542,6 +542,10 @@ static CURLcode readwrite_data(struct SessionHandle *data,
if(!Curl_meets_timecondition(data, k->timeofdoc)) { if(!Curl_meets_timecondition(data, k->timeofdoc)) {
*done = TRUE; *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 /* we abort the transfer before it is completed == we ruin the
re-use ability. Close the connection */ re-use ability. Close the connection */
conn->bits.close = TRUE; conn->bits.close = TRUE;