N
Nokan Emiro
[Note: parts of this message were removed to make it a legal post.]
Hi,
could somebody please show me what can I do
to prevent WEBrick::HTTPProxyServer from
accessing the webserver on special cases? There
are cases when the proxy already knows in the
RequestCallback procedure that the content on
the webserver is irrelevant to the data sent back
to the browser. Think about a http proxy, that
has a list of URLs that should be blocked, or
think about a caching proxy, that does not need
to contact the webserver if the content is already
available in the RequestCallback phase:
require 'webrick/httpproxy'
server = WEBrick::HTTPProxyServer.new(
ort => 8080,
:RequestCallback => Proc.new do |req, res|
if ## condition ##
## what to do here to prevent http req? ##
end
end
)
server.start
What can I do between the "if" and "end" to throw back
a content to the browser? For example if I have a $cache,
that contains the cached html code:
if $cache.has_key?(req.request_uri)
# how to send back here $cache[req.request_uri] asap?
end
Hi,
could somebody please show me what can I do
to prevent WEBrick::HTTPProxyServer from
accessing the webserver on special cases? There
are cases when the proxy already knows in the
RequestCallback procedure that the content on
the webserver is irrelevant to the data sent back
to the browser. Think about a http proxy, that
has a list of URLs that should be blocked, or
think about a caching proxy, that does not need
to contact the webserver if the content is already
available in the RequestCallback phase:
require 'webrick/httpproxy'
server = WEBrick::HTTPProxyServer.new(
ort => 8080,
:RequestCallback => Proc.new do |req, res|
if ## condition ##
## what to do here to prevent http req? ##
end
end
)
server.start
What can I do between the "if" and "end" to throw back
a content to the browser? For example if I have a $cache,
that contains the cached html code:
if $cache.has_key?(req.request_uri)
# how to send back here $cache[req.request_uri] asap?
end