diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-08-25 16:56:56 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-09-24 16:12:03 +0200 |
commit | b94635f70430c3659cd57596e49649d376284473 (patch) | |
tree | 8d3957bf7c26c8fffeb7f961e0826ab625d5052a /common/foundation_request.mm | |
parent | 28446bed24689b2bac7c8bfbd37741a7fa4fa6be (diff) | |
download | qtlocation-mapboxgl-b94635f70430c3659cd57596e49649d376284473.tar.gz |
parse cache-control and last-modified headers
Diffstat (limited to 'common/foundation_request.mm')
-rw-r--r-- | common/foundation_request.mm | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/common/foundation_request.mm b/common/foundation_request.mm index b7eafdb96c..478dadf4d9 100644 --- a/common/foundation_request.mm +++ b/common/foundation_request.mm @@ -91,8 +91,12 @@ mbgl::platform::request_http(const std::string &url, } if (!error && [response isKindOfClass:[NSHTTPURLResponse class]]) { + NSDictionary *headers = [(NSHTTPURLResponse *)response allHeaderFields]; (*req_ptr)->res->code = [(NSHTTPURLResponse *)response statusCode]; (*req_ptr)->res->body = {(const char *)[data bytes], [data length]}; + (*req_ptr)->res->setCacheControl([[headers objectForKey:@"Cache-Control"] UTF8String]); + (*req_ptr)->res->setLastModified([[headers objectForKey:@"Last-Modified"] UTF8String]); + } else { (*req_ptr)->res->error_message = [[error localizedDescription] UTF8String]; } |