Bug #81496 [PATCH]: CLI server logs wrong request method
| From: | lauri.kentta@gmail.com | Date: | Sun, 03 Oct 2021 09:28:49 +0000 |
| Subject: | Bug #81496 [PATCH]: CLI server logs wrong request method | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-236990@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81496&edit=1
ID: 81496
Patch added by: lauri.kentta@gmail.com
Reported by: lauri dot kentta at gmail dot com
Summary: CLI server logs wrong request method
Status: Open
Type: Bug
Package: Built-in web server
PHP Version: 8.0.11
Block user comment: N
Private report: N
New Comment:
The following patch has been added/updated:
Patch Name: 0001-Fix-81496-CLI-server-logs-wrong-request-method.txt
Revision: 1633253329
URL: https://bugs.php.net/patch-display.php?bug=81496&patch=0001-Fix-81496-CLI-server-logs-wrong-request-method.txt&revision=1633253329
Previous Comments:
------------------------------------------------------------------------
[2021-10-03 09:25:58] lauri dot kentta at gmail dot com
Description:
------------
In the CLI server, request_info is populated only for scripts. If you start by fetching a static
file, the server logs request_method as "(null)", and later it logs whatever method was
used for latest script. 404 response is also affected.
There's two ways to fix this, either populate request_info for all requests or simply change
logging to use client->request.request_method instead.
Test script:
---------------
<!DOCTYPE html>
<script>
(async function() {
await fetch("static.html");
await fetch("script.php", {method: "POST"});
await fetch("static.html");
})();
</script>
Expected result:
----------------
Server log with methods GET, POST, GET.
Actual result:
--------------
Server log with methods (null), POST, POST, if the files exist.
Server log with methods (null), (null), (null), if files do NOT exist (404).
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81496&edit=1