Index: trunk/extensions/SwiftMedia/wmf/rewrite.py |
— | — | @@ -98,7 +98,6 @@ |
99 | 99 | self.key = conf['key'].strip() |
100 | 100 | self.thumbhost = conf['thumbhost'].strip() |
101 | 101 | self.writethumb = 'writethumb' in conf |
102 | | - self.user_agent = conf['user_agent'].strip() |
103 | 102 | self.bind_port = conf['bind_port'].strip() |
104 | 103 | self.shard_containers = conf['shard_containers'].strip() #all, some, none |
105 | 104 | if (self.shard_containers == 'some'): |
— | — | @@ -121,7 +120,10 @@ |
122 | 121 | # upload doesn't like our User-agent, otherwise we could call it |
123 | 122 | # using urllib2.url() |
124 | 123 | opener = urllib2.build_opener() |
125 | | - opener.addheaders = [('User-agent', self.user_agent)] |
| 124 | + # Pass on certain headers from the caller squid to the scalers |
| 125 | + for header_to_pass in ['X-Forwarded-For', 'X-Original-URI', 'User-Agent']: |
| 126 | + if reqorig.headers.get( header_to_pass ) != None: |
| 127 | + opener.addheaders[header_to_pass] = reqorig.headers.get( header_to_pass ) |
126 | 128 | # At least in theory, we shouldn't be handing out links to originals |
127 | 129 | # that we don't have (or in the case of thumbs, can't generate). |
128 | 130 | # However, someone may have a formerly valid link to a file, so we |