|
@@ -189,7 +189,7 @@ class Web {
|
|
|
Retrieve a client header value sent with the request.
|
|
|
**/
|
|
|
public static function getClientHeader( k : String ) : String {
|
|
|
- var k = k.toUpperCase();
|
|
|
+ var k = StringTools.replace(k.toUpperCase(),"-","_");
|
|
|
for(i in getClientHeaders()) {
|
|
|
if(i.header == k)
|
|
|
return i.value;
|
|
@@ -208,12 +208,21 @@ class Web {
|
|
|
var h = Lib.hashOfAssociativeArray(untyped __php__("$_SERVER"));
|
|
|
for(k in h.keys()) {
|
|
|
if(k.substr(0,5) == "HTTP_") {
|
|
|
- _client_headers.add({ header : StringTools.replace(k.substr(5), '_', '-'), value : h.get(k)});
|
|
|
+ _client_headers.add({ header : k.substr(5), value : h.get(k)});
|
|
|
// this is also a valid prefix (issue #1883)
|
|
|
} else if(k.substr(0,8) == "CONTENT_") {
|
|
|
- _client_headers.add({ header : StringTools.replace(k, '_', '-'), value : h.get(k)});
|
|
|
+ _client_headers.add({ header : k, value : h.get(k)});
|
|
|
}
|
|
|
}
|
|
|
+ // and these(issue #5270)
|
|
|
+ if(untyped __php__("isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])")) {
|
|
|
+ _client_headers.add({header: 'AUTHORIZATION', value: untyped __php__("(string)$_SERVER['REDIRECT_HTTP_AUTHORIZATION']")});
|
|
|
+ } else if(untyped __php__("isset($_SERVER['PHP_AUTH_USER'])")) {
|
|
|
+ var basic_pass = untyped __php__("isset($_SERVER['PHP_AUTH_PW']) ? (string)$_SERVER['PHP_AUTH_PW'] : ''");
|
|
|
+ _client_headers.add({header: 'AUTHORIZATION', value: 'Basic ' + untyped __php__("base64_encode($_SERVER['PHP_AUTH_USER'] + ':' + $basic_pass)")});
|
|
|
+ } else if(untyped __php__("isset($_SERVER['PHP_AUTH_DIGEST'])")) {
|
|
|
+ _client_headers.add({header: 'AUTHORIZATION', value: untyped __php__("(string)$_SERVER['PHP_AUTH_DIGEST']")});
|
|
|
+ }
|
|
|
}
|
|
|
return _client_headers;
|
|
|
}
|
|
@@ -252,7 +261,7 @@ class Web {
|
|
|
|
|
|
/**
|
|
|
Returns an hashtable of all Cookies sent by the client.
|
|
|
- Modifying the hashtable will not modify the cookie, use `php.Web.setCookie()`
|
|
|
+ Modifying the hashtable will not modify the cookie, use `php.Web.setCookie()`
|
|
|
instead.
|
|
|
**/
|
|
|
public static function getCookies():Map<String,String> {
|