Skip to content

Commit df1b86b

Browse files
authored
Merge pull request #2064 from etrepum/normalize-authorization-header
Fix: Normalize the case of the authorization header to Authorization in tutor_getallheaders()
2 parents c4be1aa + c3b3c7b commit df1b86b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

includes/tutor-general-functions.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,16 @@ function tutor_getallheaders() {
12411241
}
12421242
}
12431243

1244+
if ( ! isset( $headers['Authorization'] ) ) {
1245+
foreach ( $headers as $name => $value ) {
1246+
if ( strtolower( $name ) === 'authorization' ) {
1247+
unset( $headers[$name] );
1248+
$headers['Authorization'] = $value;
1249+
break;
1250+
}
1251+
}
1252+
}
1253+
12441254
return $headers;
12451255
}
12461256
}

restapi/RestAuth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ public static function validate_api_key_secret( $api_key, $api_secret, $return_r
303303
* @return boolean
304304
*/
305305
public static function process_api_request() {
306-
$headers = apache_request_headers();
306+
$headers = tutor_getallheaders();
307307

308308
if ( isset( $headers['Authorization'] ) ) {
309309
$authorization_header = $headers['Authorization'];

0 commit comments

Comments
 (0)