Skip to content

Commit c609a82

Browse files
committed
Changed address to client_address to match CPython's http.server module naming
1 parent 140c0e1 commit c609a82

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ HTTP Server for CircuitPython.
2727
- HTTP 1.1.
2828
- Serves files from a designated root.
2929
- Routing for serving computed responses from handler.
30-
- Gives access to request headers, query parameters, body and address from which the request came.
30+
- Gives access to request headers, query parameters, body and client's address, the one from which the request came.
3131
- Supports chunked transfer encoding.
3232

3333

adafruit_httpserver/request.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ class HTTPRequest:
2828
Socket object usable to send and receive data on the connection.
2929
"""
3030

31-
address: Tuple[str, int]
31+
client_address: Tuple[str, int]
3232
"""
33-
Address bound to the socket on the other end of the connection.
33+
Address and port bound to the socket on the other end of the connection.
3434
3535
Example::
3636
37-
request.address
37+
request.client_address
3838
# ('192.168.137.1', 40684)
3939
"""
4040

@@ -73,11 +73,11 @@ class HTTPRequest:
7373
def __init__(
7474
self,
7575
connection: Union["SocketPool.Socket", "socket.socket"],
76-
address: Tuple[str, int],
76+
client_address: Tuple[str, int],
7777
raw_request: bytes = None,
7878
) -> None:
7979
self.connection = connection
80-
self.address = address
80+
self.client_address = client_address
8181
self.raw_request = raw_request
8282

8383
if raw_request is None:

adafruit_httpserver/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def poll(self):
133133
the application callable will be invoked.
134134
"""
135135
try:
136-
conn, address = self._sock.accept()
136+
conn, client_address = self._sock.accept()
137137
with conn:
138138
conn.settimeout(self._timeout)
139139

@@ -144,7 +144,7 @@ def poll(self):
144144
if not header_bytes:
145145
return
146146

147-
request = HTTPRequest(conn, address, header_bytes)
147+
request = HTTPRequest(conn, client_address, header_bytes)
148148

149149
content_length = int(request.headers.get("Content-Length", 0))
150150
received_body_bytes = request.body

0 commit comments

Comments
 (0)