Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[ZF-8825] Lower-case lookup for "authorization" header #3403

Merged
merged 1 commit into from

2 participants

@weierophinney
  • A number of libraries, including CordovaJS, send the Authorization header as "authorization" (all lowercase); added a conditional check for this.
  • Cannot test this, as it depends on the output of apache_request_headers().

See http://framework.zend.com/issues/browse/ZF-8825 for a related ZF1 issue, and https://issues.apache.org/jira/browse/CB-1455 for a related CordovaJS issue.

@weierophinney weierophinney [ZF-8825] Lower-case lookup for "authorization" header
- A number of libraries, including CordovaJS, send the Authorization
  header as "authorization" (all lowercase); added a conditional check
  for this.
- Cannot test this, as it depends on the output of
  apache_request_headers().
f51053a
@Maks3w
Collaborator

I think that is better merge both cases for optimize the code.

@weierophinney

@Maks3w How do you suggest doing that, exactly?

@Maks3w
Collaborator
            if (!isset($this->serverParams['HTTP_AUTHORIZATION'])) {
                if (isset($apacheRequestHeaders['Authorization'])) {
                    $this->serverParams->set('HTTP_AUTHORIZATION', $apacheRequestHeaders['Authorization']);
                } elseif (isset($apacheRequestHeaders['authorization']) {
                    $this->serverParams->set('HTTP_AUTHORIZATION', $apacheRequestHeaders['authorization']);
                }
            }
@Maks3w Maks3w referenced this pull request from a commit
@Maks3w Maks3w [#3403] Optimize number of conditions 2761103
@Maks3w Maks3w referenced this pull request from a commit
@Maks3w Maks3w Forward #3403 2050f57
@Maks3w Maks3w merged commit f51053a into zendframework:master

1 check passed

Details default The Travis build passed
@ghost Unknown referenced this pull request from a commit
@Maks3w Maks3w [#3403] Optimize number of conditions 0ce5aaa
@ghost Unknown referenced this pull request from a commit
@Maks3w Maks3w Forward #3403 a7e50aa
@weierophinney weierophinney referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@weierophinney weierophinney referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@weierophinney weierophinney referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@gianarb gianarb referenced this pull request from a commit in zendframework/zend-http
@Maks3w Maks3w [zendframework/zf2#3403] Optimize number of conditions 1aae024
@gianarb gianarb referenced this pull request from a commit in zendframework/zend-http
@Maks3w Maks3w Merge pull request zendframework/zf2#3403 branch 'hotfix/zf8825' 1dfe980
@gianarb gianarb referenced this pull request from a commit in zendframework/zend-http
@Maks3w Maks3w Forward zendframework/zf2#3403 704b760
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 10, 2013
  1. @weierophinney

    [ZF-8825] Lower-case lookup for "authorization" header

    weierophinney authored
    - A number of libraries, including CordovaJS, send the Authorization
      header as "authorization" (all lowercase); added a conditional check
      for this.
    - Cannot test this, as it depends on the output of
      apache_request_headers().
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 0 deletions.
  1. +7 −0 library/Zend/Http/PhpEnvironment/Request.php
View
7 library/Zend/Http/PhpEnvironment/Request.php
@@ -211,6 +211,13 @@ public function setServer(ParametersInterface $server)
) {
$this->serverParams->set('HTTP_AUTHORIZATION', $apacheRequestHeaders['Authorization']);
}
+
+ // CordovaJS and some other libraries send with the header name all lowercase; test for this
+ if (!isset($this->serverParams['HTTP_AUTHORIZATION'])
+ && isset($apacheRequestHeaders['authorization'])
+ ) {
+ $this->serverParams->set('HTTP_AUTHORIZATION', $apacheRequestHeaders['authorization']);
+ }
}
// set headers
Something went wrong with that request. Please try again.