\Guzzle\Plugin\Md5Md5ValidatorPlugin

Ensures that an the MD5 hash of an entity body matches the Content-MD5 header (if set) of an HTTP response. An exception is thrown if the calculated MD5 does not match the expected MD5.

Summary

Methods
Properties
Constants
__construct()
getSubscribedEvents()
onRequestComplete()
No public properties found
No constants found
No protected methods found
$contentLengthCutoff
$contentEncoded
N/A
No private methods found
No private properties found
N/A

Properties

$contentLengthCutoff

$contentLengthCutoff : integer

Type

integer — Maximum Content-Length in bytes to validate

$contentEncoded

$contentEncoded : boolean

Type

boolean — Whether or not to compare when a Content-Encoding is present

Methods

__construct()

__construct(boolean  $contentEncoded = true, boolean|integer  $contentLengthCutoff = false) 

Parameters

boolean $contentEncoded

Calculating the MD5 hash of an entity body where a Content-Encoding was applied is a more expensive comparison because the entity body will need to be compressed in order to get the correct hash. Set to FALSE to not validate the MD5 hash of an entity body with an applied Content-Encoding.

boolean|integer $contentLengthCutoff

Maximum Content-Length (bytes) in which a MD5 hash will be validated. Any response with a Content-Length greater than this value will not be validated because it will be deemed too memory intensive.

getSubscribedEvents()

getSubscribedEvents() : array

Returns an array of event names this subscriber wants to listen to.

The array keys are event names and the value can be:

  • The method name to call (priority defaults to 0)
  • An array composed of the method name to call and the priority
  • An array of arrays composed of the method names to call and respective priorities, or 0 if unset

For instance:

  • array('eventName' => 'methodName')
  • array('eventName' => array('methodName', $priority))
  • array('eventName' => array(array('methodName1', $priority), array('methodName2')))

Returns

array —

The event names to listen to

onRequestComplete()

onRequestComplete(\Guzzle\Common\Event  $event) 

{@inheritdoc}

Parameters

\Guzzle\Common\Event $event

Throws

\Guzzle\Common\Exception\UnexpectedValueException