-
Notifications
You must be signed in to change notification settings - Fork 3.9k
netty: Netty server poorly handles unknown content type #3735
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
netty: Netty server poorly handles unknown content type #3735
Conversation
ejona86
left a comment
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.
Looks pretty good. Just one easy change. Thanks!
| // Remove the leading slash of the path and get the fully qualified method name | ||
| CharSequence path = headers.path(); | ||
| if (path.charAt(0) != '/') { | ||
| respondWithHttpError(ctx, streamId, 404, Status.Code.UNIMPLEMENTED, |
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.
The 404 case should be first. If both content-type and path are wrong, we should respond with 404.
|
moved the path check up to return 404 early. Added explicit |
| return; | ||
| } | ||
|
|
||
| String method = path.subSequence(1, path.length()).toString(); |
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.
nit: path.substring()
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.
path is a CharSequence, so it doesn't have substring.
| String method = path.subSequence(1, path.length()).toString(); | ||
|
|
||
| // Verify that the Content-Type is correct in the request. | ||
| verifyContentType(streamId, headers); |
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.
Oops. I didn't delete these methods. They're now unused: determineMethod, verifyContentType
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.
I went ahead and deleted them, since it was trivial.
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.
@ejona86 great..thanks..I should have done it my self. Did not pay attention. Sorry :-)
|
@ramaraochavali, thank you! |
PR for #3370