--- oauth/provider.c 2010-08-02 23:08:57.000000000 +0100 +++ oauth-new/provider.c 2010-08-02 23:17:24.000000000 +0100 @@ -494,6 +494,27 @@ if(SUCCESS == zend_hash_find(HASH_OF(retval), "Authorization", sizeof("Authorization"), (void **) &tmpzval)) { auth_header = *tmpzval; authorization_header = estrdup(Z_STRVAL_P(auth_header)); + } else if (SUCCESS == zend_hash_find(HASH_OF(retval), "authorization", sizeof("authorization"), (void **) &tmpzval)) { + // most likely case: try all lowercase + auth_header = *tmpzval; + authorization_header = estrdup(Z_STRVAL_P(auth_header)); + } else { + // last-ditch attempt -- try for a completely case-insensitive match + int key_type; + char *string_key; + ulong num_key; + zend_hash_internal_pointer_reset(HASH_OF(retval)); + while ((key_type = zend_hash_get_current_key(HASH_OF(retval), &string_key, &num_key, 1)) != HASH_KEY_NON_EXISTANT) { + if (key_type == HASH_KEY_IS_STRING && !strncasecmp(string_key, "authorization", sizeof("authorization"))) { + // found it! + if (SUCCESS==zend_hash_get_current_data(HASH_OF(retval), (void **) &tmpzval)) { + auth_header = *tmpzval; + authorization_header = estrdup(Z_STRVAL_P(auth_header)); + } + break; + } + zend_hash_move_forward(HASH_OF(retval)); + } } } else { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to call apache_request_headers while running under the Apache SAPI");