You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/03/21 05:34:29 UTC
[5/5] git commit: Fix UrlRemap not always setting no-cache headers.
Fix UrlRemap not always setting no-cache headers.
Project: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/commit/0c9986ad
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/0c9986ad
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/0c9986ad
Branch: refs/heads/master
Commit: 0c9986adf833bdbffeaaac7baffa954430e4d964
Parents: afdd006
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Mar 20 21:33:52 2014 -0700
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Mar 20 21:33:52 2014 -0700
----------------------------------------------------------------------
UrlRemap/src/ios/UrlRemap.m | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/0c9986ad/UrlRemap/src/ios/UrlRemap.m
----------------------------------------------------------------------
diff --git a/UrlRemap/src/ios/UrlRemap.m b/UrlRemap/src/ios/UrlRemap.m
index 3885c8c..8a26236 100644
--- a/UrlRemap/src/ios/UrlRemap.m
+++ b/UrlRemap/src/ios/UrlRemap.m
@@ -258,7 +258,7 @@ static NSString* mimeTypeForPath(NSString* path) {
- (void)issueNotFoundResponse {
NSURL* url = [[self request] URL];
- NSURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:url statusCode:404 HTTPVersion:@"HTTP/1.1" headerFields:@{}];
+ NSURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:url statusCode:404 HTTPVersion:@"HTTP/1.1" headerFields:@{@"Cache-Control": @"no-cache"}];
[[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
[[self client] URLProtocolDidFinishLoading:self];
}
@@ -268,8 +268,7 @@ static NSString* mimeTypeForPath(NSString* path) {
[req setURL:dest];
[req setValue:@"1" forHTTPHeaderField:@"url-remap-ignore"];
- // Responses get cached regardless of if we specify Cache-Control here.
- NSURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:[[self request] URL] statusCode:302 HTTPVersion:@"HTTP/1.1" headerFields:@{ @"Location": [dest absoluteString] }];
+ NSURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:[[self request] URL] statusCode:302 HTTPVersion:@"HTTP/1.1" headerFields:@{ @"Location": [dest absoluteString], @"Cache-Control": @"no-cache" }];
[[self client] URLProtocol:self wasRedirectedToRequest:req redirectResponse:response];
}