-
-
Notifications
You must be signed in to change notification settings - Fork 88
Comments
Conversation
src/Http/Request.php
Outdated
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.
IMHO rawbody should return rawbody, not parsed body
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.
? This commit does not change getRawBody() result.
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're using the same callback, that also parses the JSON for application/json, aren't you?
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.
Oh, you've added new parameter, sorry :)
Majkl578
commented
Feb 27, 2015
Although it's a nice closure magic, I'm afraid it's gonna be slow, it's not even lazy... I mean, those unnecessary body calls could be easily avoided if type check was extracted outside (like addBodyCallback('application/json', $cb)).
JanTvrdik
commented
Feb 27, 2015
@Majkl578 That's how I originally wanted to do it, but then I though that it is not powerful enough. What if you want to make decision based on something different than Content-Type (e.g. HTTP method)? What if you want to handle all something/* types? That being said I like the simple solution addBodyCallback('application/json', $cb) more than the current one.
(削除) Sidenote: it must somehow workaround the JSON decode DOS vulnerability. (削除ここまで)
1dc599c to
f35d20f
Compare
f73e5f9 to
48409af
Compare
JanTvrdik
commented
Jun 5, 2016
I think that this is now ready to merge.
48409af to
48a3e5f
Compare
src/Http/Request.php
Outdated
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.
indentation
48a3e5f to
6363c41
Compare
@JanTvrdik What about the JSON decode DOS vulnerability? I didn't see anything that would solve it in your code (but I might have missed it of course).
@enumag I ignore it the same way everybody in the PHP worlds ignores it. Those few that are concern may replace the body parser for JSON with sth smarter.
6363c41 to
1627f10
Compare
JanTvrdik
commented
Jun 5, 2016
BTW: PSR7 calls this method getParsedBody() instead of just getBody(). It is longer but a bit more descriptive.
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.
strcasecmp is better
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 mean strncasecmp?
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.
Yes. Its PHP shame that there is no startsWith function.
55488bd to
2042d2e
Compare
4960652 to
5e67add
Compare
689f4ae to
33aae19
Compare
09923de to
02ae846
Compare
dc02250 to
80e8e2b
Compare
No description provided.