1
0
Fork 0

Revert "Fix IHTTPResult::getHeader() - Now returns a string array, like expected - Fix usages - Fix dataset"

This reverts commit 80bd0a4d
This commit is contained in:
Philipp Holzer 2020-10-11 23:25:40 +02:00
commit 0449077126
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
11 changed files with 59 additions and 68 deletions

View file

@ -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,11 +289,7 @@ class CurlResult implements IHTTPResult
$parts = explode(':', $line);
$headerfield = strtolower(trim(array_shift($parts)));
$headerdata = trim(implode(':', $parts));
if (empty($this->header_fields[$headerfield])) {
$this->header_fields[$headerfield] = [$headerdata];
} elseif (!in_array($headerdata, $this->header_fields[$headerfield])) {
$this->header_fields[$headerfield][] = $headerdata;
}
$this->header_fields[$headerfield] = $headerdata;
}
return $this->header_fields;

View file

@ -19,7 +19,7 @@ interface IHTTPResult
/**
* Returns the Content Type
*
* @return string[] the Content Types
* @return string the Content Type
*/
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);

View file

@ -429,7 +429,7 @@ class Probe
}
// If it isn't a HTML file then exit
if (!in_array('html', $curlResult->getContentType())) {
if (($curlResult->getContentType() != '') && !strstr(strtolower($curlResult->getContentType()), 'html')) {
return false;
}