aboutsummaryrefslogtreecommitdiffstats
path: root/test/data/ajax/headers
diff options
context:
space:
mode:
Diffstat (limited to 'test/data/ajax/headers')
-rw-r--r--test/data/ajax/headers/cache/index.php30
-rw-r--r--test/data/ajax/headers/request/index.php12
-rw-r--r--test/data/ajax/headers/response/index.php5
3 files changed, 47 insertions, 0 deletions
diff --git a/test/data/ajax/headers/cache/index.php b/test/data/ajax/headers/cache/index.php
new file mode 100644
index 000000000..c52b665bd
--- /dev/null
+++ b/test/data/ajax/headers/cache/index.php
@@ -0,0 +1,30 @@
+<?php
+$headers = array(
+
+ "If-Modified-Since" => array(
+ "request" => "HTTP_IF_MODIFIED_SINCE",
+ "response" => "Last-Modified",
+ ),
+ "If-None-Match" => array(
+ "request" => "HTTP_IF_NONE_MATCH",
+ "response" => "Etag",
+ ),
+
+);
+
+$header = $_REQUEST["header"];
+$value = $_REQUEST["value"];
+
+if ( $header === "If-None-Match" ) {
+ $value = md5( $value );
+}
+
+$headers = $headers[ $header ];
+
+$requestHeader = isset( $_SERVER[ $headers["request"] ] ) ? stripslashes($_SERVER[ $headers["request"] ]) : false;
+if ( $requestHeader === $value ) {
+ header("HTTP/1.0 304 Not Modified");
+} else {
+ header("$headers[response]: $value");
+ echo $requestHeader ? "OK: $value": "FAIL";
+}
diff --git a/test/data/ajax/headers/request/index.php b/test/data/ajax/headers/request/index.php
new file mode 100644
index 000000000..c064ad709
--- /dev/null
+++ b/test/data/ajax/headers/request/index.php
@@ -0,0 +1,12 @@
+<?php
+
+$headers = array();
+
+foreach( $_SERVER as $key => $value ) {
+ $key = str_replace( "_" , "-" , substr($key,0,5) == "HTTP_" ? substr($key,5) : $key );
+ $headers[ $key ] = $value;
+}
+
+foreach( explode( "," , $_GET["headers"] ) as $key ) {
+ echo "$key: " . @$headers[ strtoupper( $key ) ] . "\n";
+}
diff --git a/test/data/ajax/headers/response/index.php b/test/data/ajax/headers/response/index.php
new file mode 100644
index 000000000..6c8d0864e
--- /dev/null
+++ b/test/data/ajax/headers/response/index.php
@@ -0,0 +1,5 @@
+<?php
+
+foreach( $_REQUEST as $header => $value ) {
+ @header("$header: $value");
+}