Index: trunk/extensions/OpenStackManager/aws-sdk/services/cloudformation.class.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | * Amazon CloudFormation makes use of other AWS products. If you need additional technical information about a specific AWS |
35 | 35 | * product, you can find the product's technical documentation at http://aws.amazon.com/documentation/. |
36 | 36 | * |
37 | | - * @version Tue Mar 15 11:07:12 PDT 2011 |
| 37 | + * @version Fri Mar 25 13:12:48 PDT 2011 |
38 | 38 | * @license See the included NOTICE.md file for complete information. |
39 | 39 | * @copyright See the included NOTICE.md file for complete information. |
40 | 40 | * @link http://aws.amazon.com/cloudformation/Amazon CloudFormation |
Index: trunk/extensions/OpenStackManager/aws-sdk/services/s3.class.php |
— | — | @@ -1140,7 +1140,7 @@ |
1141 | 1141 | * <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> |
1142 | 1142 | * <li><code>seekTo</code> - <code>integer</code> - Optional - The starting position in bytes within the file/stream to upload from.</li> |
1143 | 1143 | * <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> |
1145 | 1145 | * <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> |
1146 | 1146 | * @return CFResponse A <CFResponse> object containing a parsed HTTP response. |
1147 | 1147 | * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAccessPolicy.html REST Access Control Policy |
— | — | @@ -3058,7 +3058,7 @@ |
3059 | 3059 | * <li><code>seekTo</code> - <code>integer</code> - Optional - The starting position in bytes for the first piece of the file/stream to upload.</li> |
3060 | 3060 | * <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> |
3061 | 3061 | * <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> |
3063 | 3063 | * <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> |
3064 | 3064 | * @return CFResponse A <CFResponse> object containing a parsed HTTP response. |
3065 | 3065 | * @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 @@ |
29 | 29 | * flexible: you can scale your database instance's compute resources and storage capacity to meet your application's |
30 | 30 | * demand. As with all Amazon Web Services, there are no up-front investments, and you pay only for the resources you use. |
31 | 31 | * |
32 | | - * @version Tue Mar 15 11:15:28 PDT 2011 |
| 32 | + * @version Fri Mar 25 13:18:27 PDT 2011 |
33 | 33 | * @license See the included NOTICE.md file for complete information. |
34 | 34 | * @copyright See the included NOTICE.md file for complete information. |
35 | 35 | * @link http://aws.amazon.com/rds/Amazon Relational Database Service |
Index: trunk/extensions/OpenStackManager/aws-sdk/services/ses.class.php |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | * For specific details on how to construct a service request, please consult the <a |
25 | 25 | * href="http://docs.amazonwebservices.com/ses/latest/DeveloperGuide">Amazon SES Developer Guide</a>. |
26 | 26 | * |
27 | | - * @version Tue Mar 15 11:12:03 PDT 2011 |
| 27 | + * @version Fri Mar 25 13:16:07 PDT 2011 |
28 | 28 | * @license See the included NOTICE.md file for complete information. |
29 | 29 | * @copyright See the included NOTICE.md file for complete information. |
30 | 30 | * @link http://aws.amazon.com/ses/Amazon Simple Email Service |
Index: trunk/extensions/OpenStackManager/aws-sdk/services/cloudwatch.class.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | * automatically make changes to the resources you are monitoring, based on rules that you define. For example, you can |
33 | 33 | * create alarms that initiate Auto Scaling and Simple Notification Service actions on your behalf. |
34 | 34 | * |
35 | | - * @version Tue Mar 15 11:08:01 PDT 2011 |
| 35 | + * @version Fri Mar 25 13:13:27 PDT 2011 |
36 | 36 | * @license See the included NOTICE.md file for complete information. |
37 | 37 | * @copyright See the included NOTICE.md file for complete information. |
38 | 38 | * @link http://aws.amazon.com/cloudwatch/Amazon CloudWatch |
Index: trunk/extensions/OpenStackManager/aws-sdk/services/elb.class.php |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | * of your application. It makes it easy for you to distribute application loads between two or more EC2 instances. Elastic |
22 | 22 | * Load Balancing enables availability through redundancy and supports traffic growth of your application. |
23 | 23 | * |
24 | | - * @version Tue Mar 15 11:11:03 PDT 2011 |
| 24 | + * @version Fri Mar 25 13:15:34 PDT 2011 |
25 | 25 | * @license See the included NOTICE.md file for complete information. |
26 | 26 | * @copyright See the included NOTICE.md file for complete information. |
27 | 27 | * @link http://aws.amazon.com/elasticloadbalancing/Amazon Elastic Load Balancing |
Index: trunk/extensions/OpenStackManager/aws-sdk/services/as.class.php |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | * |
49 | 49 | * </ul> |
50 | 50 | * |
51 | | - * @version Tue Mar 15 11:06:05 PDT 2011 |
| 51 | + * @version Fri Mar 25 13:12:03 PDT 2011 |
52 | 52 | * @license See the included NOTICE.md file for complete information. |
53 | 53 | * @copyright See the included NOTICE.md file for complete information. |
54 | 54 | * @link http://aws.amazon.com/autoscaling/Amazon Auto-Scaling |
Index: trunk/extensions/OpenStackManager/aws-sdk/services/sns.class.php |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | /** |
19 | 19 | |
20 | 20 | * |
21 | | - * @version Tue Mar 15 11:17:16 PDT 2011 |
| 21 | + * @version Fri Mar 25 13:19:36 PDT 2011 |
22 | 22 | * @license See the included NOTICE.md file for complete information. |
23 | 23 | * @copyright See the included NOTICE.md file for complete information. |
24 | 24 | * @link http://aws.amazon.com/sns/Amazon Simple Notification Service |
Index: trunk/extensions/OpenStackManager/aws-sdk/services/iam.class.php |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | * We will refer to Amazon AWS Identity and Access Management using the abbreviated form IAM. All copyrights and legal |
37 | 37 | * protections still apply. |
38 | 38 | * |
39 | | - * @version Tue Mar 15 11:13:44 PDT 2011 |
| 39 | + * @version Fri Mar 25 13:17:16 PDT 2011 |
40 | 40 | * @license See the included NOTICE.md file for complete information. |
41 | 41 | * @copyright See the included NOTICE.md file for complete information. |
42 | 42 | * @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 @@ |
31 | 31 | * |
32 | 32 | * Visit <a href="http://aws.amazon.com/sqs/">http://aws.amazon.com/sqs/</a> for more information. |
33 | 33 | * |
34 | | - * @version Tue Mar 15 11:18:04 PDT 2011 |
| 34 | + * @version Fri Mar 25 13:20:11 PDT 2011 |
35 | 35 | * @license See the included NOTICE.md file for complete information. |
36 | 36 | * @copyright See the included NOTICE.md file for complete information. |
37 | 37 | * @link http://aws.amazon.com/sqs/Amazon Simple Queue Service |
Index: trunk/extensions/OpenStackManager/aws-sdk/services/sdb.class.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | * |
33 | 33 | * Visit <a href="http://aws.amazon.com/simpledb/">http://aws.amazon.com/simpledb/</a> for more information. |
34 | 34 | * |
35 | | - * @version Tue Mar 15 11:16:25 PDT 2011 |
| 35 | + * @version Fri Mar 25 13:19:04 PDT 2011 |
36 | 36 | * @license See the included NOTICE.md file for complete information. |
37 | 37 | * @copyright See the included NOTICE.md file for complete information. |
38 | 38 | * @link http://aws.amazon.com/simpledb/Amazon SimpleDB |
Index: trunk/extensions/OpenStackManager/aws-sdk/services/ec2.class.php |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | * |
30 | 30 | * Visit <a href="http://aws.amazon.com/ec2/">http://aws.amazon.com/ec2/</a> for more information. |
31 | 31 | * |
32 | | - * @version Tue Mar 15 11:09:51 PDT 2011 |
| 32 | + * @version Fri Mar 25 13:14:50 PDT 2011 |
33 | 33 | * @license See the included NOTICE.md file for complete information. |
34 | 34 | * @copyright See the included NOTICE.md file for complete information. |
35 | 35 | * @link http://aws.amazon.com/ec2/Amazon Elastic Compute Cloud |
Index: trunk/extensions/OpenStackManager/aws-sdk/services/elasticbeanstalk.class.php |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | * |
38 | 38 | * </ul> |
39 | 39 | * |
40 | | - * @version Tue Mar 15 11:08:52 PDT 2011 |
| 40 | + * @version Fri Mar 25 13:14:04 PDT 2011 |
41 | 41 | * @license See the included NOTICE.md file for complete information. |
42 | 42 | * @copyright See the included NOTICE.md file for complete information. |
43 | 43 | * @link http://aws.amazon.com/elasticbeanstalk/AWS Elastic Beanstalk |
Index: trunk/extensions/OpenStackManager/aws-sdk/services/importexport.class.php |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | * high-speed internal network and bypassing the Internet. For large data sets, AWS Import/Export is often faster than |
24 | 24 | * Internet transfer and more cost effective than upgrading your connectivity. |
25 | 25 | * |
26 | | - * @version Tue Mar 15 11:14:38 PDT 2011 |
| 26 | + * @version Fri Mar 25 13:17:53 PDT 2011 |
27 | 27 | * @license See the included NOTICE.md file for complete information. |
28 | 28 | * @copyright See the included NOTICE.md file for complete information. |
29 | 29 | * @link http://aws.amazon.com/importexport/Amazon Import/Export Service |
Index: trunk/extensions/OpenStackManager/aws-sdk/services/emr.class.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | * This is the Amazon Elastic MapReduce API Reference Guide. This guide is for programmers who need detailed information |
21 | 21 | * about the Amazon Elastic MapReduce APIs. |
22 | 22 | * |
23 | | - * @version Tue Mar 15 11:12:53 PDT 2011 |
| 23 | + * @version Fri Mar 25 13:16:39 PDT 2011 |
24 | 24 | * @license See the included NOTICE.md file for complete information. |
25 | 25 | * @copyright See the included NOTICE.md file for complete information. |
26 | 26 | * @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 @@ |
54 | 54 | |
55 | 55 | <style type="text/css"> |
56 | 56 | 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; |
58 | 58 | letter-spacing:0px; |
59 | 59 | color:#333; |
60 | 60 | margin:0; |
Index: trunk/extensions/OpenStackManager/aws-sdk/_docs/NOTICE.md |
— | — | @@ -129,13 +129,13 @@ |
130 | 130 | <http://opensource.org/licenses/bsd-license.php> |
131 | 131 | |
132 | 132 | |
133 | | -## SimplePie Compatibility Test |
| 133 | +## SimplePie |
134 | 134 | |
135 | 135 | <http://simplepie.org> |
136 | 136 | |
137 | 137 | * Copyright 2004-2010 [Ryan Parman](http://ryanparman.com) |
138 | 138 | * 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) |
140 | 140 | |
141 | 141 | Redistribution and use in source and binary forms, with or without |
142 | 142 | 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 | + |
2 | 32 | # Changelog: 1.3 "Jecht" |
3 | 33 | |
4 | 34 | Launched Tuesday, March 15, 2011 |
Index: trunk/extensions/OpenStackManager/aws-sdk/sdk.class.php |
— | — | @@ -102,9 +102,9 @@ |
103 | 103 | // INTERMEDIARY CONSTANTS |
104 | 104 | |
105 | 105 | define('CFRUNTIME_NAME', 'aws-sdk-php'); |
106 | | -define('CFRUNTIME_VERSION', '1.3'); |
| 106 | +define('CFRUNTIME_VERSION', '1.3.1'); |
107 | 107 | // define('CFRUNTIME_BUILD', gmdate('YmdHis', filemtime(__FILE__))); // @todo: Hardcode for release. |
108 | | -define('CFRUNTIME_BUILD', '20110315164556'); |
| 108 | +define('CFRUNTIME_BUILD', '20110325210828'); |
109 | 109 | 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()); |
110 | 110 | |
111 | 111 | |
— | — | @@ -115,7 +115,7 @@ |
116 | 116 | * Core functionality and default settings shared across all SDK classes. All methods and properties in this |
117 | 117 | * class are inherited by the service-specific classes. |
118 | 118 | * |
119 | | - * @version 2011.03.14 |
| 119 | + * @version 2011.03.25 |
120 | 120 | * @license See the included NOTICE.md file for more information. |
121 | 121 | * @copyright See the included NOTICE.md file for more information. |
122 | 122 | * @link http://aws.amazon.com/php/ PHP Developer Center |
— | — | @@ -750,6 +750,7 @@ |
751 | 751 | |
752 | 752 | $method_arguments = func_get_args(); |
753 | 753 | $headers = array(); |
| 754 | + $signed_headers = array(); |
754 | 755 | |
755 | 756 | // Use the caching flow to determine if we need to do a round-trip to the server. |
756 | 757 | if ($this->use_cache_flow) |
— | — | @@ -788,8 +789,8 @@ |
789 | 790 | |
790 | 791 | // Determine signing values |
791 | 792 | $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); |
794 | 795 | $nonce = $this->util->generate_guid(); |
795 | 796 | |
796 | 797 | // Manage the key-value pairs that are used in the query. |
— | — | @@ -825,9 +826,9 @@ |
826 | 827 | uksort($query, 'strcmp'); |
827 | 828 | |
828 | 829 | // Normalize JSON input |
829 | | - if ($query['body'] === '[]') |
| 830 | + if (isset($query['body']) && $query['body'] === '[]') |
830 | 831 | { |
831 | | - $query['body'] = ''; |
| 832 | + $query['body'] = '{}'; |
832 | 833 | } |
833 | 834 | |
834 | 835 | if ($this->use_aws_query) |
— | — | @@ -892,7 +893,7 @@ |
893 | 894 | // Do we have an authentication token? |
894 | 895 | if ($this->auth_token) |
895 | 896 | { |
896 | | - $headers['x-amz-security-token'] = $this->auth_token; |
| 897 | + $headers['X-Amz-Security-Token'] = $this->auth_token; |
897 | 898 | } |
898 | 899 | |
899 | 900 | // Signing using X-Amz-Target is handled differently. |
— | — | @@ -920,10 +921,11 @@ |
921 | 922 | // Add authentication headers |
922 | 923 | if ($signature_version === 3) |
923 | 924 | { |
| 925 | + $headers['X-Amz-Nonce'] = $nonce; |
924 | 926 | $headers['Date'] = $date; |
925 | 927 | $headers['Content-Length'] = strlen($querystring); |
926 | 928 | $headers['Content-MD5'] = $this->util->hex_to_base64(md5($querystring)); |
927 | | - $headers['x-amz-nonce'] = $nonce; |
| 929 | + $headers['Host'] = $host_header; |
928 | 930 | } |
929 | 931 | |
930 | 932 | // Sort headers |
— | — | @@ -934,10 +936,10 @@ |
935 | 937 | // Prepare the string to sign (HTTPS) |
936 | 938 | $string_to_sign = $date . $nonce; |
937 | 939 | } |
938 | | - elseif ($signature_version === 3) |
| 940 | + elseif ($signature_version === 3 && !$this->use_ssl) |
939 | 941 | { |
940 | 942 | // 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"; |
942 | 944 | } |
943 | 945 | |
944 | 946 | // Add headers to request and compute the string to sign |
— | — | @@ -959,32 +961,47 @@ |
960 | 962 | if ( |
961 | 963 | substr(strtolower($header_key), 0, 8) === 'content-' || |
962 | 964 | 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-' |
964 | 968 | ) |
965 | 969 | { |
966 | 970 | $string_to_sign .= strtolower($header_key) . ':' . $header_value . "\n"; |
| 971 | + $signed_headers[] = $header_key; |
967 | 972 | } |
968 | | - elseif (substr(strtolower($header_key), 0, 6) === 'x-amz-') |
969 | | - { |
970 | | - $string_to_sign .= strtolower($header_key) . ':' . $header_value . "\n"; |
971 | | - } |
972 | 973 | } |
973 | 974 | } |
974 | 975 | |
975 | 976 | if ($signature_version === 3) |
976 | 977 | { |
977 | | - if ($this->use_ssl) |
| 978 | + if (!$this->use_ssl) |
978 | 979 | { |
| 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 | + |
979 | 990 | // 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)); |
982 | 992 | } |
983 | 993 | else |
984 | 994 | { |
985 | 995 | // Hash the AWS secret key and generate a signature for the request. |
986 | 996 | $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); |
988 | 997 | } |
| 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']); |
989 | 1006 | } |
990 | 1007 | |
991 | 1008 | // Update RequestCore settings |
— | — | @@ -994,7 +1011,7 @@ |
995 | 1012 | $curlopts = array(); |
996 | 1013 | |
997 | 1014 | // Set custom CURLOPT settings |
998 | | - if (isset($opt['curlopts'])) |
| 1015 | + if (is_array($opt) && isset($opt['curlopts'])) |
999 | 1016 | { |
1000 | 1017 | $curlopts = $opt['curlopts']; |
1001 | 1018 | unset($opt['curlopts']); |
— | — | @@ -1028,13 +1045,15 @@ |
1029 | 1046 | // Send! |
1030 | 1047 | $request->send_request(); |
1031 | 1048 | |
| 1049 | + $request_headers = $headers; |
| 1050 | + |
1032 | 1051 | // Prepare the response. |
1033 | 1052 | $headers = $request->get_response_header(); |
1034 | 1053 | $headers['x-aws-stringtosign'] = $string_to_sign; |
| 1054 | + $headers['x-aws-request-headers'] = $request_headers; |
1035 | 1055 | $headers['x-aws-body'] = $querystring; |
1036 | 1056 | |
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()); |
1039 | 1058 | |
1040 | 1059 | // Was it Amazon's fault the request failed? Retry the request until we reach $max_retries. |
1041 | 1060 | if ((integer) $request->get_response_code() === 500 || (integer) $request->get_response_code() === 503) |
— | — | @@ -1153,7 +1172,7 @@ |
1154 | 1173 | * @param string $content_type (Optional) The content-type to use when determining how to parse the content. |
1155 | 1174 | * @return CFResponse|string A parsed <CFResponse> object, or parsed XML. |
1156 | 1175 | */ |
1157 | | - public function parse_callback($response, $content_type = null) |
| 1176 | + public function parse_callback($response, $headers = null) |
1158 | 1177 | { |
1159 | 1178 | // Shorten this so we have a (mostly) single code path |
1160 | 1179 | if (isset($response->body)) |
— | — | @@ -1161,11 +1180,6 @@ |
1162 | 1181 | if (is_string($response->body)) |
1163 | 1182 | { |
1164 | 1183 | $body = $response->body; |
1165 | | - |
1166 | | - if (!$content_type) |
1167 | | - { |
1168 | | - $content_type = $response->header['content-type']; |
1169 | | - } |
1170 | 1184 | } |
1171 | 1185 | else |
1172 | 1186 | { |
— | — | @@ -1181,10 +1195,36 @@ |
1182 | 1196 | return $response; |
1183 | 1197 | } |
1184 | 1198 | |
| 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 | + |
1185 | 1225 | // Look for XML cues |
1186 | 1226 | 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 |
1189 | 1229 | ) |
1190 | 1230 | { |
1191 | 1231 | // Strip the default XML namespace to simplify XPath expressions |
— | — | @@ -1195,8 +1235,8 @@ |
1196 | 1236 | } |
1197 | 1237 | // Look for JSON cues |
1198 | 1238 | 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 |
1201 | 1241 | ) |
1202 | 1242 | { |
1203 | 1243 | // Normalize JSON to a CFSimpleXML object |
Index: trunk/extensions/OpenStackManager/aws-sdk/utilities/json.class.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | /** |
23 | 23 | * Handles the conversion of data from JSON to other formats. |
24 | 24 | * |
25 | | - * @version 2011.03.02 |
| 25 | + * @version 2011.03.25 |
26 | 26 | * @license See the included NOTICE.md file for more information. |
27 | 27 | * @copyright See the included NOTICE.md file for more information. |
28 | 28 | * @link http://aws.amazon.com/php/ PHP Developer Center |
Index: trunk/extensions/OpenStackManager/aws-sdk/utilities/simplexml.class.php |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | * Wraps the underlying `SimpleXMLIterator` class with enhancements for rapidly traversing the DOM tree, |
24 | 24 | * converting types, and comparisons. |
25 | 25 | * |
26 | | - * @version 2010.11.08 |
| 26 | + * @version 2011.03.25 |
27 | 27 | * @license See the included NOTICE.md file for more information. |
28 | 28 | * @copyright See the included NOTICE.md file for more information. |
29 | 29 | * @link http://aws.amazon.com/php/ PHP Developer Center |
— | — | @@ -77,6 +77,10 @@ |
78 | 78 | return $results; |
79 | 79 | } |
80 | 80 | |
| 81 | + |
| 82 | + /*%******************************************************************************************%*/ |
| 83 | + // TRAVERSAL |
| 84 | + |
81 | 85 | /** |
82 | 86 | * Wraps the results of an XPath query in a <CFArray> object. |
83 | 87 | * |
— | — | @@ -108,6 +112,10 @@ |
109 | 113 | return $parents[0]; |
110 | 114 | } |
111 | 115 | |
| 116 | + |
| 117 | + /*%******************************************************************************************%*/ |
| 118 | + // ALTERNATE FORMATS |
| 119 | + |
112 | 120 | /** |
113 | 121 | * Gets the current XML node as a true string. |
114 | 122 | * |
— | — | @@ -129,6 +137,16 @@ |
130 | 138 | } |
131 | 139 | |
132 | 140 | /** |
| 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 | + /** |
133 | 151 | * Gets the current XML node as a JSON string. |
134 | 152 | * |
135 | 153 | * @return string The current XML node as a JSON string. |
— | — | @@ -139,6 +157,20 @@ |
140 | 158 | } |
141 | 159 | |
142 | 160 | /** |
| 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 | + /** |
143 | 175 | * Whether or not the current node exactly matches the compared value. |
144 | 176 | * |
145 | 177 | * @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 @@ |
113 | 113 | |
114 | 114 | foreach ($array as $key => $value) |
115 | 115 | { |
116 | | - $temp[] = rawurlencode($key) . '=' . rawurlencode($value); |
| 116 | + if (is_string($key) && !is_array($value)) |
| 117 | + { |
| 118 | + $temp[] = rawurlencode($key) . '=' . rawurlencode($value); |
| 119 | + } |
117 | 120 | } |
118 | 121 | |
119 | 122 | 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 |
1 | 379 | + native |
Index: trunk/extensions/OpenStackManager/aws-sdk/utilities/array.class.php |
— | — | @@ -54,6 +54,10 @@ |
55 | 55 | return 'Array'; |
56 | 56 | } |
57 | 57 | |
| 58 | + |
| 59 | + /*%******************************************************************************************%*/ |
| 60 | + // REFORMATTING |
| 61 | + |
58 | 62 | /** |
59 | 63 | * Maps each element in the <CFArray> object as an integer. |
60 | 64 | * |
— | — | @@ -88,6 +92,10 @@ |
89 | 93 | return $list; |
90 | 94 | } |
91 | 95 | |
| 96 | + |
| 97 | + /*%******************************************************************************************%*/ |
| 98 | + // CONFIRMATION |
| 99 | + |
92 | 100 | /** |
93 | 101 | * 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. |
94 | 102 | * |
— | — | @@ -109,6 +117,10 @@ |
110 | 118 | return (array_search(false, $dlist, true) !== false) ? false : true; |
111 | 119 | } |
112 | 120 | |
| 121 | + |
| 122 | + /*%******************************************************************************************%*/ |
| 123 | + // ITERATING AND EXECUTING |
| 124 | + |
113 | 125 | /** |
114 | 126 | * Iterates over a <CFArray> object, and executes a function for each matched element. |
115 | 127 | * |
— | — | @@ -186,6 +198,10 @@ |
187 | 199 | return $this->filter($callback, $bind); |
188 | 200 | } |
189 | 201 | |
| 202 | + |
| 203 | + /*%******************************************************************************************%*/ |
| 204 | + // TRAVERSAL |
| 205 | + |
190 | 206 | /** |
191 | 207 | * Gets the first result in the array. |
192 | 208 | * |
— | — | @@ -227,4 +243,28 @@ |
228 | 244 | { |
229 | 245 | return new CFArray(array_values($this->getArrayCopy())); |
230 | 246 | } |
| 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 | + } |
231 | 271 | } |