flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [1/2] git commit: [flex-utilities] [refs/heads/develop] - use etags over last-modified dates. The last modified dates for AIR SDKs become unstable. They would change from run to run.
Date Fri, 21 Nov 2014 21:04:02 GMT
Repository: flex-utilities
Updated Branches:
  refs/heads/develop ce0e4bbb2 -> b995ad27d


use etags over last-modified dates.  The last modified dates for AIR SDKs become unstable.
 They would change from run to run.


Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/db570199
Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/db570199
Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/db570199

Branch: refs/heads/develop
Commit: db57019965ae5139b7b0b3b81fcfd75869900699
Parents: ce0e4bb
Author: Alex Harui <aharui@apache.org>
Authored: Fri Nov 21 13:02:38 2014 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Fri Nov 21 13:02:38 2014 -0800

----------------------------------------------------------------------
 MD5Checker/src/MD5Checker.mxml | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/db570199/MD5Checker/src/MD5Checker.mxml
----------------------------------------------------------------------
diff --git a/MD5Checker/src/MD5Checker.mxml b/MD5Checker/src/MD5Checker.mxml
index 3e2b9c8..24709a1 100644
--- a/MD5Checker/src/MD5Checker.mxml
+++ b/MD5Checker/src/MD5Checker.mxml
@@ -39,12 +39,19 @@ limitations under the License.
                 nativeApplication.addEventListener(InvokeEvent.INVOKE, parseArgs);
             }
             private var logFileName:String = "MD5CheckerLog.txt";
+            private var outFileName:String;
             
             private function parseArgs(event:InvokeEvent):void {
                 for each (var s:String in event.arguments) {
                     if (s.indexOf("-log=") == 0) {
                         logFileName = s.substring(5);
                     }
+                    if (s.indexOf("-out=") == 0) {
+                        outFileName = s.substring(5);
+                    }
+                    if (s.indexOf("-config=") == 0) {
+                        configURL = s.substring(8);
+                    }
                 }
             }
             
@@ -74,6 +81,9 @@ limitations under the License.
             
             private function xmlcompleteHandler(event:Event):void
             {
+                XML.ignoreComments = false;
+                XML.prettyIndent = 4;
+                
                 xml = new XML(xmlLoader.data as String);
                 var xmlList:XMLList;
                 
@@ -169,6 +179,18 @@ limitations under the License.
                 if (current >= data.length)
                 {
                     fs.close();
+                    if (nodeChanged && outFileName)
+                    {
+                        f = File.applicationDirectory.resolvePath("ApacheHeader.txt");
+                        fs.open(f, FileMode.READ);
+                        var header:String = fs.readUTFBytes(fs.bytesAvailable);
+                        fs.close();
+                        f = File.documentsDirectory.resolvePath(outFileName);
+                        fs.open(f, FileMode.WRITE);
+                        fs.writeUTFBytes(header);
+                        fs.writeUTFBytes(xml.toXMLString());
+                        fs.close();
+                    }
                     this.nativeApplication.exit(nodeChanged ? -1 : 0);
                     return;
                 }
@@ -206,12 +228,16 @@ limitations under the License.
                     var headers:Array = event.responseHeaders;
                     for each (var header:URLRequestHeader in headers)
                     {
-                        if (header.name == "Last-Modified")
+                        if (header.name == "Etag" || header.name == "ETag")
                         {
                             lastModified = header.value;
+                            if (lastModified.indexOf('"') == 0)
+                                lastModified = lastModified.substr(1);
+                            if (lastModified.indexOf('"') == lastModified.length - 1)
+                                lastModified = lastModified.substr(0, lastModified.length
- 1);
                             foundLastModified = true;
                         }
-                        else if ((header.name == "Etag" || header.name == "ETag") &&
lastModified == null)
+                        else if ((header.name == "Last-Modified") && lastModified
== null)
                         {
                             lastModified = header.value;
                             foundLastModified = true;


Mime
View raw message