Overview
Comment: | More features: * path substitution * more fields ignored in requests; * request now uses original path - not modified by stripping or substituting; * some headers are proxied to request; * when there is no file to send 502 error is returned; * recheck file before moving it to full dir; * Last-Modified only sent when present. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
cab908195f3b29791b79f2137ba2e7f4 |
User & Date: | c.kworr@b84a3442-36b4-a7b2-c7ad-07429f13c525 on 2010-09-06 20:53:47.000 |
Other Links: | branch diff | manifest | tags |
Context
2010-09-07
| ||
11:24 | Some changes: * one more header known; * new code to select which parts of file should be downloaded, fixes (possibly) a very bad bug that makes continuing download totally unsable. check-in: 439e1753a4 user: c.kworr@b84a3442-36b4-a7b2-c7ad-07429f13c525 tags: master, trunk | |
2010-09-06
| ||
20:53 | More features: * path substitution * more fields ignored in requests; * request now uses original path - not modified by stripping or substituting; * some headers are proxied to request; * when there is no file to send 502 error is returned; * recheck file before moving it to full dir; * Last-Modified only sent when present. check-in: cab908195f user: c.kworr@b84a3442-36b4-a7b2-c7ad-07429f13c525 tags: master, trunk | |
2010-08-26
| ||
15:06 | optimized remains detection check-in: b0975a28fb user: c.kworr@b84a3442-36b4-a7b2-c7ad-07429f13c525 tags: master, trunk | |
Changes
Modified samesite.py
from [ed1a5254d3]
to [f557383e69].
︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | + + | 'general': { 'port': '8008', }, '_other': { 'verbose': 'no', 'noetag': 'no', 'noparts': 'no', 'strip': '', 'sub': '', },} # function to read in config file def __init__(self): import configparser, optparse parser = optparse.OptionParser() |
︙ | |||
70 71 72 73 74 75 76 | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | - - + + + + + + + + + + | self._config.set(self._section, name, None) return(self._config.get(self._section, name)) config = Config() #assert options.port or os.access(options.log, os.R_OK), 'Log file unreadable' |
︙ | |||
191 192 193 194 195 196 197 | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | - + + + + + + - - + + + + - + - + | recheck = False # file_stat means file definitely exists file_stat = None # requested_ranges holds data about any range requested requested_ranges = None # records holds data from index locally, should be written back upon successfull completion record = None |
︙ | |||
269 270 271 272 273 274 275 | 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | - - | file_stat = os.stat(temp_name) else: info += '\nFile not found or inaccessible.' index[my_path]['_parts'] = None reload = True record = index[my_path] |
︙ | |||
298 299 300 301 302 303 304 | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | - + + + + + + + + - + | if not recheck and not reload and '_time' in record and (datetime.datetime.now() - datetime.timedelta(hours = 4) - record['_time']).days < 0: recheck = True print(info) if reload or recheck: try: |
︙ | |||
433 434 435 436 437 438 439 | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | - + + + + + + | 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) |
︙ | |||
468 469 470 471 472 473 474 | 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | + - + | break ranges += '{}-{}'.format(pair[0], str(pair[1] - 1)), self.send_header('Content-Range', 'bytes {}/{}'.format(','.join(ranges), index[my_path]['Content-Length'])) else: self.send_response(200) self.send_header('Content-Length', str(file_stat.st_size)) requested_ranges = spacemap.SpaceMap({0: file_stat.st_size}) if 'Last-Modified' in index[my_path]: |
︙ |