Skip to content

Support for HTTP PATCH in the built-in webserver #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added test for HTTP PATCH method support
  • Loading branch information
Niklas Lindgren committed Sep 11, 2012
commit 50358ea11985dc621595ee39a0a183f289b7b224
44 changes: 44 additions & 0 deletions sapi/cli/tests/php_cli_server_018.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
--TEST--
Implement Req #61679 (Support HTTP PATCH method)
--SKIPIF--
<?php
include "skipif.inc";
?>
--FILE--
<?php
include "php_cli_server.inc";
php_cli_server_start(<<<'PHP'
var_dump($_SERVER['REQUEST_METHOD']);
PHP
);

list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
$port = intval($port)?:80;

$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
if (!$fp) {
die("connect failed");
}

if(fwrite($fp, <<<HEADER
PATCH / HTTP/1.1
Host: {$host}


HEADER
)) {
while (!feof($fp)) {
echo fgets($fp);
}
}

fclose($fp);
?>
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
Connection: close
X-Powered-By: %s
Content-type: text/html

string(5) "PATCH"