Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 494698
Collapse All | Expand All

(-)file_not_specified_in_diff (-1 / +16 lines)
Line  Link Here
0
-- a/http-replicator_3.0/http-replicator       2007-07-01 22:33:52.000000000 +0200
0
++ b/http-replicator_3.0/http-replicator       2013-12-18 22:45:35.132609095 +0100
Lines 89-94 Link Here
89
       chunk = 65536 # maximum number of bytes to read and write in one chunk
89
       chunk = 65536 # maximum number of bytes to read and write in one chunk
90
       maxhead = 600 # maximum line length in the http header to prevent server attacks
90
       maxhead = 600 # maximum line length in the http header to prevent server attacks
91
       alias = {} # alternative cache dirs for special hosts
91
       alias = {} # alternative cache dirs for special hosts
92
       cancache = True
93
       exclude = ['127.0.0.1']
92
       id = 0 # instance identification number
94
       id = 0 # instance identification number
93
       pointer = 0 # data write position
95
       pointer = 0 # data write position
Lines 114-119 Link Here
114
               if counterpart: # counterpart is present
116
               if counterpart: # counterpart is present
115
                       self.counterpart = counterpart # set up reference
117
                       self.counterpart = counterpart # set up reference
116
                       self.id = counterpart.id # use same id
118
                       self.id = counterpart.id # use same id
119
                       self.cancache = counterpart.cancache
117
               else: # no counterpart
120
               else: # no counterpart
118
                       self.id = Http.id = Http.id + 1 # use next available id
121
                       self.id = Http.id = Http.id + 1 # use next available id
119
               self.log = logging.getLogger('%s %i' % (self.__class__.__name__, self.id)) # create a logger for this instance
122
               self.log = logging.getLogger('%s %i' % (self.__class__.__name__, self.id)) # create a logger for this instance
Lines 261-266 Link Here
261
                       body.pop('proxy-connection', None)
264
                       body.pop('proxy-connection', None)
262
                       body.pop('accept-encoding', None) # no support for content encodings
265
                       body.pop('accept-encoding', None) # no support for content encodings
263
                       body.pop('proxy-authorization', None)
266
                       body.pop('proxy-authorization', None)
267
268
                       if host.lower() in self.exclude:
269
                               self.log.info('host %s is excluded from cache', host.lower())
270
                               self.cancache = False
271
264
                       if not self.external: # direct connection to remote host
272
                       if not self.external: # direct connection to remote host
265
                               head[1] = path # transform absolute url to a relative one
273
                               head[1] = path # transform absolute url to a relative one
266
                       elif self.external_auth: # proxy requires authorization
274
                       elif self.external_auth: # proxy requires authorization
Lines 510-515 Link Here
510
               finally:
518
               finally:
511
                       self.data.seek(0,2) # move to end of file
519
                       self.data.seek(0,2) # move to end of file
520
               if self.cancache == False:
521
                       self.log.info('file not cached: config says so!')
522
                       return False
523
512
               self.prepare_path(self.path) # create directories
524
               self.prepare_path(self.path) # create directories
513
               open(self.path, 'w').writelines(chunks) # write file to cache
525
               open(self.path, 'w').writelines(chunks) # write file to cache
Lines 549-554 Link Here
549
       parser = optparse.OptionParser()
561
       parser = optparse.OptionParser()
550
       parser.add_option('-p', '--port', type='int', default=8080, help='listen on PORT for incoming connections')
562
       parser.add_option('-p', '--port', type='int', default=8080, help='listen on PORT for incoming connections')
551
       parser.add_option('-i', '--ip', action='append', default=['127.0.0.1'], help='allow connections from these IP addresses')
563
       parser.add_option('-i', '--ip', action='append', default=['127.0.0.1'], help='allow connections from these IP addresses')
564
       parser.add_option('-x', '--exclude', action='append', default=['127.0.0.1'], help='do not cache theses domains')
552
       parser.add_option('-d', '--dir', type='string', default=os.curdir, help='cache in DIR instead of current directory')
565
       parser.add_option('-d', '--dir', type='string', default=os.curdir, help='cache in DIR instead of current directory')
553
       parser.add_option('-a', '--alias', metavar='STR', action='append', default=[], help='cache in path:url1:url2:...')
566
       parser.add_option('-a', '--alias', metavar='STR', action='append', default=[], help='cache in path:url1:url2:...')
554
       parser.add_option('-s', '--static', action='store_true', help='never check for modifications')
567
       parser.add_option('-s', '--static', action='store_true', help='never check for modifications')
Lines 579-584 Link Here
579
               dir = aliases.pop(0)
592
               dir = aliases.pop(0)
580
               for alias in aliases:
593
               for alias in aliases:
581
                       Http.alias[alias] = dir # build alias dictionary
594
                       Http.alias[alias] = dir # build alias dictionary
595
       if options.host:
596
               Http.exclude = options.exclude
582
       if options.static:
597
       if options.static:
583
               Http.static = True
598
               Http.static = True
584
       if options.flat:
599
       if options.flat:

Return to bug 494698