You are here

private static function OAuthRequest::split_header in OAuth 1.0 6

util function for turning the Authorization: header into parameters, has to do some unescaping

1 call to OAuthRequest::split_header()
OAuthRequest::from_request in ./OAuth.php
attempt to build up a request from what was passed to the server

File

./OAuth.php, line 406

Class

OAuthRequest

Code

private static function split_header($header) {

  /*{{{*/

  // this should be a regex
  // error cases: commas in parameter values
  $parts = explode(",", $header);
  $out = array();
  foreach ($parts as $param) {
    $param = ltrim($param);

    // skip the "realm" param, nobody ever uses it anyway
    if (substr($param, 0, 5) != "oauth") {
      continue;
    }
    $param_parts = explode("=", $param);

    // rawurldecode() used because urldecode() will turn a "+" in the
    // value into a space
    $out[$param_parts[0]] = rawurldecode(substr($param_parts[1], 1, -1));
  }
  return $out;
}