Overview
Comment: | small fix for striping unneeded request parts from file path |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d0071bdbc7b3fc6eba1a3b36b7ded469 |
User & Date: | c.kworr@b84a3442-36b4-a7b2-c7ad-07429f13c525 on 2010-08-20 14:25:06.000 |
Other Links: | branch diff | manifest | tags |
Context
2010-08-21
| ||
10:59 | added license and todo many fixes in web server, now it's mostly functional web server was tested by Windows Update (win7, WinXP, Win2003) check-in: fb10031536 user: c.kworr@b84a3442-36b4-a7b2-c7ad-07429f13c525 tags: master, trunk | |
2010-08-20
| ||
14:25 | small fix for striping unneeded request parts from file path check-in: d0071bdbc7 user: c.kworr@b84a3442-36b4-a7b2-c7ad-07429f13c525 tags: master, trunk | |
14:09 | personal web server implemented: * can download, cache and serve data; * supports caching for partial requests. check-in: 80f8e3804a user: c.kworr@b84a3442-36b4-a7b2-c7ad-07429f13c525 tags: master, trunk | |
Changes
Modified samesite.py
from [1daa91439f]
to [314c46b43b].
︙ | |||
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | + + + + + + + - + - + - - + + - - + + - - + + - + | # 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 info = 'Checking file: ' + self.path myPath = re.compile('^(.*?)(\?.*)$').match(self.path) if myPath: my_path = myPath.group(1) else: my_path = self.path proxy_ignored = ('Accept', 'Accept-Encoding', 'Cache-Control', 'Connection', 'Host', 'User-Agent', 'Via', 'X-Forwarded-For', ) print('===============[ Request ]===') print('Command:', self.command) for header in self.headers: if header in proxy_ignored: pass elif header in ('Range'): isRange = re.compile('bytes=(\d+)-(\d+)').match(self.headers[header]) if isRange: requested_ranges = SpaceMap({int(isRange.group(1)): int(isRange.group(2)) + 1}) else: return() else: print('Unknown header - ', header, ': ', self.headers[header], sep='') return() print(header, self.headers[header]) |
︙ | |||
227 228 229 230 231 232 233 | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | - + | 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: |
︙ | |||
345 346 347 348 349 350 351 | 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | - + - + - - - - - + + + + + + - - + + - - + + - + - + - + | stream_pos = stream_last + length assert not stream_pos > end, 'Received more data then requested: pos:{} start:{} end:{}.'.format(stream_pos, start, end) print('Writing', length, 'bytes to temp file at position', stream_last) temp_file.seek(stream_last) temp_file.write(buffer) new_record['_parts'] = new_record['_parts'] - SpaceMap({stream_last: stream_pos}) print(new_record) |
︙ |