Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
UrlRemap: Use a nicer name for the "ignore-me" request header.
  • Loading branch information
agrieve committed Mar 10, 2014
1 parent b471b8b commit 6f961db4e2bce0d086d770a79f644bcdfa34346b
Showing 1 changed file with 3 additions and 2 deletions.
@@ -242,7 +242,7 @@ - (void)setResetUrl:(CDVInvokedUrlCommand*)command {
@implementation UrlRemapURLProtocol

+ (BOOL)canInitWithRequest:(NSURLRequest*)request {
if ([request valueForHTTPHeaderField:@"fo"] != nil) {
if ([request valueForHTTPHeaderField:@"url-remap-ignore"] != nil) {
return NO;
}
NSURL* url = [request URL];
@@ -266,8 +266,9 @@ - (void)issueNotFoundResponse {
- (void)issueRedirectResponseToURL:(NSURL*)dest {
NSMutableURLRequest* req = [[self request] mutableCopy];
[req setURL:dest];
[req setValue:@"FOO" forHTTPHeaderField:@"fo"];
[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] }];

[[self client] URLProtocol:self wasRedirectedToRequest:req redirectResponse:response];

0 comments on commit 6f961db

Please sign in to comment.