New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix case where POST body is the single character "0". #133
Conversation
This looks good to me, any idea why the CI tests are failing? |
Hm, no. I'll see if I can get the test environment going here and replicate the problem. I'm actually not sure if the defined test is completely correct; it might be safer to check for '' since there are places in the code where '' is assigned (but they may come after the initial initialization where this problem crops up). |
I pulled your change locally to see if the failure is CI specific and got the same failure. |
I think the issue is that it's only checking |
Right; I noticed that there are other cases in the existing code that has the defined check. I can go thru and make a PR using the empty check instead.
|
It would be nice if you can add a unit test to illustrate the original problem (where content body is "0"). |
OK - I'll try to do that as well. |
Add single_zero.t for testing this case. Note that in the failure case it hangs; I don't know the test-fu for properly handling that.
OK, my latest code has a new test single_zero.t that works with the new code as do all the other tests. However in the failure case it just hangs; I’m not sure how you properly handle that in the test harness.
On May 20, 2019, at 2:05 PM, Tatsuhiko Miyagawa <notifications@github.com<mailto:notifications@github.com>> wrote:
It would be nice if you can add a unit test to illustrate the original problem (where content body is "0").
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#133?email_source=notifications&email_token=AAQNOITOSYDYATXFWG57PE3PWLY7LA5CNFSM4HNXD7FKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVZY6RY#issuecomment-494112583>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AAQNOIWAYDZALD5ZK4CBZXTPWLY7LANCNFSM4HNXD7FA>.
|
$ENV{PLACK_SERVER} = 'Starman'; | ||
|
||
my $app = sub { | ||
my $env = shift; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should probably check if $req->content
is "0"
Like that? |
thanks! |
This patch fixes the case where a POST request is the single character "0" (zero). Stock starman will hang in that case trying to read from a stream which will contain no more data.