-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
add support for 100-continue in HTTP::Server::Response #6912
Conversation
23add65
to
76dc76c
Compare
Go's webserver implementation doesn't provide a means to send 100 Continue explicitly, but it automatically sends the continue header when Copying this might even be more useful since it just works with any handler and doesn't require any custom logic. |
@straight-shoota That is perfect! |
904b7b4
to
e453c1a
Compare
I noticed there is an issue when the handler doesn't read from the IO and |
Actually, I'm not entirely sure why But I can't see how that is actually useful, and at least, it is confusing to the user. It doesn't just close the IO in it's current state but completely consumes it until the sender is done (maybe a happy |
@straight-shoota i agree. this is weird indeed. But I think it should be a seperate issue. |
src/http/content.cr
Outdated
skip_to_end | ||
super | ||
end | ||
|
||
def expects_continue=(value : Bool) |
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.
Perhaps cleaner: property? expects_continue : Bool
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.
👍
src/http/content.cr
Outdated
skip_to_end | ||
super | ||
end | ||
|
||
protected def ensure_send_continue | ||
return unless @expects_continue && !@continue_sent |
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.
return unless @expects_continue
return if @continue_sent
spec/std/http/server/server_spec.cr
Outdated
address = server.bind_unused_port | ||
spawn { server.listen } | ||
|
||
Fiber.yield |
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.
Please adjust this according to #6953
@jreinert needs a format |
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.
Just one last thing.
src/http/content.cr
Outdated
@io.peek | ||
end | ||
|
||
def skip(bytes_count) | ||
enensure_send_continue |
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.
ooops
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.
uh jezzus.. i should sleep more. xD
4b55742
to
670224d
Compare
src/http/content.cr
Outdated
@io.peek | ||
end | ||
|
||
def skip(bytes_count) | ||
enensure_send_continue |
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.
One en
too much.
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 don't... even..
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.
Relax, that happens, especially when there's lack of sleep involved :) I'd just advise "proofreading" your PRs before submitting ;)
No description provided.