<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>《通过实例理解Go标准库http包是如何处理keep-alive连接的》的评论</title>
	<atom:link href="http://tonybai.com/2021/01/08/understand-how-http-package-deal-with-keep-alive-connection/feed/" rel="self" type="application/rss+xml" />
	<link>https://tonybai.com/2021/01/08/understand-how-http-package-deal-with-keep-alive-connection/</link>
	<description>一个程序员的心路历程</description>
	<lastBuildDate>Wed, 25 Mar 2026 09:21:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>作者：bigwhite</title>
		<link>https://tonybai.com/2021/01/08/understand-how-http-package-deal-with-keep-alive-connection/#comment-7710</link>
		<dc:creator>bigwhite</dc:creator>
		<pubDate>Thu, 06 Jul 2023 13:20:36 +0000</pubDate>
		<guid isPermaLink="false">https://tonybai.com/?p=3074#comment-7710</guid>
		<description>笔误，感谢指出！已经修改了。</description>
		<content:encoded><![CDATA[<p>笔误，感谢指出！已经修改了。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：Z</title>
		<link>https://tonybai.com/2021/01/08/understand-how-http-package-deal-with-keep-alive-connection/#comment-7709</link>
		<dc:creator>Z</dc:creator>
		<pubDate>Thu, 06 Jul 2023 07:08:01 +0000</pubDate>
		<guid isPermaLink="false">https://tonybai.com/?p=3074#comment-7709</guid>
		<description>文章里：

http.Client底层的数据连接建立和维护是由http.Transport实现的，http.Transport结构有一个DisableKeepAlives字段，其默认值为false，即启动keep-alive。这里我们将其置为false，即关闭keep-alive，然后将该Transport实例作为初值，赋值给http Client实例的Transport字段。

----

应该是将其设为true，关闭keep-alive吧。</description>
		<content:encoded><![CDATA[<p>文章里：</p>
<p>http.Client底层的数据连接建立和维护是由http.Transport实现的，http.Transport结构有一个DisableKeepAlives字段，其默认值为false，即启动keep-alive。这里我们将其置为false，即关闭keep-alive，然后将该Transport实例作为初值，赋值给http Client实例的Transport字段。</p>
<p>&#8212;-</p>
<p>应该是将其设为true，关闭keep-alive吧。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：ching</title>
		<link>https://tonybai.com/2021/01/08/understand-how-http-package-deal-with-keep-alive-connection/#comment-7674</link>
		<dc:creator>ching</dc:creator>
		<pubDate>Wed, 01 Feb 2023 02:56:03 +0000</pubDate>
		<guid isPermaLink="false">https://tonybai.com/?p=3074#comment-7674</guid>
		<description>我理解心跳检测由client负责维持，在http client层，可以通过 Transport 下 KeepAlive参数来控制心跳检测间隔。</description>
		<content:encoded><![CDATA[<p>我理解心跳检测由client负责维持，在http client层，可以通过 Transport 下 KeepAlive参数来控制心跳检测间隔。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：Sirius</title>
		<link>https://tonybai.com/2021/01/08/understand-how-http-package-deal-with-keep-alive-connection/#comment-7642</link>
		<dc:creator>Sirius</dc:creator>
		<pubDate>Fri, 30 Sep 2022 09:48:36 +0000</pubDate>
		<guid isPermaLink="false">https://tonybai.com/?p=3074#comment-7642</guid>
		<description>目前来看在http server层，我们可以通过 SetKeepAlivesEnabled() 方法控制是否开启KeepAlive；另外可以通过配置 IdleTimeout参数来设置超时时间，但目前并不能控制KeepAlive的心跳间隔时间。 tcp层有个SetKeepAlivePeriod()方法，但是貌似tcp和http的KeepAlive概念并不完全一致。</description>
		<content:encoded><![CDATA[<p>目前来看在http server层，我们可以通过 SetKeepAlivesEnabled() 方法控制是否开启KeepAlive；另外可以通过配置 IdleTimeout参数来设置超时时间，但目前并不能控制KeepAlive的心跳间隔时间。 tcp层有个SetKeepAlivePeriod()方法，但是貌似tcp和http的KeepAlive概念并不完全一致。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：bigwhite</title>
		<link>https://tonybai.com/2021/01/08/understand-how-http-package-deal-with-keep-alive-connection/#comment-7530</link>
		<dc:creator>bigwhite</dc:creator>
		<pubDate>Tue, 12 Jan 2021 22:13:14 +0000</pubDate>
		<guid isPermaLink="false">https://tonybai.com/?p=3074#comment-7530</guid>
		<description>问题1： 有意而为之，毕竟是demo。可能不是好的示范；
问题2：改成自建server后，忘记删除第一行了。:)

感谢提醒。</description>
		<content:encoded><![CDATA[<p>问题1： 有意而为之，毕竟是demo。可能不是好的示范；<br />
问题2：改成自建server后，忘记删除第一行了。:)</p>
<p>感谢提醒。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：Nemo</title>
		<link>https://tonybai.com/2021/01/08/understand-how-http-package-deal-with-keep-alive-connection/#comment-7529</link>
		<dc:creator>Nemo</dc:creator>
		<pubDate>Sat, 09 Jan 2021 11:03:21 +0000</pubDate>
		<guid isPermaLink="false">https://tonybai.com/?p=3074#comment-7529</guid>
		<description>1. 第一段代码里会 defer resp.Body.Close() 会导致循环结束后才真正关闭连接
2. 第二段代码里s设置了Handler之后，http.HandleFunc(&quot;/&quot;, Index) 就没有必要写了</description>
		<content:encoded><![CDATA[<p>1. 第一段代码里会 defer resp.Body.Close() 会导致循环结束后才真正关闭连接<br />
2. 第二段代码里s设置了Handler之后，http.HandleFunc(“/”, Index) 就没有必要写了</p>
]]></content:encoded>
	</item>
</channel>
</rss>
