Skip to content

Respond with 501 to unknown request methods - #192

Closed
nikcorg wants to merge 1 commit into
php:masterfrom
nikcorg:method-not-supported
Closed

nikcorg wants to merge 1 commit into
php:masterfrom
nikcorg:method-not-supported

Conversation

@nikcorg

@nikcorg nikcorg commented Sep 12, 2012

Copy link
Copy Markdown
Contributor

This patch adresses the issue mentioned in Bug #61679, but with the difference of responding with 501 Not Implemented (instead of 405 Method Not Allowed) as per RFC2616 Section 5.1.1.

An origin server SHOULD return the status code 405 (Method Not Allowed) if the method is known by the origin server but not allowed for the requested resource, and 501 (Not Implemented) if the method is unrecognized or not implemented by the origin server.

(Sorry about the whitespace changes, I always [automatically] trim trailing whitespace and didn't see this happening before it was too late.)

Comment thread sapi/cli/php_cli_server.c Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whitespace change highlighted the typo here. "temporarily unavailable" would be correct. Do you mind changing it?

@ircmaxell

Copy link
Copy Markdown
Contributor

The patch looks good to me. With the one exception of the spelling error (which is outside of the scope of the PR anyway, but could be fixed)...

@nikcorg

nikcorg commented Sep 13, 2012

Copy link
Copy Markdown
Contributor Author

@lstrojny, @ircmaxell The typo has been fixed.

@laruence

Copy link
Copy Markdown
Member

just one thing, I think the error response should before the dispatch...

maybe in the read_request phase.

@nikcorg

nikcorg commented Sep 13, 2012

Copy link
Copy Markdown
Contributor Author

@laruence I moved the response into event_read_request. Is that better to your liking?

@laruence

Copy link
Copy Markdown
Member

Thanks, good to me now

@lstrojny

Copy link
Copy Markdown
Contributor

Alright, will take of it this weekend. Checked with stas, we also merge into 5.4

@lstrojny

Copy link
Copy Markdown
Contributor

@nikcorg could you rebase and squash your commits?

@nikcorg

nikcorg commented Sep 14, 2012

Copy link
Copy Markdown
Contributor Author

@lstrojny I think I just did that.

Fixed typo

Moved 501 response from dispatch to event_read_request

Return return value of send_error_page
@php-pulls

Copy link
Copy Markdown

Comment on behalf of stas at php.net:

merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants