-
Notifications
You must be signed in to change notification settings - Fork 419
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
Enforce request cardinality for unary-request calls also for the case of zero request messages being sent. #392
Conversation
… of zero request messages being sent. Otherwise, the server will never respond to a call that gets closed without the client sending a response.
/cc @glbrntt for review (can't request a review for you through the GitHub "Reviewers" list for some reason) |
…- it's easier to test this via HTTP1 than having to set up an HTTP2 client.
@glbrntt I've slightly extended the scope of this PR; please take another look. |
Sources/SwiftGRPCNIO/CallHandlers/BidirectionalStreamingCallHandler.swift
Show resolved
Hide resolved
|
||
private func gRPCWebOKTrailers() -> Data { | ||
var data = "grpc-status: 0\r\ngrpc-message: OK".data(using: .utf8)! | ||
|
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.
Revert
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 like there's still trailing whitespace here
@rebello95 please take another look, especially at the unresolved conversations. Feel free to squash-and-merge if you are satisfied with the current revision. |
|
||
private func gRPCWebOKTrailers() -> Data { | ||
var data = "grpc-status: 0\r\ngrpc-message: OK".data(using: .utf8)! | ||
|
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 like there's still trailing whitespace here
Looks like I forgot to actually commit and push my fixes, sorry about that! @rebello95, please take one final look. |
Otherwise, the server will never respond to a call that gets closed without the client sending a response.
In addition, we introduce a method
sendErrorStatus
(happy to discuss naming) onBaseCallHandler
that sends an error status to the client while ensuring that all call context promises are fulfilled. This method is required (and needs to be overridden) because only the concrete call subclass knows which promises need to be fulfilled.