<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>梁剑的Blog &#187; http</title>
	<atom:link href="http://icomes.net/tag/http/feed/" rel="self" type="application/rss+xml" />
	<link>http://icomes.net</link>
	<description>做有趣的事，做有用的人</description>
	<lastBuildDate>Sat, 05 Nov 2011 18:23:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>RFC2616中关于HTTP Status Code的定义</title>
		<link>http://icomes.net/2009/10/12/rfc2616%e4%b8%ad%e5%85%b3%e4%ba%8ehttp-status-code%e7%9a%84%e5%ae%9a%e4%b9%89/</link>
		<comments>http://icomes.net/2009/10/12/rfc2616%e4%b8%ad%e5%85%b3%e4%ba%8ehttp-status-code%e7%9a%84%e5%ae%9a%e4%b9%89/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 14:09:02 +0000</pubDate>
		<dc:creator>梁剑</dc:creator>
				<category><![CDATA[Protocol]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[技术笔记]]></category>
		<category><![CDATA[读书笔记]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[rfc]]></category>

		<guid isPermaLink="false">http://icomes.net/?p=450</guid>
		<description><![CDATA[花了半天时间，看了一次http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 下面是相关的笔记和理解， 感觉很多Status Code在实际的BS通信中都不常见， 更多像是为了定义完备的协议语义， 而这些语义现在已经部分由更上层的协议或者应用实现。 1xx Informational 100 Continue &#160;&#160;&#160;&#160;如果server可能拒绝request，则client只发送header部分，试探server的反应 &#160;&#160;&#160;&#160;如果server接受，则返回100，于是client再发送剩余的body部分 101 Switch Protocol 2xx Successful 200 OK 201 Created &#160;&#160;&#160;&#160;有资源因Request而产生 202 Accepted &#160;&#160;&#160;&#160;Request要求的动作已经被记录，但真正的动作要等待若干时间才执行，而且不保证一定执行 203 Non-Authoritative Information 204 No Content &#160;&#160;&#160;&#160;google.cn的web server会返回 205 Reset Content 206 Partial Content &#160;&#160;&#160;&#160;用于断点续传，起始位置由Range指定。（可以参考迅雷的输出） 3xx Redirection &#160;&#160;&#160;&#160;User Agent需要处理循环的问题 300 Multiple Choices &#160;&#160;&#160;&#160;目标已变，有若干个替代品可供选择 301 Moved Permanently &#160;&#160;&#160;&#160;目标URI在Location里定义，除了HEAD和GET请求外，不能自动重定向 &#160;&#160;&#160;&#160;对SEO不会有负面作用 302 Found [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="读RFC2616" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ficomes.net%2F2008%2F11%2F24%2F%25E8%25AF%25BBrfc2616%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F10%2F12%2Frfc2616%25E4%25B8%25AD%25E5%2585%25B3%25E4%25BA%258Ehttp-status-code%25E7%259A%2584%25E5%25AE%259A%25E4%25B9%2589%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">读RFC2616</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Think before you code." style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ficomes.net%2F2008%2F11%2F06%2Fthink-before-you-code%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F10%2F12%2Frfc2616%25E4%25B8%25AD%25E5%2585%25B3%25E4%25BA%258Ehttp-status-code%25E7%259A%2584%25E5%25AE%259A%25E4%25B9%2589%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Think before you code.</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="黄子华 – 娱乐圈血肉史2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ficomes.net%2F2011%2F01%2F22%2F%25E9%25BB%2584%25E5%25AD%2590%25E5%258D%258E-%25E5%25A8%25B1%25E4%25B9%2590%25E5%259C%2588%25E8%25A1%2580%25E8%2582%2589%25E5%258F%25B22%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F10%2F12%2Frfc2616%25E4%25B8%25AD%25E5%2585%25B3%25E4%25BA%258Ehttp-status-code%25E7%259A%2584%25E5%25AE%259A%25E4%25B9%2589%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15014211.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">黄子华 – 娱乐圈血肉史2</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Second Screenshot" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ficomes.net%2F2009%2F09%2F03%2Fsecond-screensho%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F10%2F12%2Frfc2616%25E4%25B8%25AD%25E5%2585%25B3%25E4%25BA%258Ehttp-status-code%25E7%259A%2584%25E5%25AE%259A%25E4%25B9%2589%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15015227.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Second Screenshot</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>花了半天时间，看了一次<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" target="_blank">http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html</a></p>
<p>下面是相关的笔记和理解，<br />
感觉很多Status Code在实际的BS通信中都不常见，<br />
更多像是为了定义完备的协议语义，<br />
而这些语义现在已经部分由更上层的协议或者应用实现。</p>
<h3>1xx     Informational</h3>
<p><strong>100     Continue</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;如果server可能拒绝request，则client只发送header部分，试探server的反应<br />
&nbsp;&nbsp;&nbsp;&nbsp;如果server接受，则返回100，于是client再发送剩余的body部分<br />
<strong>101     Switch Protocol</strong></p>
<h3>2xx     Successful</h3>
<p><strong>200     OK<br />
201     Created</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;有资源因Request而产生<br />
<strong>202     Accepted</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;Request要求的动作已经被记录，但真正的动作要等待若干时间才执行，而且不保证一定执行<br />
<strong>203     Non-Authoritative Information<br />
204     No Content</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;google.cn的web server会返回<br />
<strong>205     Reset Content<br />
206     Partial Content</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;用于断点续传，起始位置由Range指定。（可以参考迅雷的输出）</p>
<h3>3xx     Redirection</h3>
<p>&nbsp;&nbsp;&nbsp;&nbsp;User Agent需要处理循环的问题<br />
<strong>300     Multiple Choices</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;目标已变，有若干个替代品可供选择<br />
<strong>301     Moved Permanently</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;目标URI在Location里定义，除了HEAD和GET请求外，不能自动重定向<br />
&nbsp;&nbsp;&nbsp;&nbsp;对SEO不会有负面作用<br />
<strong>302     Found</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;临时重定向，是否用Moved Temporarily这个名字比较合适？<br />
&nbsp;&nbsp;&nbsp;&nbsp;目标URI在Location里定义，除了HEAD和GET请求外，不能自动重定向<br />
&nbsp;&nbsp;&nbsp;&nbsp;对SEO有负面作用<br />
<strong>303     See Other</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;和302类似，但期待User Agent用GET来请求Location里指定的URI<br />
<strong>304     Not Modified</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;通常Request会带If-Modified-Since<br />
&nbsp;&nbsp;&nbsp;&nbsp;不能带message-body<br />
<strong>305     Use Proxy</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;期待User Agent会使用Location中指定的Proxy地址，来访问数据<br />
&nbsp;&nbsp;&nbsp;&nbsp;只能由origin server产生<br />
<strong>306     (not used)</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;之前的版本用过，已经废弃，作为保留字<br />
<strong>307     Temporary Redirect</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;没看出和302有什么不同<br />
&nbsp;&nbsp;&nbsp;&nbsp;只有HTTP/1.1支持</p>
<h3>4xx     Client Error</h3>
<p>&nbsp;&nbsp;&nbsp;&nbsp;在message-body中，可以自定义给User的提示<br />
<strong>400     Bad Request</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;server不能理解Request的格式<br />
&nbsp;&nbsp;&nbsp;&nbsp;用telnet可以很容易模拟<br />
<strong>401     Unauthorized</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;不能通过HTTP Authentication<br />
&nbsp;&nbsp;&nbsp;&nbsp;response header必须包含WWW-Authoricate，request header可能包含Authorization<br />
<strong>402     Payment Required</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;保留字<br />
<strong>403     Forbidden</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;如果不希望暴露过多的信息，可以用404代替<br />
<strong>404     Not Found</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;最常见的4字头Status Code，通常会自定义<br />
<strong>405     Method Not Allowed</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;response header需要包含Allow，列出支持的method<br />
<strong>406     Not Acceptable</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;response不被request header中的Accept做支持<br />
&nbsp;&nbsp;&nbsp;&nbsp;除了HEAD，response会给出包含更多信息的entity<br />
&nbsp;&nbsp;&nbsp;&nbsp;entity format由request header中的Content-Type决定<br />
<strong>407     Proxy Authentication Required</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;与401类似<br />
&nbsp;&nbsp;&nbsp;&nbsp;Proxy的response header必须包含Proxy-Authenticate<br />
<strong>408     Request Timeout<br />
409     Conflict</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;需要User干预解决<br />
&nbsp;&nbsp;&nbsp;&nbsp;在PUT的时候可能遇到<br />
<strong>410     Gone</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;URI已经不存在，且不提供3xx来重定向<br />
&nbsp;&nbsp;&nbsp;&nbsp;如果server没有足够的信息来判断URI的不存在是temporary还是permanent，可以用404代替<br />
<strong>411     Length Required</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;request header中缺少Content-Length<br />
<strong>412     Precondition Failed<br />
413     Request Entity Too Large</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;如果只是temporary，可以包含Retry-After，指定重试的时间间隔<br />
<strong>414     Request-URI Too Long</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;有几种可能导致这个返回码的情况<br />
&nbsp;&nbsp;&nbsp;&nbsp;将POST当成了GET<br />
&nbsp;&nbsp;&nbsp;&nbsp;循环重定向，每次都append上当前URI<br />
&nbsp;&nbsp;&nbsp;&nbsp;攻击<br />
<strong>415     Unsupported Media Type<br />
&nbsp;&nbsp;&nbsp;&nbsp;416     Requested Range Not Satisfiable</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;参考206<br />
<strong>417     Expectation Failed</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;不能满足request header中的Expect，参考100</p>
<h3>5xx     Server Error</h3>
<p><strong>500     Internal Server Error</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;在server没有输出正确的response header的时候会出现<br />
<strong>501     Not Implemented<br />
502     Bad Gateway</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;由gateway或者proxy返回，表明上游server不能返回请求的URI<br />
<strong>503     Service Unavailable</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;server可能过载，或者正在维护<br />
&nbsp;&nbsp;&nbsp;&nbsp;可以返回Retry-After，如果没有，则视作500<br />
<strong>504     Gateway Timeout</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;上游server不能及时返回<br />
<strong>505     HTTP Version Not Supported</strong></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="读RFC2616" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ficomes.net%2F2008%2F11%2F24%2F%25E8%25AF%25BBrfc2616%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F10%2F12%2Frfc2616%25E4%25B8%25AD%25E5%2585%25B3%25E4%25BA%258Ehttp-status-code%25E7%259A%2584%25E5%25AE%259A%25E4%25B9%2589%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">读RFC2616</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Think before you code." style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ficomes.net%2F2008%2F11%2F06%2Fthink-before-you-code%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F10%2F12%2Frfc2616%25E4%25B8%25AD%25E5%2585%25B3%25E4%25BA%258Ehttp-status-code%25E7%259A%2584%25E5%25AE%259A%25E4%25B9%2589%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Think before you code.</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="黄子华 – 娱乐圈血肉史2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ficomes.net%2F2011%2F01%2F22%2F%25E9%25BB%2584%25E5%25AD%2590%25E5%258D%258E-%25E5%25A8%25B1%25E4%25B9%2590%25E5%259C%2588%25E8%25A1%2580%25E8%2582%2589%25E5%258F%25B22%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F10%2F12%2Frfc2616%25E4%25B8%25AD%25E5%2585%25B3%25E4%25BA%258Ehttp-status-code%25E7%259A%2584%25E5%25AE%259A%25E4%25B9%2589%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15014211.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">黄子华 – 娱乐圈血肉史2</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Second Screenshot" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ficomes.net%2F2009%2F09%2F03%2Fsecond-screensho%2F&from=http%3A%2F%2Ficomes.net%2F2009%2F10%2F12%2Frfc2616%25E4%25B8%25AD%25E5%2585%25B3%25E4%25BA%258Ehttp-status-code%25E7%259A%2584%25E5%25AE%259A%25E4%25B9%2589%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/29/15015227.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Second Screenshot</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://icomes.net/2009/10/12/rfc2616%e4%b8%ad%e5%85%b3%e4%ba%8ehttp-status-code%e7%9a%84%e5%ae%9a%e4%b9%89/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

