Skip to content
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 send method to Response<Fresh> #446

Closed
seanmonstar opened this issue Apr 10, 2015 · 0 comments · Fixed by #514
Closed

Add send method to Response<Fresh> #446

seanmonstar opened this issue Apr 10, 2015 · 0 comments · Fixed by #514
Labels
A-server Area: server. E-easy Effort: easy. A task that would be a great starting point for a new contributor.

Comments

@seanmonstar
Copy link
Member

This method would be a guaranteed single write, so we could set the Content-Length header, write the body, and then end() the request.

Basically:

impl Response<Fresh> {
    fn send(self, buf: &[u8]) -> io::Result<usize> {
        self.headers.set(ContentLength(buf.len()));
        try!(self.body.write_all(buf));
        self.end();
        Ok(buf.len())
    }
}
@seanmonstar seanmonstar added A-server Area: server. E-easy Effort: easy. A task that would be a great starting point for a new contributor. labels Apr 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-server Area: server. E-easy Effort: easy. A task that would be a great starting point for a new contributor.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant