Samesite - proxy that can cache partial transfers

Hex Artifact Content
anonymous

Hex Artifact Content

Artifact d7b006a56b72b0205f286b455cb5aa3f1d93ce7ac44cb4b5bf84444243d15f3f:


0000: 53 6f 6d 65 20 74 68 69 6e 67 73 20 49 20 73 68  Some things I sh
0010: 6f 75 6c 64 20 74 61 6b 65 20 63 61 72 65 20 61  ould take care a
0020: 62 6f 75 74 3a 0a 0a 20 2a 20 49 66 2d 28 55 6e  bout:.. * If-(Un
0030: 6d 7c 4d 29 6f 64 69 66 69 65 64 2d 53 69 6e 63  m|M)odified-Sinc
0040: 65 0a 54 68 69 73 20 6f 6e 65 20 69 73 20 74 6f  e.This one is to
0050: 74 61 6c 6c 79 20 69 67 6e 6f 72 65 64 2e 20 43  tally ignored. C
0060: 6f 64 65 20 73 68 6f 75 6c 64 20 62 65 20 61 64  ode should be ad
0070: 64 65 64 20 74 6f 20 63 6f 72 72 65 63 74 6c 79  ded to correctly
0080: 20 72 65 74 75 72 6e 20 33 30 34 2e 0a 0a 20 2a   return 304... *
0090: 20 4d 75 6c 74 69 70 6c 65 20 62 79 74 65 20 72   Multiple byte r
00a0: 61 6e 67 65 73 0a 54 6f 74 61 6c 6c 79 20 75 6e  anges.Totally un
00b0: 73 75 70 70 6f 72 74 65 64 20 62 75 74 20 72 65  supported but re
00c0: 71 75 65 73 74 65 64 20 77 69 74 68 20 6d 75 6c  quested with mul
00d0: 74 69 70 6c 65 20 62 79 74 65 20 72 61 6e 67 65  tiple byte range
00e0: 73 20 63 61 6e 20 62 65 20 67 65 6e 65 72 61 74  s can be generat
00f0: 65 64 2e 0a 0a 20 2a 20 48 61 6e 64 6c 69 6e 67  ed... * Handling
0100: 20 6f 66 20 66 69 6c 65 73 20 77 69 74 68 6f 75   of files withou
0110: 74 20 43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68  t Content-Length
0120: 0a 54 68 6f 73 65 20 6f 6e 65 73 20 77 6f 75 6c  .Those ones woul
0130: 64 6e 27 74 20 77 6f 72 6b 20 6e 6f 77 2e 0a 0a  dn't work now...
0140: 20 2a 20 47 65 74 20 70 69 65 63 65 20 6f 66 20   * Get piece of 
0150: 66 69 6c 65 20 77 68 65 6e 20 69 73 73 75 69 6e  file when issuin
0160: 67 20 61 20 48 45 41 44 20 72 65 71 75 65 73 74  g a HEAD request
0170: 0a 57 68 79 20 6e 6f 74 3f 20 54 68 69 73 20 77  .Why not? This w
0180: 61 79 20 77 65 20 77 69 6c 6c 20 73 69 6c 65 6e  ay we will silen
0190: 74 6c 79 20 63 6f 6d 70 6c 65 74 65 20 61 6c 6c  tly complete all
01a0: 20 6f 66 20 74 68 65 20 70 61 72 74 69 61 6c 20   of the partial 
01b0: 66 69 6c 65 73 2e 0a 0a 20 2a 20 46 69 6c 65 20  files... * File 
01c0: 72 65 63 68 65 63 6b 0a 43 75 72 72 65 6e 74 6c  recheck.Currentl
01d0: 79 20 77 68 65 6e 20 66 69 6c 65 20 69 73 20 66  y when file is f
01e0: 75 6c 6c 79 20 64 6f 77 6e 6c 6f 61 64 65 64 20  ully downloaded 
01f0: 69 74 20 67 65 74 73 20 73 74 6f 72 65 64 20 69  it gets stored i
0200: 6e 20 72 65 61 6c 20 66 69 6c 65 20 74 72 65 65  n real file tree
0210: 20 74 6f 20 62 65 20 73 65 72 76 65 64 20 62 79   to be served by
0220: 20 70 72 6f 64 75 63 74 69 6f 6e 2d 67 72 61 64   production-grad
0230: 65 20 77 65 62 2d 73 65 72 76 65 72 2e 20 54 68  e web-server. Th
0240: 69 73 20 77 61 79 20 77 65 20 77 69 6c 6c 20 6e  is way we will n
0250: 65 76 65 72 20 73 65 65 20 61 6e 79 20 72 65 71  ever see any req
0260: 75 65 73 74 73 20 74 6f 20 74 68 61 74 20 66 69  uests to that fi
0270: 6c 65 2e 20 46 69 6e 64 69 6e 67 20 6f 6c 64 65  le. Finding olde
0280: 73 74 20 6f 6e 65 73 20 61 6e 64 20 6d 6f 76 69  st ones and movi
0290: 6e 67 20 74 68 65 6d 20 74 6f 20 2e 70 61 72 74  ng them to .part
02a0: 73 20 77 6f 75 6c 64 20 73 75 66 66 69 63 65 2e  s would suffice.
02b0: 0a 0a 20 2a 20 46 69 6c 65 20 74 69 6d 65 0a 43  .. * File time.C
02c0: 75 72 72 65 6e 74 6c 79 20 77 68 65 6e 20 66 69  urrently when fi
02d0: 6c 65 20 69 73 20 64 6f 77 6e 6c 6f 61 64 65 64  le is downloaded
02e0: 20 69 74 20 67 65 74 73 20 63 75 72 72 65 6e 74   it gets current
02f0: 20 74 69 6d 65 2c 20 6e 6f 74 20 74 68 65 20 74   time, not the t
0300: 69 6d 65 20 69 6e 20 4c 61 73 74 2d 4d 6f 64 69  ime in Last-Modi
0310: 66 69 65 64 2e 0a                                fied..