-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
clarification on httpdump example #25
Comments
Hi, Thank you for using goproxy. I don't think you're reading it correctly. What's happening is, the goproxy hook returns an The proxy is also responsible for closing the response after writing it to the client. You only have to worry about providing the response. Let me illustrate that with an example:
Let me know if you need any other clarification. |
On Sat, Nov 16, 2013 at 10:03 AM, Elazar Leibovich <notifications@github.com
Right and that file capture is done with the TeeReederCloser. I'd like to I've modified the TeeReederCloser.Close() to send on a channel I've
|
I'm not sure what exactly you want to achieve, but I don't think you have any other option. Note that That said, make sure the channel is buffered, you don't want to keep your goroutine waiting until the background job fires. Do you have a better design in mind? If there's a way |
I have a pool of workers that need to pull content from external sources ie. the wild internet. The workers do not have access to the internet and the workers will often pass over content more than once. I need a proxy that serves as a forward proxy to provide internet access to the workers. The same proxy can serve to intercept the content and forward to a storage layer which can be used for future fetches. I'm effectively building a large read-through cache, but one that's fully deconstructed. I've been getting by w/ squid and nginx, but I want more programmatic control of the proxy behavior. I don't think there's any better design, my questions so far are about my specific implementation. I'm new to golang; Thanks for the note about buffered channels. I keep forgetting that the writer blocks until the reader reads. I guess it's like a socket accept with no listen queue(sort of.) |
BTW, I assume there exists a "go func()" somewhere to provide the concurrency. Is there a goroutine per handler? |
@davidbirdsong I have almost no Is it possible for you to show me some of your code? Either privately or in the public? PS, If you could write me how well |
Is everything clear? Can I close the issue? |
Hey sorry, totally missed these notifications. Everything's much clearer now. I can share some of the code soon. |
I'm using httpdump.go as a reference implementation for a simple forward proxy I'm cooking up that will intercept responses and push them into another system.
I need to send something like the Meta struct down a channel when the response is fully consumed by the downstream client, but more importantly when the body has been consumed by TeeReadCloser.
When LogMeta executes here:
https://github.com/elazarl/goproxy/blob/master/examples/httpdump/httpdump.go#L140
...am I reading it correctly that NewTeeReader hasn't had a chance necessarily to flush the response stream to the FileStream?
Would I need to add a call into TeeReadCloser.Close() ?
The text was updated successfully, but these errors were encountered: