roguesupport / oauth-php

The original OAUTH standard implemented in PHP (Historic Record)
MIT License
0 stars 0 forks source link

Content-Type missed in POST #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The change is in OAuthUtil::get_headers()
...
 else if (strtolower($key) == "content_type")
      {
          $out["Content-Type"] = $value;
      }
...

With this change, the function is now:

public static function get_headers() {

    if (function_exists('apache_request_headers')) {
      // we need this to get the actual Authorization: header
      // because apache tends to tell us it doesn't exist
      return apache_request_headers();
    }
    // otherwise we don't have apache and are just going to have to hope
    // that $_SERVER actually contains what we need
    $out = array();
    foreach ($_SERVER as $key => $value) {
      if (substr($key, 0, 5) == "HTTP_") {
        // this is chaos, basically it is just there to capitalize the first
        // letter of every word that is not an initial HTTP and strip HTTP
        // code from przemek
        $key = str_replace(
          " ",
          "-",
          ucwords(strtolower(str_replace("_", " ", substr($key, 5))))
        );

        $out[$key] = $value;
      } else if (strtolower($key) == "content_type")
      {
          $out["Content-Type"] = $value;
      }
    }
    return $out;
  }

Original issue reported on code.google.com by yonas.ya...@gmail.com on 30 Jul 2009 at 7:13

GoogleCodeExporter commented 9 years ago
Dear Yonas, 

Thank you for your patch.  But in the current library we don't have any 
get_headers() functions.  Is your proposal 
to add it to the code?  That might be useful to support non Apache http servers.

Original comment by ma...@pobox.com on 16 Aug 2009 at 7:35

GoogleCodeExporter commented 9 years ago
@yonas.yanfa: Not sure where to add this to... Can you elaborate?

Original comment by brunobg%...@gtempaccount.com on 12 Jan 2010 at 6:50

GoogleCodeExporter commented 9 years ago

Original comment by brunobg%...@gtempaccount.com on 6 Feb 2010 at 5:05