forked from jquery/jquery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweaked the headers test to be apache independent and actually work.
- Loading branch information
jaubourg
committed
Dec 11, 2010
1 parent
9d3a4a2
commit 0b0889c
Showing
2 changed files
with
17 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,18 @@ | ||
<?php | ||
|
||
if (!function_exists('apache_request_headers')) { | ||
function apache_request_headers() { | ||
foreach($_SERVER as $key=>$value) { | ||
if (substr($key,0,5)=="HTTP_") { | ||
$key=str_replace(" ","-",ucwords(strtolower(str_replace("_"," ",substr($key,5))))); | ||
$out[$key]=$value; | ||
}else{ | ||
$out[$key]=$value; | ||
} | ||
} | ||
return $out; | ||
} | ||
} | ||
$headers = array(); | ||
|
||
foreach( $_SERVER as $key => $value ) { | ||
|
||
if ( substr( $key , 0 , 5 ) == "HTTP_" ) { | ||
|
||
$key = str_replace( " " , "-" , ucwords( strtolower( str_replace( "_" , " " , substr( $key , 5) ) ) ) ); | ||
$headers[ $key ] = $value; | ||
|
||
$headers = apache_request_headers(); | ||
} | ||
|
||
} | ||
|
||
foreach( explode( "_" , $_GET[ "keys" ] ) as $key ) { | ||
echo "$key: $headers[$key]\n"; | ||
echo "$key: " . $headers[ str_replace( " " , "-" , ucwords( strtolower( str_replace( "-" , " " , $key ) ) ) ) ] . "\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters