Samesite - proxy that can cache partial transfers

Diff
anonymous

Diff

Differences From Artifact [27249f8e3f]:

To Artifact [bcbeab4897]:


107
108
109
110
111
112
113
114

115
116
117
118
119
120
121
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',
			'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
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'):
				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
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(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.')