Samesite - proxy that can cache partial transfers

Check-in [44aa59eb58]
anonymous

Check-in [44aa59eb58]

Overview
Comment:header fixes, header name fixes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: 44aa59eb58fab6a330427b49d650821ef51973b44d7f04645443e8ed63a87bd7
User & Date: arcade@b1t.name on 2012-08-09 11:23:41.000
Other Links: branch diff | manifest | tags
Context
2012-08-09
11:30
correct etag name check-in: b67d2538b2 user: arcade@b1t.name tags: master, trunk
11:23
header fixes, header name fixes check-in: 44aa59eb58 user: arcade@b1t.name tags: master, trunk
2012-08-07
18:00
move to python3.2, bsddb3 check-in: d8731957ad user: arcade@b1t.name tags: master, trunk
Changes
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
			'Accept', 'Accept-Charset', 'Accept-Encoding', 'Accept-Language',
			'Cache-Control', 'Connection', 'Content-Length', 'Cookie',
			'Host',
			'If-Modified-Since', 'If-Unmodified-Since',
			'Referer',
			'Ua-Cpu', 'User-Agent',
			'Via',
			'X-Forwarded-For', 'X-Last-Hr', 'X-Last-Http-Status-Code', 'X-Removed', 'X-Real-Ip', 'X-Retry-Count',
		])

		print('===============[ {} request ]==='.format(self.command))

		for header in self.headers:
			if header in proxy_ignored:
				pass







|







107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
			'Accept', 'Accept-Charset', 'Accept-Encoding', 'Accept-Language',
			'Cache-Control', 'Connection', 'Content-Length', 'Cookie',
			'Host',
			'If-Modified-Since', 'If-Unmodified-Since',
			'Referer',
			'Ua-Cpu', 'User-Agent',
			'Via',
			'X-Forwarded-For', 'X-Last-HR', 'X-Last-HTTP-Status-Code', 'X-Old-UID', 'X-Removed', 'X-Real-IP', 'X-Retry-Count',
		])

		print('===============[ {} request ]==='.format(self.command))

		for header in self.headers:
			if header in proxy_ignored:
				pass
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201

		print(info)
		if reload or recheck:

			try:
				request = config_host['proto'] + '://' + config_host['root'] + self.path
				my_headers = {}
				for header in ('Cache-Control', 'Cookie', 'Referer', 'User-Agent'):
					if header in self.headers:
						my_headers[header] = self.headers[header]

				needed = None
				if self.command not in ('HEAD'):
					if '_parts' in record and record['_parts'] != None:
						if config_host['noparts'] != 'no' or requested_ranges == None or requested_ranges == spacemap.SpaceMap():







|







187
188
189
190
191
192
193
194
195
196
197
198
199
200
201

		print(info)
		if reload or recheck:

			try:
				request = config_host['proto'] + '://' + config_host['root'] + self.path
				my_headers = {}
				for header in ('Accept', 'Cache-Control', 'Cookie', 'Referer', 'User-Agent'):
					if header in self.headers:
						my_headers[header] = self.headers[header]

				needed = None
				if self.command not in ('HEAD'):
					if '_parts' in record and record['_parts'] != None:
						if config_host['noparts'] != 'no' or requested_ranges == None or requested_ranges == spacemap.SpaceMap():
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349

				index[my_path_b] = new_record
				index.sync()

			except urllib.error.HTTPError as error:
				# in case of error we don't need to do anything actually,
				# if file download stalls or fails the file would not be moved to it's location
				print(error)

		print(index[my_path_b])

		if not os.access(file_name, os.R_OK) and os.access(temp_name, os.R_OK) and '_parts' in index[my_path_b] and index[my_path_b]['_parts'] == spacemap.SpaceMap():
			# just moving
			# drop old dirs XXX
			print('Moving temporary file to new destination.')







|







335
336
337
338
339
340
341
342
343
344
345
346
347
348
349

				index[my_path_b] = new_record
				index.sync()

			except urllib.error.HTTPError as error:
				# in case of error we don't need to do anything actually,
				# if file download stalls or fails the file would not be moved to it's location
				print(error, repr(my_headers))

		print(index[my_path_b])

		if not os.access(file_name, os.R_OK) and os.access(temp_name, os.R_OK) and '_parts' in index[my_path_b] and index[my_path_b]['_parts'] == spacemap.SpaceMap():
			# just moving
			# drop old dirs XXX
			print('Moving temporary file to new destination.')