request.class.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /*
  3. * Copyright 2010-2011 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. // CLASS
  18. /**
  19. * Wraps the underlying `RequestCore` class with some AWS-specific customizations.
  20. *
  21. * @version 2011.06.02
  22. * @license See the included NOTICE.md file for more information.
  23. * @copyright See the included NOTICE.md file for more information.
  24. * @link http://aws.amazon.com/php/ PHP Developer Center
  25. */
  26. class CFRequest extends RequestCore
  27. {
  28. /**
  29. * The default class to use for HTTP Requests (defaults to <CFRequest>).
  30. */
  31. public $request_class = 'CFRequest';
  32. /**
  33. * The default class to use for HTTP Responses (defaults to <CFResponse>).
  34. */
  35. public $response_class = 'CFResponse';
  36. /*%******************************************************************************************%*/
  37. // CONSTRUCTOR
  38. /**
  39. * Constructs a new instance of this class.
  40. *
  41. * @param string $url (Optional) The URL to request or service endpoint to query.
  42. * @param string $proxy (Optional) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port`
  43. * @param array $helpers (Optional) An associative array of classnames to use for request, and response functionality. Gets passed in automatically by the calling class.
  44. * @return $this A reference to the current instance.
  45. */
  46. public function __construct($url = null, $proxy = null, $helpers = null)
  47. {
  48. parent::__construct($url, $proxy, $helpers);
  49. // Standard settings for all requests
  50. $this->add_header('Expect', '100-continue');
  51. $this->set_useragent(CFRUNTIME_USERAGENT);
  52. $this->cacert_location = (defined('AWS_CERTIFICATE_AUTHORITY') ? AWS_CERTIFICATE_AUTHORITY : false);
  53. return $this;
  54. }
  55. }