[php-src] Issue #16137: Built-in webserver not passing header correctly
| From: | susnux | Date: | Mon, 30 Sep 2024 17:37:34 +0000 |
| Subject: | [php-src] Issue #16137: Built-in webserver not passing header correctly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247950@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/16137
Author: susnux
### Description
E.g. the ´Forwarded` header might appear more then once, NGinx and Apache correctly merge them into
a comma separated list.
But the built-in server does not and just passes the first header set.
To test:
```php
<?php
// index.php
var_dump($_SERVER['HTTP_FORWARDED']);
```
Run with:
```sh
php -S localhost:8000
```
Test with curl:
```sh
curl -v -H 'Forwarded: for=127.0.0.1' -H 'Forwarded: for=unknown'
localhost:8000
* Host localhost:8000 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
* Trying [::1]:8000...
* Connected to localhost (::1) port 8000
* using HTTP/1.x
> GET / HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/8.10.1
> Accept: */*
> Forwarded: for=127.0.0.1
> Forwarded: for=unknown
>
* Request completely sent off
< HTTP/1.1 200 OK
< Host: localhost:8000
< Date: Mon, 30 Sep 2024 17:28:59 GMT
< Connection: close
< X-Powered-By: PHP/8.3.11
< Content-type: text/html; charset=UTF-8
<
string(13) "for=127.0.0.1"
```
Expected output:
for=127.0.0.1,for=unknown
### PHP Version
8.3.11
### Operating System
openSUSE Tumbleweek