Skip to content

Commit dcca53e

Browse files
markmcclaintcalmant
authored andcommitted
Send Host: localhost for Unix socket to comply with RFC7230
Unix sockets do not contain an authority component as defined in the HTTP/1.1 spec, so this change updates the UnixHTTPConnection to comply with RFC7230 Section 5.4 [1]: [1] https://tools.ietf.org/html/rfc7230#section-5.4
1 parent c4313d6 commit dcca53e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

jsonrpclib/jsonrpc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,10 @@ def __init__(self, path, *args, **kwargs):
491491
492492
:param path: Path to the Unix socket
493493
"""
494-
HTTPConnection.__init__(self, path, *args, **kwargs)
494+
495+
# Use localhost as the hostname since a HTTP/1.1 client MUST send a
496+
# 'Host:' header.
497+
HTTPConnection.__init__(self, 'localhost', *args, **kwargs)
495498
self.path = path
496499

497500
def connect(self):

0 commit comments

Comments
 (0)