Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62956 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93473 invoked from network); 12 Sep 2012 11:44:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Sep 2012 11:44:51 -0000 Authentication-Results: pb1.pair.com header.from=ivan.enderlin@hoa-project.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hoa-project.net from 95.130.12.24 cause and error) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 95.130.12.24 host1.trois-doubles.net Linux 2.6 Received: from [95.130.12.24] ([95.130.12.24:43200] helo=host1.trois-doubles.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 05/F7-42492-1B570505 for ; Wed, 12 Sep 2012 07:44:50 -0400 Received: from Hwhost2.local (191-120.79-83.cust.bluewin.ch [83.79.120.191]) by host1.trois-doubles.net (Postfix) with ESMTPA id 9AB382059FF for ; Wed, 12 Sep 2012 13:44:45 +0200 (CEST) Message-ID: <505075AD.1030903@hoa-project.net> Date: Wed, 12 Sep 2012 13:44:45 +0200 Reply-To: ivan.enderlin@hoa-project.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/17.0 Thunderbird/17.0a2 MIME-Version: 1.0 To: internals@lists.php.net References: <50504DDD.6070001@hoa-project.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] PHP build-in HTTP server and the HEAD method From: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") On 12/09/12 11:15, Damien Tournoud wrote: > On Wed, Sep 12, 2012 at 10:54 AM, Ivan Enderlin @ Hoa > wrote: >> Hello, >> >> It is probably me but it seems like the build-in HTTP server does not well >> support the HEAD method. Here is my following test case. First, the foo.php >> file: >> >> > >> var_dump($_SERVER['REQUEST_METHOD']); > By definition, a HEAD request MUST NOT return a message-body. Oh grrr, I feel stupid now ;-). I forget this. > This works as expected: > > header("X-Request-Method: " . $_SERVER["REQUEST_METHOD"]); > ?> > > Here is how it works: main/SAPI.c has code that set > SG(request_info).headers_only = 1 for HEAD requests, and as a > consequence php_request_shutdown() does not flush the output buffer > (if any) to the client. Ok. > You can force a body to be sent (but that's > likely not going to work with every SAPI) by not having an output > buffer or by calling ob_end_flush() yourself. Yes but that was not my goal. Thank you for your reply :-). -- Ivan Enderlin Developer of Hoa http://hoa.42/ or http://hoa-project.net/ PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) http://disc.univ-fcomte.fr/ and http://www.inria.fr/ Member of HTML and WebApps Working Group of W3C http://w3.org/