Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 365636 Details for
Bug 494698
net-proxy/http-replicator - add --exclude option to exclude specific hosts from caching
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
net-proxy/http-replicator-3.0-r3 patch
exclude-hosts.patch (text/plain), 3.28 KB, created by
thelan
on 2013-12-18 23:19:27 UTC
(
hide
)
Description:
net-proxy/http-replicator-3.0-r3 patch
Filename:
MIME Type:
Creator:
thelan
Created:
2013-12-18 23:19:27 UTC
Size:
3.28 KB
patch
obsolete
>--- a/http-replicator_3.0/http-replicator 2007-07-01 22:33:52.000000000 +0200 >+++ b/http-replicator_3.0/http-replicator 2013-12-18 22:45:35.132609095 +0100 >@@ -89,6 +89,8 @@ > chunk = 65536 # maximum number of bytes to read and write in one chunk > maxhead = 600 # maximum line length in the http header to prevent server attacks > alias = {} # alternative cache dirs for special hosts >+ cancache = True >+ exclude = ['127.0.0.1'] > > id = 0 # instance identification number > pointer = 0 # data write position >@@ -114,6 +116,7 @@ > if counterpart: # counterpart is present > self.counterpart = counterpart # set up reference > self.id = counterpart.id # use same id >+ self.cancache = counterpart.cancache > else: # no counterpart > self.id = Http.id = Http.id + 1 # use next available id > self.log = logging.getLogger('%s %i' % (self.__class__.__name__, self.id)) # create a logger for this instance >@@ -261,6 +264,11 @@ > body.pop('proxy-connection', None) > body.pop('accept-encoding', None) # no support for content encodings > body.pop('proxy-authorization', None) >+ >+ if host.lower() in self.exclude: >+ self.log.info('host %s is excluded from cache', host.lower()) >+ self.cancache = False >+ > if not self.external: # direct connection to remote host > head[1] = path # transform absolute url to a relative one > elif self.external_auth: # proxy requires authorization >@@ -510,6 +518,10 @@ > finally: > self.data.seek(0,2) # move to end of file > >+ if self.cancache == False: >+ self.log.info('file not cached: config says so!') >+ return False >+ > self.prepare_path(self.path) # create directories > open(self.path, 'w').writelines(chunks) # write file to cache > >@@ -549,6 +561,7 @@ > parser = optparse.OptionParser() > parser.add_option('-p', '--port', type='int', default=8080, help='listen on PORT for incoming connections') > parser.add_option('-i', '--ip', action='append', default=['127.0.0.1'], help='allow connections from these IP addresses') >+ parser.add_option('-x', '--exclude', action='append', default=['127.0.0.1'], help='do not cache theses domains') > parser.add_option('-d', '--dir', type='string', default=os.curdir, help='cache in DIR instead of current directory') > parser.add_option('-a', '--alias', metavar='STR', action='append', default=[], help='cache in path:url1:url2:...') > parser.add_option('-s', '--static', action='store_true', help='never check for modifications') >@@ -579,6 +592,8 @@ > dir = aliases.pop(0) > for alias in aliases: > Http.alias[alias] = dir # build alias dictionary >+ if options.host: >+ Http.exclude = options.exclude > if options.static: > Http.static = True > if options.flat:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 494698
: 365636