Samesite - proxy that can cache partial transfers

Check-in [62e6d8a7ab]
anonymous

Check-in [62e6d8a7ab]

Overview
Comment:gzip support
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: 62e6d8a7ab49c2c3eb75ee0c4c9c78b9f1426031b8db4649104cfaedab150dc3
User & Date: c.kworr@b84a3442-36b4-a7b2-c7ad-07429f13c525 on 2012-01-16 10:26:29.000
Other Links: branch diff | manifest | tags
Context
2012-01-16
10:29
wrong dictionary initialised check-in: 31a8af9ff1 user: c.kworr@b84a3442-36b4-a7b2-c7ad-07429f13c525 tags: master, trunk
10:26
gzip support check-in: 62e6d8a7ab user: c.kworr@b84a3442-36b4-a7b2-c7ad-07429f13c525 tags: master, trunk
2012-01-04
07:45
unwind last update and bring a better fix check-in: b5c328f916 user: c.kworr@b84a3442-36b4-a7b2-c7ad-07429f13c525 tags: master, trunk
Changes
242
243
244
245
246
247
248

249
250
251
252
253
254





255
256
257
258
259
260
261
						while True:
							range = needed.pop()
							if range[0] == None:
								break
							ranges += '{}-{}'.format(range[0], range[1] - 1),
						my_headers['range'] = 'bytes=' + ','.join(ranges)


				request = urllib2.Request(request, headers = my_headers)

				source = urllib2.urlopen(request)
				new_record = {}
				new_record['_parts'] = record['_parts']
				headers = source.info()






				# stripping unneeded headers (XXX make this inplace?)
				for header in headers:
					if header in desc_fields:
						#if header == 'Pragma' and headers[header] != 'no-cache':
						if header == 'content-length':
							if 'content-range' not in headers:







>






>
>
>
>
>







242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
						while True:
							range = needed.pop()
							if range[0] == None:
								break
							ranges += '{}-{}'.format(range[0], range[1] - 1),
						my_headers['range'] = 'bytes=' + ','.join(ranges)

				headers['Accept-Encoding'] = 'gzip'
				request = urllib2.Request(request, headers = my_headers)

				source = urllib2.urlopen(request)
				new_record = {}
				new_record['_parts'] = record['_parts']
				headers = source.info()

				if 'content-encoding' in headers and headers['content-encoding'] == 'gzip':
					import gzip, StringIO
					buf = StringIO.StringIO(source.read())
					source = gzip.GzipFile(fileobj=buf)

				# stripping unneeded headers (XXX make this inplace?)
				for header in headers:
					if header in desc_fields:
						#if header == 'Pragma' and headers[header] != 'no-cache':
						if header == 'content-length':
							if 'content-range' not in headers:
325
326
327
328
329
330
331

332
333
334
335
336
337
338
							pass
						os.renames(empty_name, temp_name)
					temp_file = open(temp_name, 'r+b')
					if requested_ranges == None and needed == None:
						needed = new_record['_parts']
					needed.rewind()
					while True:

						(start, end) = needed.pop()
						if start == None:
							break
						stream_last = start
						old_record = copy.copy(new_record)
						if end - start < block_size:
							req_block_size = end - start







>







331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
							pass
						os.renames(empty_name, temp_name)
					temp_file = open(temp_name, 'r+b')
					if requested_ranges == None and needed == None:
						needed = new_record['_parts']
					needed.rewind()
					while True:
						# XXX can make this implicit - one request per range
						(start, end) = needed.pop()
						if start == None:
							break
						stream_last = start
						old_record = copy.copy(new_record)
						if end - start < block_size:
							req_block_size = end - start