@@ -21,7 +21,7 @@ class HTTPResponse:
21
21
content_type : str
22
22
23
23
filename : Optional [str ]
24
- root_directory : str
24
+ root_path : str
25
25
26
26
body : str
27
27
@@ -32,7 +32,7 @@ def __init__(
32
32
headers : Dict [str , str ] = None ,
33
33
content_type : str = MIMEType .TEXT_PLAIN ,
34
34
filename : Optional [str ] = None ,
35
- root_directory : str = "" ,
35
+ root_path : str = "" ,
36
36
http_version : str = "HTTP/1.1"
37
37
) -> None :
38
38
"""
@@ -46,7 +46,7 @@ def __init__(
46
46
self .headers = headers or {}
47
47
self .content_type = content_type
48
48
self .filename = filename
49
- self .root_directory = root_directory
49
+ self .root_path = root_path
50
50
self .http_version = http_version
51
51
52
52
@staticmethod
@@ -82,11 +82,11 @@ def send(self, conn: Union[SocketPool.Socket, socket.socket]) -> None:
82
82
83
83
if self .filename is not None :
84
84
try :
85
- file_length = os .stat (self .root_directory + self .filename )[6 ]
85
+ file_length = os .stat (self .root_path + self .filename )[6 ]
86
86
self ._send_file_response (
87
87
conn ,
88
88
filename = self .filename ,
89
- root_directory = self .root_directory ,
89
+ root_path = self .root_path ,
90
90
file_length = file_length
91
91
)
92
92
except OSError :
@@ -127,7 +127,7 @@ def _send_file_response(
127
127
self ,
128
128
conn : Union [SocketPool .Socket , socket .socket ],
129
129
filename : str ,
130
- root_directory : str ,
130
+ root_path : str ,
131
131
file_length : int
132
132
):
133
133
self ._send_bytes (
@@ -138,7 +138,7 @@ def _send_file_response(
138
138
content_length = file_length
139
139
),
140
140
)
141
- with open (root_directory + filename , "rb" ) as file :
141
+ with open (root_path + filename , "rb" ) as file :
142
142
while bytes_read := file .read (2048 ):
143
143
self ._send_bytes (conn , bytes_read )
144
144
0 commit comments