into a situation where my go program needs to take an incoming file upload
from a user and stream it in real time to N other HTTP servers. I can't
wait until the user finishes sending his file - I need to stream the data
to the HTTP servers as it comes in from the user. What I'd really like is
an io.Writer interface to http.Client or http.Request, but I can't find the
best way to do it.
The only way to send a POST body using the http package seems to be by
assigning an io.ReadCloser to a new http.Request object. I could implement
a ReadCloser that reads data off the file upload stream and feeds it to the
http client (or better yet, pass the original file upload Request.Body
directly into the new Request), but this doesn't work as well when I want
to duplicate the stream to multiple file servers with throttling and
monitoring of the transfers.
The ideal interface that I can imagine is an io.Writer interface to the TCP
connections, where I copy a byte for each HTTP server transfer. But if I
do that, do I have to completely stop using the http package and manage the
entire http connection myself?
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to email@example.com.
For more options, visit https://groups.google.com/d/optout.