r85431 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85430‎ | r85431 | r85432 >
Date:10:57, 5 April 2011
Author:reedy
Status:deferred
Tags:
Comment:
Bump aws-sdk to 1.3.1 "Kraken"
Modified paths:
  • /trunk/extensions/OpenStackManager/aws-sdk/_compatibility_test/sdk_compatibility_test.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/_docs/CHANGELOG.md (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/_docs/NOTICE.md (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/sdk.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/services/as.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/services/cloudformation.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/services/cloudwatch.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/services/ec2.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/services/elasticbeanstalk.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/services/elb.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/services/emr.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/services/iam.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/services/importexport.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/services/rds.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/services/s3.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/services/sdb.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/services/ses.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/services/sns.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/services/sqs.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/utilities/array.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/utilities/gzipdecode.class.php (added) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/utilities/json.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/utilities/simplexml.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/utilities/utilities.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/aws-sdk/services/cloudformation.class.php
@@ -33,7 +33,7 @@
3434 * Amazon CloudFormation makes use of other AWS products. If you need additional technical information about a specific AWS
3535 * product, you can find the product's technical documentation at http://aws.amazon.com/documentation/.
3636 *
37 - * @version Tue Mar 15 11:07:12 PDT 2011
 37+ * @version Fri Mar 25 13:12:48 PDT 2011
3838 * @license See the included NOTICE.md file for complete information.
3939 * @copyright See the included NOTICE.md file for complete information.
4040 * @link http://aws.amazon.com/cloudformation/Amazon CloudFormation
Index: trunk/extensions/OpenStackManager/aws-sdk/services/s3.class.php
@@ -1140,7 +1140,7 @@
11411141 * <li><code>meta</code> - <code>array</code> - Optional - An associative array of key-value pairs. Represented by <code>x-amz-meta-:</code>. Any header starting with this prefix is considered user metadata. It will be stored with the object and returned when you retrieve the object. The total size of the HTTP request, not including the body, must be less than 4 KB.</li>
11421142 * <li><code>seekTo</code> - <code>integer</code> - Optional - The starting position in bytes within the file/stream to upload from.</li>
11431143 * <li><code>storage</code> - <code>string</code> - Optional - Whether to use Standard or Reduced Redundancy storage. [Allowed values: <code>AmazonS3::STORAGE_STANDARD</code>, <code>AmazonS3::STORAGE_REDUCED</code>]. The default value is <code>STORAGE_STANDARD</code>.</li>
1144 - * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <php:curl_setopt()>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
 1144+ * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
11451145 * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
11461146 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
11471147 * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAccessPolicy.html REST Access Control Policy
@@ -3058,7 +3058,7 @@
30593059 * <li><code>seekTo</code> - <code>integer</code> - Optional - The starting position in bytes for the first piece of the file/stream to upload.</li>
30603060 * <li><code>storage</code> - <code>string</code> - Optional - Whether to use Standard or Reduced Redundancy storage. [Allowed values: <code>AmazonS3::STORAGE_STANDARD</code>, <code>AmazonS3::STORAGE_REDUCED</code>]. The default value is <code>STORAGE_STANDARD</code>.</li>
30613061 * <li><code>uploadId</code> - <code>string</code> - Optional - An upload ID identifying an existing multipart upload to use. If this option is not set, one will be created automatically.</li>
3062 - * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <php:curl_setopt()>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
 3062+ * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
30633063 * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
30643064 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
30653065 * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAccessPolicy.html REST Access Control Policy
Index: trunk/extensions/OpenStackManager/aws-sdk/services/rds.class.php
@@ -28,7 +28,7 @@
2929 * flexible: you can scale your database instance's compute resources and storage capacity to meet your application's
3030 * demand. As with all Amazon Web Services, there are no up-front investments, and you pay only for the resources you use.
3131 *
32 - * @version Tue Mar 15 11:15:28 PDT 2011
 32+ * @version Fri Mar 25 13:18:27 PDT 2011
3333 * @license See the included NOTICE.md file for complete information.
3434 * @copyright See the included NOTICE.md file for complete information.
3535 * @link http://aws.amazon.com/rds/Amazon Relational Database Service
Index: trunk/extensions/OpenStackManager/aws-sdk/services/ses.class.php
@@ -23,7 +23,7 @@
2424 * For specific details on how to construct a service request, please consult the <a
2525 * href="http://docs.amazonwebservices.com/ses/latest/DeveloperGuide">Amazon SES Developer Guide</a>.
2626 *
27 - * @version Tue Mar 15 11:12:03 PDT 2011
 27+ * @version Fri Mar 25 13:16:07 PDT 2011
2828 * @license See the included NOTICE.md file for complete information.
2929 * @copyright See the included NOTICE.md file for complete information.
3030 * @link http://aws.amazon.com/ses/Amazon Simple Email Service
Index: trunk/extensions/OpenStackManager/aws-sdk/services/cloudwatch.class.php
@@ -31,7 +31,7 @@
3232 * automatically make changes to the resources you are monitoring, based on rules that you define. For example, you can
3333 * create alarms that initiate Auto Scaling and Simple Notification Service actions on your behalf.
3434 *
35 - * @version Tue Mar 15 11:08:01 PDT 2011
 35+ * @version Fri Mar 25 13:13:27 PDT 2011
3636 * @license See the included NOTICE.md file for complete information.
3737 * @copyright See the included NOTICE.md file for complete information.
3838 * @link http://aws.amazon.com/cloudwatch/Amazon CloudWatch
Index: trunk/extensions/OpenStackManager/aws-sdk/services/elb.class.php
@@ -20,7 +20,7 @@
2121 * of your application. It makes it easy for you to distribute application loads between two or more EC2 instances. Elastic
2222 * Load Balancing enables availability through redundancy and supports traffic growth of your application.
2323 *
24 - * @version Tue Mar 15 11:11:03 PDT 2011
 24+ * @version Fri Mar 25 13:15:34 PDT 2011
2525 * @license See the included NOTICE.md file for complete information.
2626 * @copyright See the included NOTICE.md file for complete information.
2727 * @link http://aws.amazon.com/elasticloadbalancing/Amazon Elastic Load Balancing
Index: trunk/extensions/OpenStackManager/aws-sdk/services/as.class.php
@@ -47,7 +47,7 @@
4848 *
4949 * </ul>
5050 *
51 - * @version Tue Mar 15 11:06:05 PDT 2011
 51+ * @version Fri Mar 25 13:12:03 PDT 2011
5252 * @license See the included NOTICE.md file for complete information.
5353 * @copyright See the included NOTICE.md file for complete information.
5454 * @link http://aws.amazon.com/autoscaling/Amazon Auto-Scaling
Index: trunk/extensions/OpenStackManager/aws-sdk/services/sns.class.php
@@ -17,7 +17,7 @@
1818 /**
1919
2020 *
21 - * @version Tue Mar 15 11:17:16 PDT 2011
 21+ * @version Fri Mar 25 13:19:36 PDT 2011
2222 * @license See the included NOTICE.md file for complete information.
2323 * @copyright See the included NOTICE.md file for complete information.
2424 * @link http://aws.amazon.com/sns/Amazon Simple Notification Service
Index: trunk/extensions/OpenStackManager/aws-sdk/services/iam.class.php
@@ -35,7 +35,7 @@
3636 * We will refer to Amazon AWS Identity and Access Management using the abbreviated form IAM. All copyrights and legal
3737 * protections still apply.
3838 *
39 - * @version Tue Mar 15 11:13:44 PDT 2011
 39+ * @version Fri Mar 25 13:17:16 PDT 2011
4040 * @license See the included NOTICE.md file for complete information.
4141 * @copyright See the included NOTICE.md file for complete information.
4242 * @link http://aws.amazon.com/iam/Amazon Identity and Access Management Service
Index: trunk/extensions/OpenStackManager/aws-sdk/services/sqs.class.php
@@ -30,7 +30,7 @@
3131 *
3232 * Visit <a href="http://aws.amazon.com/sqs/">http://aws.amazon.com/sqs/</a> for more information.
3333 *
34 - * @version Tue Mar 15 11:18:04 PDT 2011
 34+ * @version Fri Mar 25 13:20:11 PDT 2011
3535 * @license See the included NOTICE.md file for complete information.
3636 * @copyright See the included NOTICE.md file for complete information.
3737 * @link http://aws.amazon.com/sqs/Amazon Simple Queue Service
Index: trunk/extensions/OpenStackManager/aws-sdk/services/sdb.class.php
@@ -31,7 +31,7 @@
3232 *
3333 * Visit <a href="http://aws.amazon.com/simpledb/">http://aws.amazon.com/simpledb/</a> for more information.
3434 *
35 - * @version Tue Mar 15 11:16:25 PDT 2011
 35+ * @version Fri Mar 25 13:19:04 PDT 2011
3636 * @license See the included NOTICE.md file for complete information.
3737 * @copyright See the included NOTICE.md file for complete information.
3838 * @link http://aws.amazon.com/simpledb/Amazon SimpleDB
Index: trunk/extensions/OpenStackManager/aws-sdk/services/ec2.class.php
@@ -28,7 +28,7 @@
2929 *
3030 * Visit <a href="http://aws.amazon.com/ec2/">http://aws.amazon.com/ec2/</a> for more information.
3131 *
32 - * @version Tue Mar 15 11:09:51 PDT 2011
 32+ * @version Fri Mar 25 13:14:50 PDT 2011
3333 * @license See the included NOTICE.md file for complete information.
3434 * @copyright See the included NOTICE.md file for complete information.
3535 * @link http://aws.amazon.com/ec2/Amazon Elastic Compute Cloud
Index: trunk/extensions/OpenStackManager/aws-sdk/services/elasticbeanstalk.class.php
@@ -36,7 +36,7 @@
3737 *
3838 * </ul>
3939 *
40 - * @version Tue Mar 15 11:08:52 PDT 2011
 40+ * @version Fri Mar 25 13:14:04 PDT 2011
4141 * @license See the included NOTICE.md file for complete information.
4242 * @copyright See the included NOTICE.md file for complete information.
4343 * @link http://aws.amazon.com/elasticbeanstalk/AWS Elastic Beanstalk
Index: trunk/extensions/OpenStackManager/aws-sdk/services/importexport.class.php
@@ -22,7 +22,7 @@
2323 * high-speed internal network and bypassing the Internet. For large data sets, AWS Import/Export is often faster than
2424 * Internet transfer and more cost effective than upgrading your connectivity.
2525 *
26 - * @version Tue Mar 15 11:14:38 PDT 2011
 26+ * @version Fri Mar 25 13:17:53 PDT 2011
2727 * @license See the included NOTICE.md file for complete information.
2828 * @copyright See the included NOTICE.md file for complete information.
2929 * @link http://aws.amazon.com/importexport/Amazon Import/Export Service
Index: trunk/extensions/OpenStackManager/aws-sdk/services/emr.class.php
@@ -19,7 +19,7 @@
2020 * This is the Amazon Elastic MapReduce API Reference Guide. This guide is for programmers who need detailed information
2121 * about the Amazon Elastic MapReduce APIs.
2222 *
23 - * @version Tue Mar 15 11:12:53 PDT 2011
 23+ * @version Fri Mar 25 13:16:39 PDT 2011
2424 * @license See the included NOTICE.md file for complete information.
2525 * @copyright See the included NOTICE.md file for complete information.
2626 * @link http://aws.amazon.com/elasticmapreduce/Amazon Elastic MapReduce
Index: trunk/extensions/OpenStackManager/aws-sdk/_compatibility_test/sdk_compatibility_test.php
@@ -53,7 +53,7 @@
5454
5555 <style type="text/css">
5656 body {
57 - font:14px/1.4em "Helvetica Neue", Helvetica, "Lucida Grande", Verdana, Arial, Clean, Sans, sans-serif;
 57+ font:14px/1.4em "Helvetica Neue", Helvetica, "Lucida Grande", "Droid Sans", Ubuntu, Verdana, Arial, Clean, Sans, sans-serif;
5858 letter-spacing:0px;
5959 color:#333;
6060 margin:0;
Index: trunk/extensions/OpenStackManager/aws-sdk/_docs/NOTICE.md
@@ -129,13 +129,13 @@
130130 <http://opensource.org/licenses/bsd-license.php>
131131
132132
133 -## SimplePie Compatibility Test
 133+## SimplePie
134134
135135 <http://simplepie.org>
136136
137137 * Copyright 2004-2010 [Ryan Parman](http://ryanparman.com)
138138 * Copyright 2005-2010 [Geoffrey Sneddon](http://gsnedders.com)
139 -* Copyright 2008-2010 [Ryan McCue](http://ryanmccue.info)
 139+* Copyright 2008-2011 [Ryan McCue](http://ryanmccue.info)
140140
141141 Redistribution and use in source and binary forms, with or without
142142 modification, are permitted provided that the following conditions are met:
Index: trunk/extensions/OpenStackManager/aws-sdk/_docs/CHANGELOG.md
@@ -1,3 +1,33 @@
 2+# Changelog: 1.3.1 "Kraken"
 3+
 4+Launched Friday, March 25, 2011
 5+
 6+## New Features & Highlights (Summary)
 7+* Fixed issues with Signature v3 authentication (SES).
 8+* Added gzip decoding.
 9+* Added support for converting data to more alternate formats.
 10+* Bug fixes and enhancements:
 11+ * [Cannot send email](https://forums.aws.amazon.com/thread.jspa?threadID=62833)
 12+ * [AmazonCloudWatch get_metric_statistics returns gzipped body](https://forums.aws.amazon.com/thread.jspa?threadID=62625)
 13+
 14+## Utility Classes
 15+### CFArray
 16+* **New:** The `to_json()` and `to_yaml()` methoda have been added to the class.
 17+
 18+### CFGzipDecode
 19+* **New:** Handles a variety of primary and edge cases around gzip/deflate decoding in PHP.
 20+
 21+### CFRuntime
 22+* **New:** Gzip decoding has been added to the SDK.
 23+* **Fixed:** The previous release contained a regression in the Signature v3 support that affected AmazonSES. This has been resolved.
 24+* **Fixed:** Completed support for Signature v3 over HTTP connections.
 25+
 26+### CFSimpleXML
 27+* **New:** The `to_stdClass()` and `to_yaml()` methoda have been added to the class.
 28+
 29+
 30+----
 31+
232 # Changelog: 1.3 "Jecht"
333
434 Launched Tuesday, March 15, 2011
Index: trunk/extensions/OpenStackManager/aws-sdk/sdk.class.php
@@ -102,9 +102,9 @@
103103 // INTERMEDIARY CONSTANTS
104104
105105 define('CFRUNTIME_NAME', 'aws-sdk-php');
106 -define('CFRUNTIME_VERSION', '1.3');
 106+define('CFRUNTIME_VERSION', '1.3.1');
107107 // define('CFRUNTIME_BUILD', gmdate('YmdHis', filemtime(__FILE__))); // @todo: Hardcode for release.
108 -define('CFRUNTIME_BUILD', '20110315164556');
 108+define('CFRUNTIME_BUILD', '20110325210828');
109109 define('CFRUNTIME_USERAGENT', CFRUNTIME_NAME . '/' . CFRUNTIME_VERSION . ' PHP/' . PHP_VERSION . ' ' . php_uname('s') . '/' . php_uname('r') . ' Arch/' . php_uname('m') . ' SAPI/' . php_sapi_name() . ' Integer/' . PHP_INT_MAX . ' Build/' . CFRUNTIME_BUILD . __aws_sdk_ua_callback());
110110
111111
@@ -115,7 +115,7 @@
116116 * Core functionality and default settings shared across all SDK classes. All methods and properties in this
117117 * class are inherited by the service-specific classes.
118118 *
119 - * @version 2011.03.14
 119+ * @version 2011.03.25
120120 * @license See the included NOTICE.md file for more information.
121121 * @copyright See the included NOTICE.md file for more information.
122122 * @link http://aws.amazon.com/php/ PHP Developer Center
@@ -750,6 +750,7 @@
751751
752752 $method_arguments = func_get_args();
753753 $headers = array();
 754+ $signed_headers = array();
754755
755756 // Use the caching flow to determine if we need to do a round-trip to the server.
756757 if ($this->use_cache_flow)
@@ -788,8 +789,8 @@
789790
790791 // Determine signing values
791792 $current_time = time() + $this->adjust_offset;
792 - $date = gmdate($this->util->konst($this->util, 'DATE_FORMAT_RFC2616'), $current_time);
793 - $timestamp = gmdate($this->util->konst($this->util, 'DATE_FORMAT_ISO8601'), $current_time);
 793+ $date = gmdate(CFUtilities::DATE_FORMAT_RFC2616, $current_time);
 794+ $timestamp = gmdate(CFUtilities::DATE_FORMAT_ISO8601, $current_time);
794795 $nonce = $this->util->generate_guid();
795796
796797 // Manage the key-value pairs that are used in the query.
@@ -825,9 +826,9 @@
826827 uksort($query, 'strcmp');
827828
828829 // Normalize JSON input
829 - if ($query['body'] === '[]')
 830+ if (isset($query['body']) && $query['body'] === '[]')
830831 {
831 - $query['body'] = '';
 832+ $query['body'] = '{}';
832833 }
833834
834835 if ($this->use_aws_query)
@@ -892,7 +893,7 @@
893894 // Do we have an authentication token?
894895 if ($this->auth_token)
895896 {
896 - $headers['x-amz-security-token'] = $this->auth_token;
 897+ $headers['X-Amz-Security-Token'] = $this->auth_token;
897898 }
898899
899900 // Signing using X-Amz-Target is handled differently.
@@ -920,10 +921,11 @@
921922 // Add authentication headers
922923 if ($signature_version === 3)
923924 {
 925+ $headers['X-Amz-Nonce'] = $nonce;
924926 $headers['Date'] = $date;
925927 $headers['Content-Length'] = strlen($querystring);
926928 $headers['Content-MD5'] = $this->util->hex_to_base64(md5($querystring));
927 - $headers['x-amz-nonce'] = $nonce;
 929+ $headers['Host'] = $host_header;
928930 }
929931
930932 // Sort headers
@@ -934,10 +936,10 @@
935937 // Prepare the string to sign (HTTPS)
936938 $string_to_sign = $date . $nonce;
937939 }
938 - elseif ($signature_version === 3)
 940+ elseif ($signature_version === 3 && !$this->use_ssl)
939941 {
940942 // Prepare the string to sign (HTTP)
941 - $string_to_sign = "POST\n$host_header\n$request_uri\n$canonical_query_string";
 943+ $string_to_sign = "POST\n$request_uri\n\n";
942944 }
943945
944946 // Add headers to request and compute the string to sign
@@ -959,32 +961,47 @@
960962 if (
961963 substr(strtolower($header_key), 0, 8) === 'content-' ||
962964 strtolower($header_key) === 'date' ||
963 - strtolower($header_key) === 'expires'
 965+ strtolower($header_key) === 'expires' ||
 966+ strtolower($header_key) === 'host' ||
 967+ substr(strtolower($header_key), 0, 6) === 'x-amz-'
964968 )
965969 {
966970 $string_to_sign .= strtolower($header_key) . ':' . $header_value . "\n";
 971+ $signed_headers[] = $header_key;
967972 }
968 - elseif (substr(strtolower($header_key), 0, 6) === 'x-amz-')
969 - {
970 - $string_to_sign .= strtolower($header_key) . ':' . $header_value . "\n";
971 - }
972973 }
973974 }
974975
975976 if ($signature_version === 3)
976977 {
977 - if ($this->use_ssl)
 978+ if (!$this->use_ssl)
978979 {
 980+ $string_to_sign .= "\n";
 981+
 982+ if (isset($query['body']) && $query['body'] !== '')
 983+ {
 984+ $string_to_sign .= $query['body'];
 985+ }
 986+
 987+ // Convert from string-to-sign to bytes-to-sign
 988+ $bytes_to_sign = hash('sha256', $string_to_sign, true);
 989+
979990 // Hash the AWS secret key and generate a signature for the request.
980 - $signature = base64_encode(hash_hmac('sha256', $string_to_sign, $this->secret_key, true));
981 - $request->add_header('X-Amzn-Authorization', 'AWS3-HTTPS AWSAccessKeyId=' . $this->key . ',Algorithm=HmacSHA256,Signature=' . $signature);
 991+ $signature = base64_encode(hash_hmac('sha256', $bytes_to_sign, $this->secret_key, true));
982992 }
983993 else
984994 {
985995 // Hash the AWS secret key and generate a signature for the request.
986996 $signature = base64_encode(hash_hmac('sha256', $string_to_sign, $this->secret_key, true));
987 - $request->add_header('X-Amzn-Authorization', 'AWS3 AWSAccessKeyId=' . $this->key . ',Algorithm=HmacSHA256,Signature=' . $signature);
988997 }
 998+
 999+ $headers['X-Amzn-Authorization'] = 'AWS3' . ($this->use_ssl ? '-HTTPS' : '')
 1000+ . ' AWSAccessKeyId=' . $this->key
 1001+ . ',Algorithm=HmacSHA256'
 1002+ . ',SignedHeaders=' . implode(';', $signed_headers)
 1003+ . ',Signature=' . $signature;
 1004+
 1005+ $request->add_header('X-Amzn-Authorization', $headers['X-Amzn-Authorization']);
9891006 }
9901007
9911008 // Update RequestCore settings
@@ -994,7 +1011,7 @@
9951012 $curlopts = array();
9961013
9971014 // Set custom CURLOPT settings
998 - if (isset($opt['curlopts']))
 1015+ if (is_array($opt) && isset($opt['curlopts']))
9991016 {
10001017 $curlopts = $opt['curlopts'];
10011018 unset($opt['curlopts']);
@@ -1028,13 +1045,15 @@
10291046 // Send!
10301047 $request->send_request();
10311048
 1049+ $request_headers = $headers;
 1050+
10321051 // Prepare the response.
10331052 $headers = $request->get_response_header();
10341053 $headers['x-aws-stringtosign'] = $string_to_sign;
 1054+ $headers['x-aws-request-headers'] = $request_headers;
10351055 $headers['x-aws-body'] = $querystring;
10361056
1037 - $mime = isset($headers['content-type']) ? $headers['content-type'] : null;
1038 - $data = new $this->response_class($headers, $this->parse_callback($request->get_response_body(), $mime), $request->get_response_code());
 1057+ $data = new $this->response_class($headers, $this->parse_callback($request->get_response_body(), $headers), $request->get_response_code());
10391058
10401059 // Was it Amazon's fault the request failed? Retry the request until we reach $max_retries.
10411060 if ((integer) $request->get_response_code() === 500 || (integer) $request->get_response_code() === 503)
@@ -1153,7 +1172,7 @@
11541173 * @param string $content_type (Optional) The content-type to use when determining how to parse the content.
11551174 * @return CFResponse|string A parsed <CFResponse> object, or parsed XML.
11561175 */
1157 - public function parse_callback($response, $content_type = null)
 1176+ public function parse_callback($response, $headers = null)
11581177 {
11591178 // Shorten this so we have a (mostly) single code path
11601179 if (isset($response->body))
@@ -1161,11 +1180,6 @@
11621181 if (is_string($response->body))
11631182 {
11641183 $body = $response->body;
1165 -
1166 - if (!$content_type)
1167 - {
1168 - $content_type = $response->header['content-type'];
1169 - }
11701184 }
11711185 else
11721186 {
@@ -1181,10 +1195,36 @@
11821196 return $response;
11831197 }
11841198
 1199+ // Decompress gzipped content
 1200+ if (isset($headers['content-encoding']))
 1201+ {
 1202+ switch (strtolower(trim($headers['content-encoding'], "\x09\x0A\x0D\x20")))
 1203+ {
 1204+ case 'gzip':
 1205+ case 'x-gzip':
 1206+ $decoder = new CFGzipDecode($body);
 1207+ if ($decoder->parse())
 1208+ {
 1209+ $body = $decoder->data;
 1210+ }
 1211+ break;
 1212+
 1213+ case 'deflate':
 1214+ if (($body = gzuncompress($body)) === false)
 1215+ {
 1216+ if (($body = gzinflate($body)) === false)
 1217+ {
 1218+ continue;
 1219+ }
 1220+ }
 1221+ break;
 1222+ }
 1223+ }
 1224+
11851225 // Look for XML cues
11861226 if (
1187 - ($content_type && ($content_type === 'text/xml' || $content_type === 'application/xml')) || // We know it's XML
1188 - (!$content_type && (stripos($body, '<?xml') === 0 || strpos($body, '<Error>') === 0) || preg_match('/^<(\w*) xmlns="http(s?):\/\/(\w*).amazon(aws)?.com/im', $body)) // Sniff for XML
 1227+ (isset($headers['content-type']) && ($headers['content-type'] === 'text/xml' || $headers['content-type'] === 'application/xml')) || // We know it's XML
 1228+ (!isset($headers['content-type']) && (stripos($body, '<?xml') === 0 || strpos($body, '<Error>') === 0) || preg_match('/^<(\w*) xmlns="http(s?):\/\/(\w*).amazon(aws)?.com/im', $body)) // Sniff for XML
11891229 )
11901230 {
11911231 // Strip the default XML namespace to simplify XPath expressions
@@ -1195,8 +1235,8 @@
11961236 }
11971237 // Look for JSON cues
11981238 elseif (
1199 - ($content_type && $content_type === 'application/json') || // We know it's JSON
1200 - (!$content_type && $this->util->is_json($body)) // Sniff for JSON
 1239+ (isset($headers['content-type']) && $headers['content-type'] === 'application/json') || // We know it's JSON
 1240+ (!isset($headers['content-type']) && $this->util->is_json($body)) // Sniff for JSON
12011241 )
12021242 {
12031243 // Normalize JSON to a CFSimpleXML object
Index: trunk/extensions/OpenStackManager/aws-sdk/utilities/json.class.php
@@ -21,7 +21,7 @@
2222 /**
2323 * Handles the conversion of data from JSON to other formats.
2424 *
25 - * @version 2011.03.02
 25+ * @version 2011.03.25
2626 * @license See the included NOTICE.md file for more information.
2727 * @copyright See the included NOTICE.md file for more information.
2828 * @link http://aws.amazon.com/php/ PHP Developer Center
Index: trunk/extensions/OpenStackManager/aws-sdk/utilities/simplexml.class.php
@@ -22,7 +22,7 @@
2323 * Wraps the underlying `SimpleXMLIterator` class with enhancements for rapidly traversing the DOM tree,
2424 * converting types, and comparisons.
2525 *
26 - * @version 2010.11.08
 26+ * @version 2011.03.25
2727 * @license See the included NOTICE.md file for more information.
2828 * @copyright See the included NOTICE.md file for more information.
2929 * @link http://aws.amazon.com/php/ PHP Developer Center
@@ -77,6 +77,10 @@
7878 return $results;
7979 }
8080
 81+
 82+ /*%******************************************************************************************%*/
 83+ // TRAVERSAL
 84+
8185 /**
8286 * Wraps the results of an XPath query in a <CFArray> object.
8387 *
@@ -108,6 +112,10 @@
109113 return $parents[0];
110114 }
111115
 116+
 117+ /*%******************************************************************************************%*/
 118+ // ALTERNATE FORMATS
 119+
112120 /**
113121 * Gets the current XML node as a true string.
114122 *
@@ -129,6 +137,16 @@
130138 }
131139
132140 /**
 141+ * Gets the current XML node as a stdClass object.
 142+ *
 143+ * @return array The current XML node as a stdClass object.
 144+ */
 145+ public function to_stdClass()
 146+ {
 147+ return json_decode(json_encode($this));
 148+ }
 149+
 150+ /**
133151 * Gets the current XML node as a JSON string.
134152 *
135153 * @return string The current XML node as a JSON string.
@@ -139,6 +157,20 @@
140158 }
141159
142160 /**
 161+ * Gets the current XML node as a YAML string.
 162+ *
 163+ * @return string The current XML node as a YAML string.
 164+ */
 165+ public function to_yaml()
 166+ {
 167+ return sfYaml::dump(json_decode(json_encode($this), true), 5);
 168+ }
 169+
 170+
 171+ /*%******************************************************************************************%*/
 172+ // COMPARISONS
 173+
 174+ /**
143175 * Whether or not the current node exactly matches the compared value.
144176 *
145177 * @param string $value (Required) The value to compare the current node to.
Index: trunk/extensions/OpenStackManager/aws-sdk/utilities/utilities.class.php
@@ -112,7 +112,10 @@
113113
114114 foreach ($array as $key => $value)
115115 {
116 - $temp[] = rawurlencode($key) . '=' . rawurlencode($value);
 116+ if (is_string($key) && !is_array($value))
 117+ {
 118+ $temp[] = rawurlencode($key) . '=' . rawurlencode($value);
 119+ }
117120 }
118121
119122 return implode('&', $temp);
Index: trunk/extensions/OpenStackManager/aws-sdk/utilities/gzipdecode.class.php
@@ -0,0 +1,377 @@
 2+<?php
 3+/*
 4+ * Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 5+ *
 6+ * Licensed under the Apache License, Version 2.0 (the "License").
 7+ * You may not use this file except in compliance with the License.
 8+ * A copy of the License is located at
 9+ *
 10+ * http://aws.amazon.com/apache2.0
 11+ *
 12+ * or in the "license" file accompanying this file. This file is distributed
 13+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 14+ * express or implied. See the License for the specific language governing
 15+ * permissions and limitations under the License.
 16+ */
 17+
 18+/**
 19+ * SimplePie
 20+ *
 21+ * A PHP-Based RSS and Atom Feed Framework.
 22+ * Takes the hard work out of managing a complete RSS/Atom solution.
 23+ *
 24+ * Copyright (c) 2004-2010, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
 25+ * All rights reserved.
 26+ *
 27+ * Redistribution and use in source and binary forms, with or without modification, are
 28+ * permitted provided that the following conditions are met:
 29+ *
 30+ * * Redistributions of source code must retain the above copyright notice, this list of
 31+ * conditions and the following disclaimer.
 32+ *
 33+ * * Redistributions in binary form must reproduce the above copyright notice, this list
 34+ * of conditions and the following disclaimer in the documentation and/or other materials
 35+ * provided with the distribution.
 36+ *
 37+ * * Neither the name of the SimplePie Team nor the names of its contributors may be used
 38+ * to endorse or promote products derived from this software without specific prior
 39+ * written permission.
 40+ *
 41+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
 42+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 43+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
 44+ * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 45+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 46+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 47+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 48+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 49+ * POSSIBILITY OF SUCH DAMAGE.
 50+ *
 51+ * @package SimplePie
 52+ * @version 1.3-dev
 53+ * @copyright 2004-2010 Ryan Parman, Geoffrey Sneddon, Ryan McCue
 54+ * @author Ryan Parman
 55+ * @author Geoffrey Sneddon
 56+ * @author Ryan McCue
 57+ * @link http://simplepie.org/ SimplePie
 58+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
 59+ * @todo phpDoc comments
 60+ */
 61+
 62+
 63+/*%******************************************************************************************%*/
 64+// CLASS
 65+
 66+/**
 67+ * Handles a variety of primary and edge cases around gzip/deflate decoding in PHP.
 68+ *
 69+ * @version 2011.02.21
 70+ * @license See the included NOTICE.md file for more information.
 71+ * @copyright See the included NOTICE.md file for more information.
 72+ * @link http://aws.amazon.com/php/ PHP Developer Center
 73+ * @link https://github.com/simplepie/simplepie/blob/master/SimplePie/gzdecode.php SimplePie_gzdecode
 74+ */
 75+class CFGzipDecode
 76+{
 77+ /**
 78+ * Compressed data
 79+ *
 80+ * @access private
 81+ * @see gzdecode::$data
 82+ */
 83+ public $compressed_data;
 84+
 85+ /**
 86+ * Size of compressed data
 87+ *
 88+ * @access private
 89+ */
 90+ public $compressed_size;
 91+
 92+ /**
 93+ * Minimum size of a valid gzip string
 94+ *
 95+ * @access private
 96+ */
 97+ public $min_compressed_size = 18;
 98+
 99+ /**
 100+ * Current position of pointer
 101+ *
 102+ * @access private
 103+ */
 104+ public $position = 0;
 105+
 106+ /**
 107+ * Flags (FLG)
 108+ *
 109+ * @access private
 110+ */
 111+ public $flags;
 112+
 113+ /**
 114+ * Uncompressed data
 115+ *
 116+ * @access public
 117+ * @see gzdecode::$compressed_data
 118+ */
 119+ public $data;
 120+
 121+ /**
 122+ * Modified time
 123+ *
 124+ * @access public
 125+ */
 126+ public $MTIME;
 127+
 128+ /**
 129+ * Extra Flags
 130+ *
 131+ * @access public
 132+ */
 133+ public $XFL;
 134+
 135+ /**
 136+ * Operating System
 137+ *
 138+ * @access public
 139+ */
 140+ public $OS;
 141+
 142+ /**
 143+ * Subfield ID 1
 144+ *
 145+ * @access public
 146+ * @see gzdecode::$extra_field
 147+ * @see gzdecode::$SI2
 148+ */
 149+ public $SI1;
 150+
 151+ /**
 152+ * Subfield ID 2
 153+ *
 154+ * @access public
 155+ * @see gzdecode::$extra_field
 156+ * @see gzdecode::$SI1
 157+ */
 158+ public $SI2;
 159+
 160+ /**
 161+ * Extra field content
 162+ *
 163+ * @access public
 164+ * @see gzdecode::$SI1
 165+ * @see gzdecode::$SI2
 166+ */
 167+ public $extra_field;
 168+
 169+ /**
 170+ * Original filename
 171+ *
 172+ * @access public
 173+ */
 174+ public $filename;
 175+
 176+ /**
 177+ * Human readable comment
 178+ *
 179+ * @access public
 180+ */
 181+ public $comment;
 182+
 183+ /**
 184+ * Don't allow anything to be set
 185+ *
 186+ * @access public
 187+ */
 188+ public function __set($name, $value)
 189+ {
 190+ trigger_error("Cannot write property $name", E_USER_ERROR);
 191+ }
 192+
 193+ /**
 194+ * Set the compressed string and related properties
 195+ *
 196+ * @access public
 197+ */
 198+ public function __construct($data)
 199+ {
 200+ $this->compressed_data = $data;
 201+ $this->compressed_size = strlen($data);
 202+ }
 203+
 204+ /**
 205+ * Decode the GZIP stream
 206+ *
 207+ * @access public
 208+ */
 209+ public function parse()
 210+ {
 211+ if ($this->compressed_size >= $this->min_compressed_size)
 212+ {
 213+ // Check ID1, ID2, and CM
 214+ if (substr($this->compressed_data, 0, 3) !== "\x1F\x8B\x08")
 215+ {
 216+ return false;
 217+ }
 218+
 219+ // Get the FLG (FLaGs)
 220+ $this->flags = ord($this->compressed_data[3]);
 221+
 222+ // FLG bits above (1 << 4) are reserved
 223+ if ($this->flags > 0x1F)
 224+ {
 225+ return false;
 226+ }
 227+
 228+ // Advance the pointer after the above
 229+ $this->position += 4;
 230+
 231+ // MTIME
 232+ $mtime = substr($this->compressed_data, $this->position, 4);
 233+ // Reverse the string if we're on a big-endian arch because l is the only signed long and is machine endianness
 234+ if (current(unpack('S', "\x00\x01")) === 1)
 235+ {
 236+ $mtime = strrev($mtime);
 237+ }
 238+ $this->MTIME = current(unpack('l', $mtime));
 239+ $this->position += 4;
 240+
 241+ // Get the XFL (eXtra FLags)
 242+ $this->XFL = ord($this->compressed_data[$this->position++]);
 243+
 244+ // Get the OS (Operating System)
 245+ $this->OS = ord($this->compressed_data[$this->position++]);
 246+
 247+ // Parse the FEXTRA
 248+ if ($this->flags & 4)
 249+ {
 250+ // Read subfield IDs
 251+ $this->SI1 = $this->compressed_data[$this->position++];
 252+ $this->SI2 = $this->compressed_data[$this->position++];
 253+
 254+ // SI2 set to zero is reserved for future use
 255+ if ($this->SI2 === "\x00")
 256+ {
 257+ return false;
 258+ }
 259+
 260+ // Get the length of the extra field
 261+ $len = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
 262+ $position += 2;
 263+
 264+ // Check the length of the string is still valid
 265+ $this->min_compressed_size += $len + 4;
 266+ if ($this->compressed_size >= $this->min_compressed_size)
 267+ {
 268+ // Set the extra field to the given data
 269+ $this->extra_field = substr($this->compressed_data, $this->position, $len);
 270+ $this->position += $len;
 271+ }
 272+ else
 273+ {
 274+ return false;
 275+ }
 276+ }
 277+
 278+ // Parse the FNAME
 279+ if ($this->flags & 8)
 280+ {
 281+ // Get the length of the filename
 282+ $len = strcspn($this->compressed_data, "\x00", $this->position);
 283+
 284+ // Check the length of the string is still valid
 285+ $this->min_compressed_size += $len + 1;
 286+ if ($this->compressed_size >= $this->min_compressed_size)
 287+ {
 288+ // Set the original filename to the given string
 289+ $this->filename = substr($this->compressed_data, $this->position, $len);
 290+ $this->position += $len + 1;
 291+ }
 292+ else
 293+ {
 294+ return false;
 295+ }
 296+ }
 297+
 298+ // Parse the FCOMMENT
 299+ if ($this->flags & 16)
 300+ {
 301+ // Get the length of the comment
 302+ $len = strcspn($this->compressed_data, "\x00", $this->position);
 303+
 304+ // Check the length of the string is still valid
 305+ $this->min_compressed_size += $len + 1;
 306+ if ($this->compressed_size >= $this->min_compressed_size)
 307+ {
 308+ // Set the original comment to the given string
 309+ $this->comment = substr($this->compressed_data, $this->position, $len);
 310+ $this->position += $len + 1;
 311+ }
 312+ else
 313+ {
 314+ return false;
 315+ }
 316+ }
 317+
 318+ // Parse the FHCRC
 319+ if ($this->flags & 2)
 320+ {
 321+ // Check the length of the string is still valid
 322+ $this->min_compressed_size += $len + 2;
 323+ if ($this->compressed_size >= $this->min_compressed_size)
 324+ {
 325+ // Read the CRC
 326+ $crc = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
 327+
 328+ // Check the CRC matches
 329+ if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc)
 330+ {
 331+ $this->position += 2;
 332+ }
 333+ else
 334+ {
 335+ return false;
 336+ }
 337+ }
 338+ else
 339+ {
 340+ return false;
 341+ }
 342+ }
 343+
 344+ // Decompress the actual data
 345+ if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false)
 346+ {
 347+ return false;
 348+ }
 349+ else
 350+ {
 351+ $this->position = $this->compressed_size - 8;
 352+ }
 353+
 354+ // Check CRC of data
 355+ $crc = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
 356+ $this->position += 4;
 357+ /*if (extension_loaded('hash') && sprintf('%u', current(unpack('V', hash('crc32b', $this->data)))) !== sprintf('%u', $crc))
 358+ {
 359+ return false;
 360+ }*/
 361+
 362+ // Check ISIZE of data
 363+ $isize = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
 364+ $this->position += 4;
 365+ if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize))
 366+ {
 367+ return false;
 368+ }
 369+
 370+ // Wow, against all odds, we've actually got a valid gzip string
 371+ return true;
 372+ }
 373+ else
 374+ {
 375+ return false;
 376+ }
 377+ }
 378+}
Property changes on: trunk/extensions/OpenStackManager/aws-sdk/utilities/gzipdecode.class.php
___________________________________________________________________
Added: svn:eol-style
1379 + native
Index: trunk/extensions/OpenStackManager/aws-sdk/utilities/array.class.php
@@ -54,6 +54,10 @@
5555 return 'Array';
5656 }
5757
 58+
 59+ /*%******************************************************************************************%*/
 60+ // REFORMATTING
 61+
5862 /**
5963 * Maps each element in the <CFArray> object as an integer.
6064 *
@@ -88,6 +92,10 @@
8993 return $list;
9094 }
9195
 96+
 97+ /*%******************************************************************************************%*/
 98+ // CONFIRMATION
 99+
92100 /**
93101 * Verifies that _all_ responses were successful. A single failed request will cause <areOK()> to return false. Equivalent to <CFResponse::isOK()>, except it applies to all responses.
94102 *
@@ -109,6 +117,10 @@
110118 return (array_search(false, $dlist, true) !== false) ? false : true;
111119 }
112120
 121+
 122+ /*%******************************************************************************************%*/
 123+ // ITERATING AND EXECUTING
 124+
113125 /**
114126 * Iterates over a <CFArray> object, and executes a function for each matched element.
115127 *
@@ -186,6 +198,10 @@
187199 return $this->filter($callback, $bind);
188200 }
189201
 202+
 203+ /*%******************************************************************************************%*/
 204+ // TRAVERSAL
 205+
190206 /**
191207 * Gets the first result in the array.
192208 *
@@ -227,4 +243,28 @@
228244 {
229245 return new CFArray(array_values($this->getArrayCopy()));
230246 }
 247+
 248+
 249+ /*%******************************************************************************************%*/
 250+ // ALTERNATE FORMATS
 251+
 252+ /**
 253+ * Gets the current XML node as a JSON string.
 254+ *
 255+ * @return string The current XML node as a JSON string.
 256+ */
 257+ public function to_json()
 258+ {
 259+ return json_encode($this->getArrayCopy());
 260+ }
 261+
 262+ /**
 263+ * Gets the current XML node as a YAML string.
 264+ *
 265+ * @return string The current XML node as a YAML string.
 266+ */
 267+ public function to_yaml()
 268+ {
 269+ return sfYaml::dump($this->getArrayCopy(), 5);
 270+ }
231271 }

Status & tagging log