Permalink
Browse files

import

  • Loading branch information...
0 parents commit dbc4e366b54c78cb099a43bd683dc0d20b1c1d39 @gabriel committed May 13, 2008
Showing with 3,098 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +19 −0 License.txt
  3. +72 −0 README
  4. +14 −0 Rakefile
  5. +21 −0 airake.yml
  6. BIN bin/Test.swf
  7. BIN lib/as3crypto-1_3_patched.swc
  8. +12 −0 lib/as3crypto_patches.txt
  9. BIN lib/corelib-20070830.swc
  10. BIN lib/flexunit-20071226.swc
  11. +14 −0 script/destroy
  12. +14 −0 script/generate
  13. +38 −0 src/HttpClient-app.xml
  14. +87 −0 src/Log.as
  15. +146 −0 src/org/httpclient/HttpClient.as
  16. +112 −0 src/org/httpclient/HttpHeader.as
  17. +138 −0 src/org/httpclient/HttpRequest.as
  18. +55 −0 src/org/httpclient/HttpResponse.as
  19. +252 −0 src/org/httpclient/HttpSocket.as
  20. +60 −0 src/org/httpclient/HttpTimer.as
  21. +23 −0 src/org/httpclient/events/HttpDataEvent.as
  22. +16 −0 src/org/httpclient/events/HttpErrorEvent.as
  23. +60 −0 src/org/httpclient/events/HttpListener.as
  24. +23 −0 src/org/httpclient/events/HttpStatusEvent.as
  25. +25 −0 src/org/httpclient/http/Delete.as
  26. +25 −0 src/org/httpclient/http/Get.as
  27. +25 −0 src/org/httpclient/http/Head.as
  28. +27 −0 src/org/httpclient/http/Post.as
  29. +25 −0 src/org/httpclient/http/Put.as
  30. +24 −0 src/org/httpclient/http/multipart/FilePart.as
  31. +99 −0 src/org/httpclient/http/multipart/Multipart.as
  32. +112 −0 src/org/httpclient/http/multipart/Part.as
  33. +147 −0 src/org/httpclient/io/HttpBuffer.as
  34. +36 −0 src/org/httpclient/io/HttpFileStream.as
  35. +51 −0 src/org/httpclient/io/HttpRequestBuffer.as
  36. +148 −0 src/org/httpclient/io/HttpResponseBuffer.as
  37. +21 −0 src/org/httpclient/ui/HttpClientApp.mxml
  38. +31 −0 src/org/httpclient/ui/HttpClientAppImpl.as
  39. +56 −0 test/Test-app.xml
  40. +50 −0 test/Test.mxml
  41. BIN test/assets/test.png
  42. +64 −0 test/delicious/TagsTest.as
  43. +56 −0 test/httpclient/http/GetTest.as
  44. +67 −0 test/httpclient/http/PostTest.as
  45. +103 −0 test/httpclient/http/TLSTest.as
  46. +55 −0 test/httpclient/http/UploadTest.as
  47. +46 −0 test/httpclient/io/ChunkedTest.as
  48. +51 −0 test/httpclient/io/ReadLineTest.as
  49. +102 −0 test/s3/HttpsTest.as
  50. +59 −0 test/s3/S3DeleteTest.as
  51. +143 −0 test/s3/S3GetTest.as
  52. +59 −0 test/s3/S3HeadTest.as
  53. +59 −0 test/s3/S3PutTest.as
  54. +23 −0 test/s3/debug.txt
  55. +20 −0 test/suite/DeliciousTests.as
  56. +23 −0 test/suite/HttpTests.as
  57. +22 −0 test/suite/S3Tests.as
  58. +18 −0 test/suite/UtilTests.as
  59. +48 −0 test/utils/UtilTest.as
@@ -0,0 +1,2 @@
+.svn
+.DS_Store
@@ -0,0 +1,19 @@
+Copyright (c) 2007 Gabriel Handford
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
72 README
@@ -0,0 +1,72 @@
+== Setup
+
+Flex SDK: http://labs.adobe.com/technologies/flex/sdk/flex3sdk.html
+
+To include mxmlc and fcsh (from Flex SDK):
+ export PATH="/path/to/flex_sdk_3/bin"
+
+AIR SDK: http://labs.adobe.com/downloads/airsdk.html
+
+To include adl and adt (from AIR SDK):
+ export PATH="/path/to/air_sdk/bin:$PATH"
+
+== Tasks
+
+ # View all tasks
+ rake --tasks
+
+ # Compiling
+ rake air:compile
+
+ # Running air debug launcher (ADL)
+ rake air:adl
+
+ # Start FCSHD (for faster compilation)
+ rake fcsh:start
+
+ # Stop FCSHD
+ rake fcsh:stop
+
+ # Restart FCSHD
+ rake fcsh:restart
+
+ # Running alternate MXML, (we expect src/Test-app.xml descriptor)
+ rake air:adl MXML=src/Test.mxml
+
+ # Run ADL with debug disabled
+ rake air:adl DEBUG=false
+
+ # Testing
+ rake air:test
+
+ # Package AIR file
+ rake air:package
+
+== Adding other tasks
+
+Add tasks to the rakefile, for example:
+
+ # Run ADL for Catalog mxml
+ task :catalog do
+ ENV["MXML"] = "src/catalog/Catalog.mxml"
+ Rake::Task["air:adl"].invoke
+ end
+
+== Override default settings for Rakefile
+
+This is experimental. In the Rakefile, specify:
+
+ # Override default settings, this is experimental
+ # cwd = File.expand_path(File.dirname(__FILE__))
+ #ENV["AMXMLC_PATH"] = "mxmlc"
+ #ENV["ADT_PATH"] = "adt"
+ #ENV["BIN_DIR"] = "#{cwd}/bin"
+ #ENV["SRC_DIR"] = "#{cwd}/src"
+ #ENV["LIB_DIR"] = "#{cwd}/lib"
+ #ENV["TEST_DIR"] = "#{cwd}/test"
+ #ENV["APPXML_PATH"] = "#{cwd}/src/MyProject-app.xml"
+ #ENV["AIR_PATH"] = "#{cwd}/bin/MyProject.air"
+ #ENV["SWF_PATH"] = "#{cwd}/bin/MyProject.swf"
+ #ENV["AMXMLC_EXTRA_OPTS"] = ...
+ #ENV["ADL_EXTRA_OPTS"] = ...
+ #ENV["ADT_EXTRA_OPTS"] = ...
@@ -0,0 +1,14 @@
+require 'rubygems'
+require 'airake'
+
+ENV["AIRAKE_ROOT"] ||= File.dirname(__FILE__)
+ENV["AIRAKE_ENV"] ||= "development"
+
+# For task list run, rake --tasks
+task :test => [ "air:test" ] do; end
+task :compile => [ "air:compile" ] do; end
+task :package => [ "air:package" ] do; end
+task :adl => [ "air:adl" ] do; end
+task :docs => [ "air:docs" ] do; end
+task :clean => [ "air:clean" ] do; end
+task :acompc => [ "air:acompc" ] do; end
@@ -0,0 +1,21 @@
+---
+mxml_path: "src/org/httpclient/ui/HttpClientApp.mxml"
+appxml_path: "src/HttpClient-app.xml"
+
+src_dirs: [ 'src' ]
+lib_dir: lib
+
+air_path: bin/HttpClientApp.air
+swf_path: bin/HttpClientApp.swf
+assets: src/assets
+certificate: cert.pfx
+
+development:
+ debug: true
+
+test:
+ swf_path: bin/Test.swf
+ mxml_path: test/Test.mxml
+ appxml_path: test/Test-app.xml
+ src_dirs: [ 'src', 'test' ]
+ debug: true
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,12 @@
+TLSEngine: line 691, instead of ==, do regex.
+
+var escaped:String = regexEscape(firstCert.getCommonName());
+var reg:String = escaped.replace(/\\\*/g, "[^.]+")
+if (new RegExp(reg).exec(_otherIdentity)) {
+
+The function to escape regular expression characters:
+
+// Regexp.escape(’\\*?{}.’) #=> \\\\\*\?\{\}\.
+private function regexEscape(s:String):String {
+ return s.replace(/([\\*?{}.])/g, "\\$1");
+}
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,14 @@
+#!/usr/bin/env ruby
+APP_ROOT = File.join(File.dirname(__FILE__), '..')
+
+begin
+ require 'rubigen'
+rescue LoadError
+ require 'rubygems'
+ require 'rubigen'
+end
+require 'rubigen/scripts/destroy'
+
+ARGV.shift if ['--help', '-h'].include?(ARGV[0])
+RubiGen::Base.use_component_sources! [:air, :airake, :test_unit]
+RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -0,0 +1,14 @@
+#!/usr/bin/env ruby
+APP_ROOT = File.join(File.dirname(__FILE__), '..')
+
+begin
+ require 'rubigen'
+rescue LoadError
+ require 'rubygems'
+ require 'rubigen'
+end
+require 'rubigen/scripts/generate'
+
+ARGV.shift if ['--help', '-h'].include?(ARGV[0])
+RubiGen::Base.use_component_sources! [:air, :airake, :test_unit]
+RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<application
+ xmlns="http://ns.adobe.com/air/application/1.0"
+ minimumPatchLevel="0">
+<!-- AIR Application Descriptor File. See http://www.adobe.com/go/air_1.0_application_descriptor. -->
+ <id>org.httpclient.HttpClient</id>
+ <name>Http Client</name>
+ <version>1.0</version>
+ <filename>HttpClient</filename>
+ <description>Http client kitchen sink</description>
+ <copyright>(c) 2008</copyright>
+ <initialWindow>
+ <content>bin/HttpClientApp.swf</content>
+ <title>HttpClient</title>
+ <systemChrome>standard</systemChrome>
+ <transparent>false</transparent>
+ <visible>true</visible>
+ <minimizable>true</minimizable>
+ <maximizable>true</maximizable>
+ <resizable>true</resizable>
+ <width>600</width>
+ <height>450</height>
+ <x>100</x>
+ <y>50</y>
+ <minSize>300 300</minSize>
+ <maxSize>800 800</maxSize>
+ </initialWindow>
+ <icon>
+ <!--
+ <image16x16>icons/AIRApp_16.png</image16x16>
+ <image32x32>icons/AIRApp_32.png</image32x32>
+ <image48x48>icons/AIRApp_48.png</image48x48>
+ <image128x128>src/assets/app_icons/icon_128.png</image128x128>
+ -->
+ </icon>
+ <customUpdateUI>false</customUpdateUI>
+ <allowBrowserInvocation>false</allowBrowserInvocation>
+</application>
@@ -0,0 +1,87 @@
+package {
+
+ import flash.utils.getQualifiedClassName;
+ import flash.utils.describeType;
+
+ /**
+ * Log class.
+ */
+ public class Log {
+
+ public static const DEBUG:Number = 1;
+ public static const INFO:Number = 2;
+ public static const WARN:Number = 3;
+ public static const ERROR:Number = 4;
+
+ public static var level:Number = DEBUG;
+
+ // What to do with logged string
+ private static function output(s:String):void {
+ trace(s);
+ }
+
+ /**
+ * Log at debug level.
+ * @param Debug string
+ * @param Objects to describe
+ */
+ public static function debug(... args):void {
+ if (level > DEBUG) return;
+ output(describeArgsToString(args));
+ }
+
+ /**
+ * Log at warn level.
+ */
+ public static function warn(... args):void {
+ if (level > WARN) return;
+ output("[WARNING] " + describeArgsToString(args));
+ }
+
+ /**
+ * Log at error level.
+ */
+ public static function error(... args):void {
+ output("[ERROR] " + describeArgsToString(args));
+ }
+
+ /**
+ * Describe an object.
+ */
+ public static function describe(obj:*):String {
+ if (obj == null) return "null";
+ if (obj is String) return obj.toString();
+ if (obj is Number) return obj.toString();
+ if (obj is Function) return "(Function)";
+ if (obj is Array) return "[ " + (obj as Array).map(function(item:*, index:int, a:Array):String { return describe(item); }).join(", ") + " ]";
+
+ var entries:Array = [];
+ for(var key:String in obj) {
+ // Make sure we don't stack overflow on cyclical reference
+ if (obj[key] == obj) continue;
+ entries.push(key + ": " + obj[key]); //describe(obj[key]));
+ }
+ if (entries.length > 0) return "{" + entries.join(", ") + "}";
+
+ var className:String = getQualifiedClassName(obj);
+ return "(" + className + ") " + obj.toString();
+ }
+
+ /**
+ * Describe arguments list.
+ * @param Arguments to describe
+ */
+ public static function describeArgs(args:Array):Array {
+ return args.map(function(item:*, index:int, array:Array):* { return describe(item); });
+ }
+
+ public static function describeArgsToString(args:Array):String {
+ if (args.length == 0) return "";
+ var described:Array = describeArgs(args);
+ if (described.length == 0) return "";
+ return described.join(", ");
+ }
+
+
+ }
+}
Oops, something went wrong.

0 comments on commit dbc4e36

Please sign in to comment.