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:25 UTC
[1/5] git commit: Show IP address for harness-push.
Repository: cordova-app-harness
Updated Branches:
refs/heads/master 6f961db4e -> 0c9986adf
Show IP address for harness-push.
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/15058020
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/15058020
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/15058020
Branch: refs/heads/master
Commit: 15058020b9d891c0041276a1c05db57a90e358a7
Parents: 6f961db
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Mar 18 16:29:06 2014 -0700
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Mar 18 16:29:06 2014 -0700
----------------------------------------------------------------------
www/cdvah/js/ListCtrl.js | 5 +++++
www/cdvah/views/list.html | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/15058020/www/cdvah/js/ListCtrl.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/ListCtrl.js b/www/cdvah/js/ListCtrl.js
index 7f7aca7..f49912d 100644
--- a/www/cdvah/js/ListCtrl.js
+++ b/www/cdvah/js/ListCtrl.js
@@ -105,6 +105,11 @@
$scope.$apply();
}, notifier.error);
+ appharness.push.getListenAddress(function(value) {
+ $scope.ipAddress = value;
+ $scope.$apply();
+ });
+
appharness.push.pending(function(obj) {
console.log('Return from pending: ' + obj);
if (obj && obj.type) {
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/15058020/www/cdvah/views/list.html
----------------------------------------------------------------------
diff --git a/www/cdvah/views/list.html b/www/cdvah/views/list.html
index f0ca2ff..f49de77 100644
--- a/www/cdvah/views/list.html
+++ b/www/cdvah/views/list.html
@@ -23,6 +23,6 @@
<div class="listen" ng-show="listening !== undefined">
<button class="topcoat-button" ng-show="!listening" ng-click="listen()">Start listening</button>
- <strong ng-show="listening">Listening</strong>
+ <div ng-show="listening">Listening. IP=<strong>{{ipAddress}}</strong></div>
</div>
[2/5] git commit: Add env variable for setting name and ID in
createproject.sh
Posted by ag...@apache.org.
Add env variable for setting name and ID in createproject.sh
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/fc9931d4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/fc9931d4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/fc9931d4
Branch: refs/heads/master
Commit: fc9931d4053d04996f68db21755c9fbc5fd54d3a
Parents: 1505802
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Mar 20 14:23:03 2014 -0700
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Mar 20 14:23:03 2014 -0700
----------------------------------------------------------------------
config.xml | 4 ++--
createproject.sh | 9 ++++++++-
2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/fc9931d4/config.xml
----------------------------------------------------------------------
diff --git a/config.xml b/config.xml
index bb20925..229aeda 100644
--- a/config.xml
+++ b/config.xml
@@ -17,8 +17,8 @@
specific language governing permissions and limitations
under the License.
-->
-<widget id="org.apache.appharness" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
- <name>CordovaAppHarness</name>
+<widget id="{ID}" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
+ <name>{NAME}</name>
<content src="cdvah/index.html" />
<access origin="*" />
</widget>
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/fc9931d4/createproject.sh
----------------------------------------------------------------------
diff --git a/createproject.sh b/createproject.sh
index c14dd69..b9eb2f2 100755
--- a/createproject.sh
+++ b/createproject.sh
@@ -6,18 +6,25 @@ if [[ $# -eq 0 || "$1" = "--help" ]]; then
echo ' PLATFORMS="android ios"'
echo ' CORDOVA="path/to/cordova"'
echo ' PLUGIN_SEARCH_PATH="path1:path2:path3"'
+ echo ' APP_ID="org.apache.AppHarness"'
+ echo ' APP_NAME="CordovaAppHarness"'
exit 1
fi
CORDOVA="${CORDOVA-cordova}"
PLATFORMS="${PLATFORMS-android}"
+APP_ID=${APP_ID-org.apache.appharness}
+APP_NAME=${APP_NAME-CordovaAppHarness}
DIR_NAME="${1}"
AH_PATH="$(cd $(dirname $0) && pwd)"
PLUGIN_SEARCH_PATH="${PLUGIN_SEARCH_PATH-$(dirname "$AH_PATH"):$(dirname "$AH_PATH")/cordova-plugins}"
-"$CORDOVA" create "$DIR_NAME" org.apache.appharness CordovaAppHarness --link-to "$AH_PATH/www" || exit 1
+"$CORDOVA" create "$DIR_NAME" "$APP_ID" "$APP_NAME" --link-to "$AH_PATH/www" || exit 1
cd "$DIR_NAME"
cp "$AH_PATH/config.xml" . || exit 1
+perl -i -pe "s/{ID}/$APP_ID/g" config.xml || exit 1
+perl -i -pe "s/{NAME}/$APP_NAME/g" config.xml || exit 1
+
set -x
$CORDOVA platform add $PLATFORMS || exit 1
[4/5] git commit: Auto-listen when harness-push plugin exists
(instead of pushing a button)
Posted by ag...@apache.org.
Auto-listen when harness-push plugin exists (instead of pushing a button)
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/afdd006f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/afdd006f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/afdd006f
Branch: refs/heads/master
Commit: afdd006f37dec2e4fe480e51508bebde04578df6
Parents: feaebe8
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Mar 20 14:25:22 2014 -0700
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Mar 20 21:32:31 2014 -0700
----------------------------------------------------------------------
www/cdvah/js/ListCtrl.js | 127 ++++++++++++++++++++---------------------
www/cdvah/views/list.html | 5 +-
2 files changed, 64 insertions(+), 68 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/afdd006f/www/cdvah/js/ListCtrl.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/ListCtrl.js b/www/cdvah/js/ListCtrl.js
index f49912d..fe6cb46 100644
--- a/www/cdvah/js/ListCtrl.js
+++ b/www/cdvah/js/ListCtrl.js
@@ -4,7 +4,7 @@
/* global appharness */
myApp.controller('ListCtrl', ['$location', 'notifier', '$rootScope', '$scope', '$routeParams', '$q', 'AppsService', function ($location, notifier, $rootScope, $scope, $routeParams, $q, AppsService) {
$scope.appList = [];
- $rootScope.appTitle = 'Cordova App Harness';
+ $rootScope.appTitle = document.title;
function initialise() {
return $scope.loadAppsList()
@@ -31,6 +31,67 @@
});
}
}
+ }).then(function() {
+ if (!window.appharness || !appharness.push) {
+ return;
+ }
+
+ // listen is a no-op if already listening.
+ appharness.push.listen(function() {
+ $scope.listening = true;
+ $scope.$apply();
+ }, notifier.error);
+
+ appharness.push.getListenAddress(function(value) {
+ $scope.ipAddress = value;
+ $scope.$apply();
+ });
+
+ appharness.push.pending(function(obj) {
+ console.log('Return from pending: ' + obj);
+ if (obj && obj.type) {
+ AppsService.getAppList().then(function(list) {
+ console.log(list);
+ var matches = list && list.filter(function(x) { return x.appId == obj.name; });
+ var promise;
+ if (list && matches.length > 0) {
+ // App exists.
+ var app = matches[0];
+ app.url = obj.url;
+ promise = $q.when(app);
+ } else {
+ // New app.
+ var handler;
+ promise = AppsService.addApp(obj.type, obj.url).then(function(h) {
+ handler = h;
+ var msg = 'Added new app ' + handler.appId + ' from push';
+ console.log(msg);
+ notifier.success(msg);
+ }).then(function() {
+ // Reload so the app is visible while it's updating (below).
+ return $scope.loadAppsList().then(function() {
+ return handler;
+ });
+ });
+ }
+
+ var theApp;
+ promise.then(function(app) {
+ theApp = app;
+ return AppsService.updateApp(app);
+ }).then(function() {
+ notifier.success('Updated ' + theApp.appId + ' due to remote push.');
+ return $scope.loadAppsList();
+ }).then(function() {
+ return $scope.launchApp(theApp, { stopPropagation: function() { } });
+ }).done(null, function(err) {
+ var msg = 'Failed to update ' + app.appId + ': ' + err;
+ console.error(msg);
+ notifier.error(msg);
+ });
+ });
+ }
+ });
});
}
@@ -99,70 +160,6 @@
initialise();
- if (window.appharness && appharness.push) {
- appharness.push.listening(function(res) {
- $scope.listening = res;
- $scope.$apply();
- }, notifier.error);
-
- appharness.push.getListenAddress(function(value) {
- $scope.ipAddress = value;
- $scope.$apply();
- });
-
- appharness.push.pending(function(obj) {
- console.log('Return from pending: ' + obj);
- if (obj && obj.type) {
- AppsService.getAppList().then(function(list) {
- console.log(list);
- var matches = list && list.filter(function(x) { return x.appId == obj.name; });
- var promise;
- if (list && matches.length > 0) {
- // App exists.
- var app = matches[0];
- app.url = obj.url;
- promise = $q.when(app);
- } else {
- // New app.
- var handler;
- promise = AppsService.addApp(obj.type, obj.url).then(function(h) {
- handler = h;
- var msg = 'Added new app ' + handler.appId + ' from push';
- console.log(msg);
- notifier.success(msg);
- }).then(function() {
- // Reload so the app is visible while it's updating (below).
- return $scope.loadAppsList().then(function() {
- return handler;
- });
- });
- }
-
- var theApp;
- promise.then(function(app) {
- theApp = app;
- return AppsService.updateApp(app);
- }).then(function() {
- notifier.success('Updated ' + theApp.appId + ' due to remote push.');
- return $scope.loadAppsList();
- }).then(function() {
- return $scope.launchApp(theApp, { stopPropagation: function() { } });
- }).done(null, function(err) {
- var msg = 'Failed to update ' + app.appId + ': ' + err;
- console.error(msg);
- notifier.error(msg);
- });
- });
- }
- });
-
- $scope.listen = function() {
- appharness.push.listen(function() {
- $scope.listening = true;
- $scope.$apply();
- }, notifier.error);
- };
- }
}]);
})();
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/afdd006f/www/cdvah/views/list.html
----------------------------------------------------------------------
diff --git a/www/cdvah/views/list.html b/www/cdvah/views/list.html
index f49de77..aa368b8 100644
--- a/www/cdvah/views/list.html
+++ b/www/cdvah/views/list.html
@@ -21,8 +21,7 @@
<button class="topcoat-button" ng-click="loadAppsList()">Reload</button>
</div>
-<div class="listen" ng-show="listening !== undefined">
- <button class="topcoat-button" ng-show="!listening" ng-click="listen()">Start listening</button>
- <div ng-show="listening">Listening. IP=<strong>{{ipAddress}}</strong></div>
+<div class="listen" ng-show="listening">
+ Listening. IP = <strong>{{ipAddress}}</strong>
</div>
[3/5] git commit: Clear cache before launching an app.
Posted by ag...@apache.org.
Clear cache before launching an app.
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/feaebe87
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/feaebe87
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/feaebe87
Branch: refs/heads/master
Commit: feaebe87a8bbb4610bfb3613be4185e6208392ea
Parents: fc9931d
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Mar 20 14:24:53 2014 -0700
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Mar 20 21:32:31 2014 -0700
----------------------------------------------------------------------
CacheClear/README.md | 5 +++
CacheClear/cacheclear.js | 24 +++++++++++++
CacheClear/plugin.xml | 52 +++++++++++++++++++++++++++++
CacheClear/src/android/CacheClear.java | 37 ++++++++++++++++++++
CacheClear/src/ios/CacheClear.m | 32 ++++++++++++++++++
createproject.sh | 1 +
www/cdvah/js/Installer.js | 5 ++-
7 files changed, 155 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/feaebe87/CacheClear/README.md
----------------------------------------------------------------------
diff --git a/CacheClear/README.md b/CacheClear/README.md
new file mode 100644
index 0000000..8c1d0a1
--- /dev/null
+++ b/CacheClear/README.md
@@ -0,0 +1,5 @@
+CacheClear
+===========
+
+Adds an API for clearing the browser cache.
+
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/feaebe87/CacheClear/cacheclear.js
----------------------------------------------------------------------
diff --git a/CacheClear/cacheclear.js b/CacheClear/cacheclear.js
new file mode 100644
index 0000000..5133d6c
--- /dev/null
+++ b/CacheClear/cacheclear.js
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+var exec = cordova.require('cordova/exec');
+
+exports.clearCache = function() {
+ exec(null, null, 'CacheClear', 'clearCache', []);
+};
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/feaebe87/CacheClear/plugin.xml
----------------------------------------------------------------------
diff --git a/CacheClear/plugin.xml b/CacheClear/plugin.xml
new file mode 100644
index 0000000..2792b1a
--- /dev/null
+++ b/CacheClear/plugin.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<plugin xmlns="http://phonegap.com/ns/plugins/1.0"
+ id="org.apache.cordova.CacheClear"
+ version="0.0.1">
+ <engines>
+ <engine name="cordova" version=">=3.0.0" />
+ </engines>
+
+ <name>CacheClear</name>
+
+ <js-module src="cacheclear.js" name="CacheClear">
+ <clobbers target="cordova.plugins.cacheclear" />
+ </js-module>
+
+ <platform name="android">
+ <source-file src="src/android/CacheClear.java" target-dir="src/org/apache/cordova/cacheclear" />
+
+ <config-file target="res/xml/config.xml" parent="/*">
+ <feature name="CacheClear">
+ <param name="android-package" value="org.apache.cordova.urlremap.CacheClear"/>
+ </feature>
+ </config-file>
+ </platform>
+
+ <platform name="ios">
+ <source-file src="src/ios/CacheClear.m" />
+
+ <config-file target="config.xml" parent="/*">
+ <feature name="CacheClear">
+ <param name="ios-package" value="CacheClear"/>
+ </feature>
+ </config-file>
+ </platform>
+</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/feaebe87/CacheClear/src/android/CacheClear.java
----------------------------------------------------------------------
diff --git a/CacheClear/src/android/CacheClear.java b/CacheClear/src/android/CacheClear.java
new file mode 100644
index 0000000..60e04c4
--- /dev/null
+++ b/CacheClear/src/android/CacheClear.java
@@ -0,0 +1,37 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova.cacheclear;
+
+import org.apache.cordova.CallbackContext;
+import org.apache.cordova.CordovaArgs;
+import org.apache.cordova.CordovaPlugin;
+import org.json.JSONException;
+
+public class CacheClear extends CordovaPlugin {
+ @Override
+ public boolean execute(String action, CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
+ if ("cacheClear".equals(action)) {
+ webView.clearCache(true);
+ callbackContext.success();
+ } else {
+ return false;
+ }
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/feaebe87/CacheClear/src/ios/CacheClear.m
----------------------------------------------------------------------
diff --git a/CacheClear/src/ios/CacheClear.m b/CacheClear/src/ios/CacheClear.m
new file mode 100644
index 0000000..d093cc4
--- /dev/null
+++ b/CacheClear/src/ios/CacheClear.m
@@ -0,0 +1,32 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+#import <UIKit/UIKit.h>
+#import <Cordova/CDVPlugin.h>
+
+@interface CacheClear : CDVPlugin
+@end
+
+@implementation CacheClear
+
+- (void)clearCache:(CDVInvokedUrlCommand*)command {
+ [[NSURLCache sharedURLCache] removeAllCachedResponses];
+}
+
+@end
+
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/feaebe87/createproject.sh
----------------------------------------------------------------------
diff --git a/createproject.sh b/createproject.sh
index b9eb2f2..1ffa386 100755
--- a/createproject.sh
+++ b/createproject.sh
@@ -37,6 +37,7 @@ set +x
echo Installing plugins.
"$CORDOVA" plugin add\
"$AH_PATH/UrlRemap" \
+ "$AH_PATH/CacheClear" \
org.apache.cordova.file \
org.apache.cordova.file-transfer \
org.apache.cordova.device \
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/feaebe87/www/cdvah/js/Installer.js
----------------------------------------------------------------------
diff --git a/www/cdvah/js/Installer.js b/www/cdvah/js/Installer.js
index 704c679..339430c 100644
--- a/www/cdvah/js/Installer.js
+++ b/www/cdvah/js/Installer.js
@@ -1,6 +1,6 @@
(function(){
'use strict';
- /* global myApp */
+ /* global myApp, cordova */
myApp.factory('Installer', ['$q', 'UrlRemap', 'ResourcesLoader', 'ContextMenuInjectScript', 'PluginMetadata', function($q, UrlRemap, ResourcesLoader, ContextMenuInjectScript, PluginMetadata) {
function getAppStartPageFromConfig(configFile) {
@@ -64,6 +64,9 @@
var self = this;
this.updatingStatus = 0;
this.installPath = installPath;
+ // Cache clearing necessary only for Android.
+ cordova.plugins.cacheclear.clearCache();
+
return this.doUpdateApp()
.then(function() {
self.lastUpdated = new Date();
[5/5] git commit: Fix UrlRemap not always setting no-cache headers.
Posted by ag...@apache.org.
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];
}