@@ -315,7 +315,7 @@ async def _prepare_open_file(
315
315
#
316
316
# Will do the same below. Many servers ignore this and do not
317
317
# send a Content-Range header with HTTP 416
318
- self .headers [hdrs .CONTENT_RANGE ] = f"bytes */{ file_size } "
318
+ self ._headers [hdrs .CONTENT_RANGE ] = f"bytes */{ file_size } "
319
319
self .set_status (HTTPRequestRangeNotSatisfiable .status_code )
320
320
return await super ().prepare (request )
321
321
@@ -351,7 +351,7 @@ async def _prepare_open_file(
351
351
# suffix-byte-range-spec with a non-zero suffix-length,
352
352
# then the byte-range-set is satisfiable. Otherwise, the
353
353
# byte-range-set is unsatisfiable.
354
- self .headers [hdrs .CONTENT_RANGE ] = f"bytes */{ file_size } "
354
+ self ._headers [hdrs .CONTENT_RANGE ] = f"bytes */{ file_size } "
355
355
self .set_status (HTTPRequestRangeNotSatisfiable .status_code )
356
356
return await super ().prepare (request )
357
357
@@ -363,16 +363,16 @@ async def _prepare_open_file(
363
363
# If the Content-Type header is not already set, guess it based on the
364
364
# extension of the request path. The encoding returned by guess_type
365
365
# can be ignored since the map was cleared above.
366
- if hdrs .CONTENT_TYPE not in self .headers :
366
+ if hdrs .CONTENT_TYPE not in self ._headers :
367
367
if sys .version_info >= (3 , 13 ):
368
368
guesser = CONTENT_TYPES .guess_file_type
369
369
else :
370
370
guesser = CONTENT_TYPES .guess_type
371
371
self .content_type = guesser (self ._path )[0 ] or FALLBACK_CONTENT_TYPE
372
372
373
373
if file_encoding :
374
- self .headers [hdrs .CONTENT_ENCODING ] = file_encoding
375
- self .headers [hdrs .VARY ] = hdrs .ACCEPT_ENCODING
374
+ self ._headers [hdrs .CONTENT_ENCODING ] = file_encoding
375
+ self ._headers [hdrs .VARY ] = hdrs .ACCEPT_ENCODING
376
376
# Disable compression if we are already sending
377
377
# a compressed file since we don't want to double
378
378
# compress.
@@ -382,12 +382,12 @@ async def _prepare_open_file(
382
382
self .last_modified = st .st_mtime # type: ignore[assignment]
383
383
self .content_length = count
384
384
385
- self .headers [hdrs .ACCEPT_RANGES ] = "bytes"
385
+ self ._headers [hdrs .ACCEPT_RANGES ] = "bytes"
386
386
387
387
real_start = cast (int , start )
388
388
389
389
if status == HTTPPartialContent .status_code :
390
- self .headers [hdrs .CONTENT_RANGE ] = "bytes {}-{}/{}" .format (
390
+ self ._headers [hdrs .CONTENT_RANGE ] = "bytes {}-{}/{}" .format (
391
391
real_start , real_start + count - 1 , file_size
392
392
)
393
393
0 commit comments