Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Web-Machine CPAN distribution.

Report information
The Basics
Id: 101219
Status: resolved
Priority: 0/
Queue: Web-Machine

People
Owner: Nobody in particular
Requestors: SMITHFARM [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Documentation says 'valid_content_headers' defaults to false, but this is not true
The Web::Machine::Resource POD says that 'valid_content_headers' defaults to false: valid_content_headers( $content_headers ) Parameter $content_header is a HASH ref of the Request headers that . . . . If the request includes any invalid Content-* headers, this should return false, which will result in a '501 Not Implemented' response. Defaults to false. In the source code of that module we have: sub valid_content_headers { 1 } which indicates that the documentation is wrong about this.
RT-Send-CC: autarch [...] urth.org
Nathan, This is probably just an oversight, have you tried changing it to false and running the test suite? If it passes without modification and Dave (on the CC) Rolsky's codebase doesn't have issues (I think he is currently the largest user of this module), then I see no reason to not fix it. It might also be worth checking the Erlang and Ruby implementations to see what they do here (I copied most of the implementation from those two versions). - Stevan On Wed Dec 31 07:39:11 2014, SMITHFARM wrote: Show quoted text
> The Web::Machine::Resource POD says that 'valid_content_headers' > defaults to false: > > valid_content_headers( $content_headers ) > > Parameter $content_header is a HASH ref of the Request headers that . > . . . > > If the request includes any invalid Content-* headers, this should > return > false, which will result in a '501 Not Implemented' response. > > Defaults to false. > > > In the source code of that module we have: > > sub valid_content_headers { 1 } > > which indicates that the documentation is wrong about this.
On Thu Jan 01 05:19:14 2015, STEVAN wrote: Show quoted text
> Nathan, > > This is probably just an oversight, have you tried changing it to > false and running the test suite? If it passes without modification > and Dave (on the CC) Rolsky's codebase doesn't have issues (I think he > is currently the largest user of this module), then I see no reason to > not fix it. > > It might also be worth checking the Erlang and Ruby implementations to > see what they do here (I copied most of the implementation from those > two versions). > > - Stevan > > > > > On Wed Dec 31 07:39:11 2014, SMITHFARM wrote:
> > The Web::Machine::Resource POD says that 'valid_content_headers' > > defaults to false: > > > > valid_content_headers( $content_headers ) > > > > Parameter $content_header is a HASH ref of the Request headers that . > > . . . > > > > If the request includes any invalid Content-* headers, this should > > return > > false, which will result in a '501 Not Implemented' response. > > > > Defaults to false. > > > > > > In the source code of that module we have: > > > > sub valid_content_headers { 1 } > > > > which indicates that the documentation is wrong about this.
I suspect this might be a case where the docs should be changed, not the code. It doesn't make much sense to me to default to false. AFAICT, all of the other boolean "can we continue" methods default to the value that causes the machine to continue. Defaulting to "stop" seems like a bad idea. It'd certainly break all of our code at work, since we haven't implemented this method in our services.
Show quoted text
> I suspect this might be a case where the docs should be changed, not > the code.
I was indeed suggesting just that. The relevant part of the Erlang code is, I believe: %% "Okay Content-* Headers?" decision(v3b6) -> decision_test(resource_call(valid_content_headers), true, v3b5, 501); which (I suppose) means that it defaults to true there as well. I did try changing the return value to false in the Web::Machine code and this does breaks the test suite. So, on the grounds that: a. the code is correct b. the documentation is wrong I am submitting a pull request with the documentation fix. Thanks! Nathan
For reference, here is the link to the (merged) PR:
https://github.com/stevan/webmachine-perl/pull/31

-- 
Olivier Mengué - http://perlresume.org/DOLMEN - https://gratipay.com/dolmen/