Commit b001e45e authored by sfalken's avatar sfalken

2006-11-18 Steve Falkenburg <sfalken@apple.com>

        Reviewed by Adam.

        Properly adjust CFAbsoluteTime to time_t to fix date calculations.
        
        Compare lastModified w/ MAX_TIME_T when setting last modified date
        instead of comparing expiration against MAX_TIME_T.

        * platform/network/cf/ResourceResponseCFNet.cpp:
        (WebCore::getResourceResponse): Add kCFAbsoluteTimeIntervalSince1970 in assignment



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@17839 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 202e8653
2006-11-18 Steve Falkenburg <sfalken@apple.com>
Reviewed by Adam.
Properly adjust CFAbsoluteTime to time_t to fix date calculations.
Compare lastModified w/ MAX_TIME_T when setting last modified date
instead of comparing expiration against MAX_TIME_T.
* platform/network/cf/ResourceResponseCFNet.cpp:
(WebCore::getResourceResponse): Add kCFAbsoluteTimeIntervalSince1970 in assignment
2006-11-17 Anders Carlsson <acarlsson@apple.com>
Reviewed by Geoff.
......@@ -30,6 +30,8 @@
#include "ResourceResponse.h"
#include <CFNetwork/CFURLResponsePriv.h>
using std::min;
// We would like a better value for a maximum time_t,
// but there is no way to do that in C with any certainty.
// INT_MAX should work well enough for our purposes.
......@@ -48,10 +50,10 @@ namespace WebCore {
response = ResourceResponse(CFURLResponseGetURL(cfResponse), CFURLResponseGetMIMEType(cfResponse), CFURLResponseGetExpectedContentLength(cfResponse), CFURLResponseGetTextEncodingName(cfResponse), /* suggestedFilename */ "");
CFAbsoluteTime expiration = CFURLResponseGetExpirationTime(cfResponse);
response.setExpirationDate(expiration + kCFAbsoluteTimeIntervalSince1970 > MAX_TIME_T ? MAX_TIME_T : (time_t)expiration);
response.setExpirationDate(min((time_t)(expiration + kCFAbsoluteTimeIntervalSince1970), MAX_TIME_T));
CFAbsoluteTime lastModified = CFURLResponseGetLastModifiedDate(cfResponse);
response.setLastModifiedDate(expiration + kCFAbsoluteTimeIntervalSince1970 > MAX_TIME_T ? MAX_TIME_T : (time_t)lastModified);
response.setLastModifiedDate(min((time_t)(lastModified + kCFAbsoluteTimeIntervalSince1970), MAX_TIME_T));
CFHTTPMessageRef httpResponse = CFURLResponseGetHTTPResponse(cfResponse);
if (httpResponse) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment