test fixups from Remi
authorMichael Wallner <mike@php.net>
Mon, 7 Dec 2015 14:22:46 +0000 (15:22 +0100)
committerMichael Wallner <mike@php.net>
Mon, 7 Dec 2015 14:22:46 +0000 (15:22 +0100)
tests/bug69313.phpt
tests/client025.phpt
tests/client026.phpt
tests/etag001.phpt
tests/helper/proxy.inc

index c1d56efc54d2cb6f69f884e77e6333c684eafec6..c84ef983261d39abcbc4765f42088f2fe117d555 100644 (file)
@@ -33,6 +33,7 @@ Accept-Ranges: bytes
 Content-Length: %d
 Etag: "%s"
 X-Original-Transfer-Encoding: chunked
+X-Request-Content-Length: 3
 
 GET / HTTP/1.1
 Accept: */*
index 3f90cbd7b8314f2db4dd22551dab3c5c99bd7fa4..62f0342b53518d7c65d112466f7151daa5dd2765 100644 (file)
@@ -1,11 +1,11 @@
 --TEST--
 client seek
 --SKIPIF--
-<?php 
+<?php
 include "skipif.inc";
 ?>
 --FILE--
-<?php 
+<?php
 
 include "helper/dump.inc";
 include "helper/server.inc";
@@ -29,6 +29,7 @@ Accept-Ranges: bytes
 Content-Length: %d
 Etag: "%x"
 X-Original-Transfer-Encoding: chunked
+X-Request-Content-Length: 2
 
 PUT / HTTP/1.1
 Accept: */*
index 3c16bb0aca41eeb59e13d8474d94b6f10c6432b4..f08f598574d17822db274fcbfe3b05b814b415df 100644 (file)
@@ -31,9 +31,10 @@ server("proxy.inc", function($port) {
 --EXPECTF--
 Test
 Accept-Ranges: bytes
-Content-Length: 134217960
+Content-Length: %d
 Etag: "%x"
 Last-Modified: %s
 X-Original-Transfer-Encoding: chunked
+X-Request-Content-Length: 134217728
 
-===DONE===
\ No newline at end of file
+===DONE===
index ca4cee2d18e04ea8e279a856442b7ba49e154085..52da9118dd3c99e05d77bcd56cbe5470532c9b7a 100644 (file)
@@ -1,20 +1,22 @@
 --TEST--
 etags with hash
 --SKIPIF--
-<?php 
-include "skipif.inc"; 
-_ext("hash"); 
+<?php
+include "skipif.inc";
+_ext("hash");
 ?>
 --FILE--
 <?php
 $body = new http\Message\Body;
 $body->append("Hello, my old fellow.");
 foreach (hash_algos() as $algo) {
-    ini_set("http.etag.mode", $algo);
-    printf("%10s: %s\n", 
-        $algo, 
-        $body->etag()
-    );
+    if (strncmp($algo, "sha3-", 4)) {
+        ini_set("http.etag.mode", $algo);
+        printf("%10s: %s\n",
+            $algo,
+            $body->etag()
+        );
+    }
 }
 ?>
 DONE
@@ -27,10 +29,6 @@ DONE
     sha256: ed9ecfe5c76d51179c3c1065916fdb8d94aee05577f187bd763cdc962bba1f42
     sha384: 923a756152da113db192958da485c7881e7c4811d2d34e22f4d74cd45310d983f7fb1c5527a5f9037a4c7b649a6cc2b2
     sha512: ad5ea693b8df4457d08d835ad5ccf7b626b66285f8424b3ec59e54c63bf63feef9a92baaba71c38d7bd9a1135488499fc835a8818390965c9ce8a5e4c40e519f
-  sha3-224: 2c8a112ec84af4bed902071e13329136c537d514ea24b47a6f82389d
-  sha3-256: a96753d03e6280a531e78870a6454d0c68da3b43150c77f08db77adede39741b
-  sha3-384: 2b51d78f7ab6e8e9ec4048faa837a9370ace5fc27fdcbf19f9a393fd979a6ff0369a57e06576a8ac862cb5b81f4cdb19
-  sha3-512: 849aac3468e187f871b321d4bd8a3d45ae851abd05af18463b7913b10ca8bffe73e5fb6ee43e831bb32961a3c293d692698b353ed5df0e63db561c4d5cd0c704
  ripemd128: b9e8d5864b5821d72e66101a9a0e730a
  ripemd160: d697a33676aece781b72f6fcb95f4c730367706b
  ripemd256: 9c3a73ab03e6d7d3471cf70316c4ff3ec56212d25730d382fb1480346529742b
index f99dd97cf735575c0cbd7857d0ab77bae9ead7b6..2fb3477537a03a204b69323c06797f5978b24c12 100644 (file)
@@ -1,4 +1,4 @@
-<?php 
+<?php
 
 include "dump.inc";
 include "server.inc";
@@ -6,18 +6,19 @@ include "server.inc";
 serve(function($client) {
        /* this might be a proxy connect or a standard request */
        $request = new http\Message($client, false);
-       
+
        if ($request->getHeader("Proxy-Connection")) {
                $response = new http\Env\Response;
                $response->setEnvRequest($request);
                $response->send($client);
-               
+
                /* soak up the request following the connect */
                new http\Message($client, false);
        }
-       
+
        /* return the initial message as response body */
        $response = new http\Env\Response;
+       $response->setHeader("X-Request-Content-Length", $request->getBody()->stat("size"));
        /* avoid OOM with $response->getBody()->append($request); */
        dump_message($response->getBody()->getResource(), $request);
        $response->send($client);