| 1 |
lars |
1 |
<?php
|
|
|
2 |
/*
|
|
|
3 |
* Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
|
4 |
*
|
|
|
5 |
* Licensed under the Apache License, Version 2.0 (the "License").
|
|
|
6 |
* You may not use this file except in compliance with the License.
|
|
|
7 |
* A copy of the License is located at
|
|
|
8 |
*
|
|
|
9 |
* http://aws.amazon.com/apache2.0
|
|
|
10 |
*
|
|
|
11 |
* or in the "license" file accompanying this file. This file is distributed
|
|
|
12 |
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
|
|
13 |
* express or implied. See the License for the specific language governing
|
|
|
14 |
* permissions and limitations under the License.
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
/*%******************************************************************************************%*/
|
|
|
19 |
// CLASS
|
|
|
20 |
|
|
|
21 |
/**
|
|
|
22 |
* Wraps the underlying `RequestCore` class with some AWS-specific customizations.
|
|
|
23 |
*
|
|
|
24 |
* @version 2011.12.02
|
|
|
25 |
* @license See the included NOTICE.md file for more information.
|
|
|
26 |
* @copyright See the included NOTICE.md file for more information.
|
|
|
27 |
* @link http://aws.amazon.com/php/ PHP Developer Center
|
|
|
28 |
*/
|
|
|
29 |
class CFRequest extends RequestCore
|
|
|
30 |
{
|
|
|
31 |
/**
|
|
|
32 |
* The default class to use for HTTP Requests (defaults to <CFRequest>).
|
|
|
33 |
*/
|
|
|
34 |
public $request_class = 'CFRequest';
|
|
|
35 |
|
|
|
36 |
/**
|
|
|
37 |
* The default class to use for HTTP Responses (defaults to <CFResponse>).
|
|
|
38 |
*/
|
|
|
39 |
public $response_class = 'CFResponse';
|
|
|
40 |
|
|
|
41 |
/**
|
|
|
42 |
* The active credential set.
|
|
|
43 |
*/
|
|
|
44 |
public $credentials;
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
/*%******************************************************************************************%*/
|
|
|
48 |
// CONSTRUCTOR
|
|
|
49 |
|
|
|
50 |
/**
|
|
|
51 |
* Constructs a new instance of this class.
|
|
|
52 |
*
|
|
|
53 |
* @param string $url (Optional) The URL to request or service endpoint to query.
|
|
|
54 |
* @param string $proxy (Optional) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port`
|
|
|
55 |
* @param array $helpers (Optional) An associative array of classnames to use for request, and response functionality. Gets passed in automatically by the calling class.
|
|
|
56 |
* @param CFCredential $credentials (Required) The credentials to use for signing and making requests.
|
|
|
57 |
* @return $this A reference to the current instance.
|
|
|
58 |
*/
|
|
|
59 |
public function __construct($url = null, $proxy = null, $helpers = null, CFCredential $credentials = null)
|
|
|
60 |
{
|
|
|
61 |
parent::__construct($url, $proxy, $helpers);
|
|
|
62 |
|
|
|
63 |
// Standard settings for all requests
|
|
|
64 |
$this->add_header('Expect', '100-continue');
|
|
|
65 |
$this->set_useragent(CFRUNTIME_USERAGENT);
|
|
|
66 |
$this->credentials = $credentials;
|
|
|
67 |
$this->cacert_location = ($this->credentials['certificate_authority'] ? $this->credentials['certificate_authority'] : false);
|
|
|
68 |
|
|
|
69 |
return $this;
|
|
|
70 |
}
|
|
|
71 |
}
|