Simplified headers tests: removed multiline headers (support is far too servers & browsers dependant) and made all the tests in a single request.

This commit is contained in:
jaubourg 2010-12-11 02:41:39 +01:00
parent 0b0889ceaa
commit 974637d639
3 changed files with 24 additions and 46 deletions

View file

@ -1,5 +1,20 @@
<?php
header( "Multiple-Line: Hello\n World" );
header( "Multiple-Multiple-Line: Hello\n Beautiful\n\t World" );
header( "Single-Line: Hello World" );
header( "Sample-Header: Hello World" );
$headers = array();
foreach( $_SERVER as $key => $value ) {
if ( substr( $key , 0 , 5 ) == "HTTP_" ) {
$key = str_replace( "_" , "-" , substr( $key , 5) );
$headers[ $key ] = $value;
}
}
foreach( explode( "_" , $_GET[ "keys" ] ) as $key ) {
echo "$key: " . $headers[ strtoupper( $key ) ] . "\n";
}

View file

@ -1,18 +0,0 @@
<?php
$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;
}
}
foreach( explode( "_" , $_GET[ "keys" ] ) as $key ) {
echo "$key: " . $headers[ str_replace( " " , "-" , ucwords( strtolower( str_replace( "-" , " " , $key ) ) ) ) ] . "\n";
}