Fix IHTTPResult::getHeader()
- Now returns a string array, like expected - Fix usages - Fix dataset
This commit is contained in:
parent
f3cd973cbe
commit
80bd0a4d5a
11 changed files with 68 additions and 59 deletions
|
@ -245,7 +245,7 @@ class CurlResult implements IHTTPResult
|
|||
public function getHeader($header)
|
||||
{
|
||||
if (empty($header)) {
|
||||
return '';
|
||||
return [];
|
||||
}
|
||||
|
||||
$header = strtolower(trim($header));
|
||||
|
@ -256,7 +256,7 @@ class CurlResult implements IHTTPResult
|
|||
return $headers[$header];
|
||||
}
|
||||
|
||||
return '';
|
||||
return [];
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
@ -289,7 +289,11 @@ class CurlResult implements IHTTPResult
|
|||
$parts = explode(':', $line);
|
||||
$headerfield = strtolower(trim(array_shift($parts)));
|
||||
$headerdata = trim(implode(':', $parts));
|
||||
$this->header_fields[$headerfield] = $headerdata;
|
||||
if (empty($this->header_fields[$headerfield])) {
|
||||
$this->header_fields[$headerfield] = [$headerdata];
|
||||
} elseif (!in_array($headerdata, $this->header_fields[$headerfield])) {
|
||||
$this->header_fields[$headerfield][] = $headerdata;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->header_fields;
|
||||
|
|
|
@ -19,7 +19,7 @@ interface IHTTPResult
|
|||
/**
|
||||
* Returns the Content Type
|
||||
*
|
||||
* @return string the Content Type
|
||||
* @return string[] the Content Types
|
||||
*/
|
||||
public function getContentType();
|
||||
|
||||
|
@ -29,7 +29,7 @@ interface IHTTPResult
|
|||
*
|
||||
* @param string $header optional header field. Return all fields if empty
|
||||
*
|
||||
* @return string the headers or the specified content of the header variable
|
||||
* @return string[] the headers or the specified content of the header variable
|
||||
*/
|
||||
public function getHeader($header);
|
||||
|
||||
|
|
|
@ -429,7 +429,7 @@ class Probe
|
|||
}
|
||||
|
||||
// If it isn't a HTML file then exit
|
||||
if (($curlResult->getContentType() != '') && !strstr(strtolower($curlResult->getContentType()), 'html')) {
|
||||
if (!in_array('html', $curlResult->getContentType())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue