Tweaked the headers test to be apache independent and actually work.
This commit is contained in:
parent
9d3a4a2b40
commit
0b0889ceaa
2 changed files with 17 additions and 20 deletions
|
@ -1,21 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!function_exists('apache_request_headers')) {
|
$headers = array();
|
||||||
function apache_request_headers() {
|
|
||||||
foreach($_SERVER as $key=>$value) {
|
foreach( $_SERVER as $key => $value ) {
|
||||||
if (substr($key,0,5)=="HTTP_") {
|
|
||||||
$key=str_replace(" ","-",ucwords(strtolower(str_replace("_"," ",substr($key,5)))));
|
if ( substr( $key , 0 , 5 ) == "HTTP_" ) {
|
||||||
$out[$key]=$value;
|
|
||||||
}else{
|
$key = str_replace( " " , "-" , ucwords( strtolower( str_replace( "_" , " " , substr( $key , 5) ) ) ) );
|
||||||
$out[$key]=$value;
|
$headers[ $key ] = $value;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = apache_request_headers();
|
|
||||||
|
|
||||||
foreach( explode( "_" , $_GET[ "keys" ] ) as $key ) {
|
foreach( explode( "_" , $_GET[ "keys" ] ) as $key ) {
|
||||||
echo "$key: $headers[$key]\n";
|
echo "$key: " . $headers[ str_replace( " " , "-" , ucwords( strtolower( str_replace( "-" , " " , $key ) ) ) ) ] . "\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,16 +286,16 @@ test(".ajax() - headers" , function() {
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
var requestHeaders = {
|
var requestHeaders = {
|
||||||
Simple: "value",
|
siMPle: "value",
|
||||||
"Something-Else": "other value",
|
"SometHing-elsE": "other value",
|
||||||
Other: "something else"
|
OthEr: "something else"
|
||||||
},
|
},
|
||||||
list = [],
|
list = [],
|
||||||
i,
|
i,
|
||||||
sync = 2;
|
sync = 2;
|
||||||
|
|
||||||
for( i in requestHeaders ) {
|
for( i in requestHeaders ) {
|
||||||
list.push( i.toLowerCase() );
|
list.push( i );
|
||||||
}
|
}
|
||||||
|
|
||||||
list = list.join( "_" );
|
list = list.join( "_" );
|
||||||
|
@ -305,7 +305,7 @@ test(".ajax() - headers" , function() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
var tmp = [];
|
var tmp = [];
|
||||||
for ( i in requestHeaders ) {
|
for ( i in requestHeaders ) {
|
||||||
tmp.push( i.toLowerCase() , ": " , requestHeaders[ i ] , "\n" );
|
tmp.push( i , ": " , requestHeaders[ i ] , "\n" );
|
||||||
}
|
}
|
||||||
tmp = tmp.join( "" );
|
tmp = tmp.join( "" );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue