zyearn commented on a change in pull request #1529: URL: https://github.com/apache/incubator-brpc/pull/1529#discussion_r698818151
########## File path: docs/cn/http_client.md ########## @@ -114,7 +114,9 @@ URL的一般形式如下图: 若用户没有填且URL中包含host,比如http://www.foo.com/path,则http request中会包含"Host: www.foo.com"。 -若用户没有填且URL不包含host,比如"/index.html?name=value",则框架会以目标server的ip和port为Host,地址为10.46.188.39:8989的http server将会看到"Host: 10.46.188.39:8989"。 +若用户没有填且URL不包含host,比如"/index.html?name=value",但如果Channel初始化的地址包含域名,则框架会以域名作为Host,比如"http://www.foo.com",该http server将会看到"Host: www.foo.com"。如果地址是"http://www.foo.com:8989",则该http server将会看到"Host: www.foo.com"。 + Review comment: Hi, 我之前说的谦容性问题是,实现将Host: www.aa.com 变成了 Host: www.aa.com:80。现在这样实现的话 www.aa.com和www.aa.com:8899对应到请求全部都是Host: www.aa.com,不太符合预期 https://datatracker.ietf.org/doc/html/rfc2616#section-14.23 符合谦容性的实现是: * channel.Init("www.aa.com", ...) -> Host: www.aa.com 不变 * channel.Init("www.aa.com:8899", ...) -> Host: www.aa.com:8899 要想个办法把ParseUrl出来的port,也在set_host的时候顺便set_port,这样http_message.cpp就不用改了。简单看了下,似乎把parse出来的port追加到_service_name后面,然后替换set_host为uri.SetHostAndPort(_service_name)就可以了。看看可行么? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
