Skip to content

Commit f7bb118

Browse files
authored
Fix Host: header when calling metadata service (#494)
The `Host:` header was being set to the resolved IP address (and port) instead of the hostname.
1 parent fef701e commit f7bb118

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/http_client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void HttpClient::on_socket_connect(SocketConnector* connector) {
117117

118118
OStringStream ss;
119119
ss << "GET " << path_ << " HTTP/1.0\r\n" // HTTP/1.0 ensures chunked responses are not sent
120-
<< "Host: " << socket_->address().to_string(true) << "\r\n"
120+
<< "Host: " << address_.to_string(false) << "\r\n"
121121
<< "User-Agent: cpp-driver/" << driver_version() << "\r\nAccept: */*\r\n\r\n";
122122

123123
String request = ss.str();

0 commit comments

Comments
 (0)