Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Better support for mime types #9

Merged
merged 1 commit into from

5 participants

@Smarre

Nowadays there could be content-types like “text/xml; charset=utf-8
which doesn’t match to ”text/xml” at all. This splits from ; and takes
first element and does the comparison using that instead.

Atleast nginx (by default) sets this mime type for XML files.

@Smarre Smarre split content-type and get real mime type
Nowadays there could be content-types like “text/xml; charset=utf-8
which doesn’t match to ”text/xml” at all. This splits from ; and takes
first element and does the comparison using that instead.
8d56926
@CloCkWeRX CloCkWeRX merged commit c32f643 into from
@sinkcup

have this version released? I have installed PEAR 1.9.4, but that file is still old.

Owner

@sinkcup: no, not released

... a year ago ... is PEAR been deprecated ?

Collaborator

No, we are trying to clean up the mess and release 1.10 sometime (hopefully) soon.

Owner

Cherry-picked into stable branch for version 1.9.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 19, 2012
  1. @Smarre

    split content-type and get real mime type

    Smarre authored
    Nowadays there could be content-types like “text/xml; charset=utf-8
    which doesn’t match to ”text/xml” at all. This splits from ; and takes
    first element and does the comparison using that instead.
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 2 deletions.
  1. +4 −2 PEAR/REST.php
View
6 PEAR/REST.php
@@ -129,11 +129,13 @@ function retrieveData($url, $accept = false, $forcestring = false, $channel = fa
}
if (isset($headers['content-type'])) {
- switch ($headers['content-type']) {
+ $content_type = explode(";", $headers['content-type']);
+ $content_type = $content_type[0];
+ switch ($content_type) {
case 'text/xml' :
case 'application/xml' :
case 'text/plain' :
- if ($headers['content-type'] === 'text/plain') {
+ if ($content_type === 'text/plain') {
$check = substr($content, 0, 5);
if ($check !== '<?xml') {
break;
Something went wrong with that request. Please try again.