-
Notifications
You must be signed in to change notification settings - Fork 173
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(http server): handle post and option HTTP requests properly. #637
Conversation
http-server/src/server.rs
Outdated
@@ -302,116 +302,25 @@ impl<M: Middleware> Server<M> { | |||
// two cases: a single RPC request or a batch of RPC requests. | |||
async move { | |||
if let Err(e) = access_control_is_valid(&access_control, &request) { |
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 became hard to review, however validate origins and headers before checking the method kind.
@@ -469,3 +375,110 @@ fn is_json(content_type: Option<&hyper::header::HeaderValue>) -> bool { | |||
_ => false, | |||
} | |||
} | |||
|
|||
/// Process a verified request, it implies a POST request with content type JSON. | |||
async fn process_validated_request( |
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.
move to a separate function to decrease the indentation level and become more readable...
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.
Nice!
…tech/jsonrpsee into na-fix-http-server-options-method
Partly fixes #628