go to bug id or search bugs for
Currently PHP sends a HTTP/200 Success Status code to the browser if it recived a CONNECT request. Game goes for webdav requests like PROPFIND, DELETE ect.
Most scripts are not ment to handle this kind of requests, so it would make sense to allow modifying the default status code of such requests.
For example in case of a CONNECT replying HTTP/200 is plain simply wrong unless in verify specific cases where PHP actually is proxying stuff.
So I suggest to create ini directive which HTTP Status codes to reply by default.
Any change by a user script can then happen using the header() function.
as defaults I'd suggest to use HTTP/405 for CONNECT, anything else should return HTTP/200 for now.
This default should later be changed to HTTP/405 for anything beside GET and POST once ppl had time to ajust their scripts.
Add a Patch
Add a Pull Request
You're free to go through the RFC process to propose this feature, but the basic response is
No thanks. For one, adding INI settings is strongly discouraged. One of the biggest reasons is the problem of portability: now code has to be aware of multiple possible configurations of an environment. It also adds more risk to installing and upgrading PHP as it's easy for settings to be missed; I, for one, frequently deal with people asking about why their application changed when their host upgraded PHP versions.
More significantly, this is totally something that should be addressed by a userland framework. Stock PHP does not do proxying or WebDAV or anything more complex than parsing request bodies and handling file uploads. Given that one already has to write code to support these other features, it's trivial to simply add a call to header() in an appropriate place.
The fact that one has to explicitly write code to support this is the reason I'm suggesting this change.
If the code doesn't support it PHP should report this as "unsupported" (HTTP/405).