<?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/"
	>

<channel>
	<title>飘零的代码 piao2010 's blog</title>
	<atom:link href="http://www.piao2010.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.piao2010.com</link>
	<description>Focus On Web Security &#38; Linux  :)</description>
	<pubDate>Mon, 06 Feb 2012 09:16:42 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>2011年个人总结</title>
		<link>http://www.piao2010.com/2011%e5%b9%b4%e4%b8%aa%e4%ba%ba%e6%80%bb%e7%bb%93</link>
		<comments>http://www.piao2010.com/2011%e5%b9%b4%e4%b8%aa%e4%ba%ba%e6%80%bb%e7%bb%93#comments</comments>
		<pubDate>Tue, 31 Jan 2012 08:25:39 +0000</pubDate>
		<dc:creator>飘(piao2010)</dc:creator>
		
		<category><![CDATA[生活琐碎]]></category>

		<category><![CDATA[年度总结]]></category>

		<guid isPermaLink="false">http://www.piao2010.com/?p=1044</guid>
		<description><![CDATA[2011年个人总结<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><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="求职总结篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E4%25B8%25AA%25E4%25BA%25BA%25E6%25B1%2582%25E8%2581%258C%25E6%2580%25BB%25E7%25BB%2593&from=http%3A%2F%2Fwww.piao2010.com%2F2011%25E5%25B9%25B4%25E4%25B8%25AA%25E4%25BA%25BA%25E6%2580%25BB%25E7%25BB%2593">
                        <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;">求职总结篇</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="WEBSHELL提权方法总结" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Fwebshell%25E6%258F%2590%25E6%259D%2583%25E6%2596%25B9%25E6%25B3%2595%25E6%2580%25BB%25E7%25BB%2593&from=http%3A%2F%2Fwww.piao2010.com%2F2011%25E5%25B9%25B4%25E4%25B8%25AA%25E4%25BA%25BA%25E6%2580%25BB%25E7%25BB%2593">
                        <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;">WEBSHELL提权方法总结</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="破解无线过滤MAC" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E7%25A0%25B4%25E8%25A7%25A3%25E6%2597%25A0%25E7%25BA%25BF%25E8%25BF%2587%25E6%25BB%25A4mac&from=http%3A%2F%2Fwww.piao2010.com%2F2011%25E5%25B9%25B4%25E4%25B8%25AA%25E4%25BA%25BA%25E6%2580%25BB%25E7%25BB%2593">
                        <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/11/29/11664020.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;">破解无线过滤MAC</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="破解禁止SSID广播" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E7%25A0%25B4%25E8%25A7%25A3%25E7%25A6%2581%25E6%25AD%25A2ssid%25E5%25B9%25BF%25E6%2592%25AD&from=http%3A%2F%2Fwww.piao2010.com%2F2011%25E5%25B9%25B4%25E4%25B8%25AA%25E4%25BA%25BA%25E6%2580%25BB%25E7%25BB%2593">
                        <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/11/29/11664017.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;">破解禁止SSID广播</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="一次分享引发的血案 --- HTTP Post Denial Of Service" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E4%25B8%2580%25E6%25AC%25A1%25E5%2588%2586%25E4%25BA%25AB%25E5%25BC%2595%25E5%258F%2591%25E7%259A%2584%25E8%25A1%2580%25E6%25A1%2588-http-post-denial-of-service&from=http%3A%2F%2Fwww.piao2010.com%2F2011%25E5%25B9%25B4%25E4%25B8%25AA%25E4%25BA%25BA%25E6%2580%25BB%25E7%25BB%2593">
                        <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/11/29/11663736.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;">一次分享引发的血案 --- HTTP Post Denial Of Service</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" 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>转眼已是2012，印象中写完<a href="http://www.piao2010.com/%E9%80%9D%E5%8E%BB%E7%9A%842010" target="_blank">去年的总结</a>才没多久，看来工作是比大学里过得更充实。</p>
<p>2011年，我在部门里已经是老员工了，这一年里带过两个新人，虽然很多时候觉得自己也还是刚刚入门的新人。工作上对自己负责的产品线应用有了更多的认识，特别是核心应用的业务流程，监控报警处理更加熟悉。<br />
见证了各系统在11.11和12.12两次巨浪的冲击下依然能稳定服务，奇迹的背后<span id="more-1044"></span>是N多攻城师日夜在自己的岗位上坚守。<br />
对于java应用的运维和故障排查有了更多认识，jstat 、jstack、jmap 等JDK自带的工具确实很强大，2012年在<font color="red">jvm troubleshooting</font>这一块还需要再加强，在实践中成长。</p>
<p>一次偶然的机会让我重拾大学里的C语言教程，接触nginx module开发相关的东西(这里打一下广告：<a href="http://tengine.taobao.org/" target="_blank">tengine</a>已经开源，非常感谢<a href="http://zhuzhaoyuan.com/" target="_blank">叔度</a>给我打酱油的机会^_^ )，进而意识到对于操作系统和网络还有很多需要恶补的，所以买了<font color="red">《TCP/IP详解》和《UNIX环境高级编程》</font>两本经典著作在翻，希望对每天面对的她(Linux)多一些了解。这一年技术方面比以前更向协议和操作系统靠近了，希望能离真相更近一点。</p>
<p>安全方面：玩了一阵子基于系统调用劫持的内核rootkit ，经常会<font color="red">kernel panic</font>，觉得自己基本功还是差了些，暂且放下；对于<a href="http://www.piao2010.com/linux%E8%AF%A1%E5%BC%82%E7%9A%84%E5%8D%8A%E8%BF%9E%E6%8E%A5syn_recv%E9%98%9F%E5%88%97%E9%95%BF%E5%BA%A6%E4%B8%80" target="_blank">SYN Flood</a> 相关有些认识，想进一步了解内核<font color="red">TCP协议栈的实现</font>发现水很深，有精力可以再继续；另外近期各种泄密门、哈希碰撞攻击让普通网民也更加重视安全，个人一直相信<a href="http://www.piao2010.com/categorys/%E5%AE%89%E5%85%A8%E7%9B%B8%E5%85%B3" target="_blank">安全</a>是网络世界永恒的主题之一。</p>
<p>3月中旬由于房子到期换了一处条件好一些的，主要比之前多了洗衣机空调，仍然是3个朋友合租一套，只是之前一位室友孙同学回温州发展了，来了另一个室友罗同学（在世界500强工作哇，虽然还没正式编制，希望12年他能转正）。另外今年还完成了一件大事：买房，从5月到8月跑了N多的地方开了各种证明办理各种手续，绝对是折腾人。当然能买房自己还是幸运的，感谢家人和亲友的支持！至于房价是涨是跌个人倒不是很在意，毕竟我是刚需，再说郊区还能跌到哪里去呢？</p>
<p>今年和同事去舟山吃海鲜，去阳澄湖吃大闸蟹，大饱口福。去了趟张家界，经历4天N个小时（基本上时间都在车上和宾馆度过）最大的收获就是克服晕车了，从此回家不用再挤春运只能容纳两只脚的火车了。</p>
<p>年底入手了kindle fire，主要是为了看电子书方便，到手之后发现玩游戏看电影也不错嘛，性价比超高。</p>
<p>游戏方面：打了一段时间KOF2003掌握了几乎全部人物的超必杀技，练得我手酸啊。dota放下了大半年最近又重新玩起来，目前小黑、流浪、虚空和幽鬼玩得比较熟。</p>
<p>2012年希望在技术方面对操作系统和JVM多一些深入，工作方面更熟悉应用，生活依旧简单快乐！</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><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="求职总结篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E4%25B8%25AA%25E4%25BA%25BA%25E6%25B1%2582%25E8%2581%258C%25E6%2580%25BB%25E7%25BB%2593&from=http%3A%2F%2Fwww.piao2010.com%2F2011%25E5%25B9%25B4%25E4%25B8%25AA%25E4%25BA%25BA%25E6%2580%25BB%25E7%25BB%2593">
                        <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;">求职总结篇</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="WEBSHELL提权方法总结" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Fwebshell%25E6%258F%2590%25E6%259D%2583%25E6%2596%25B9%25E6%25B3%2595%25E6%2580%25BB%25E7%25BB%2593&from=http%3A%2F%2Fwww.piao2010.com%2F2011%25E5%25B9%25B4%25E4%25B8%25AA%25E4%25BA%25BA%25E6%2580%25BB%25E7%25BB%2593">
                        <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;">WEBSHELL提权方法总结</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="破解禁止SSID广播" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E7%25A0%25B4%25E8%25A7%25A3%25E7%25A6%2581%25E6%25AD%25A2ssid%25E5%25B9%25BF%25E6%2592%25AD&from=http%3A%2F%2Fwww.piao2010.com%2F2011%25E5%25B9%25B4%25E4%25B8%25AA%25E4%25BA%25BA%25E6%2580%25BB%25E7%25BB%2593">
                        <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/11/29/11664017.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;">破解禁止SSID广播</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="破解无线过滤MAC" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E7%25A0%25B4%25E8%25A7%25A3%25E6%2597%25A0%25E7%25BA%25BF%25E8%25BF%2587%25E6%25BB%25A4mac&from=http%3A%2F%2Fwww.piao2010.com%2F2011%25E5%25B9%25B4%25E4%25B8%25AA%25E4%25BA%25BA%25E6%2580%25BB%25E7%25BB%2593">
                        <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/11/29/11664020.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;">破解无线过滤MAC</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="一次分享引发的血案 --- HTTP Post Denial Of Service" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E4%25B8%2580%25E6%25AC%25A1%25E5%2588%2586%25E4%25BA%25AB%25E5%25BC%2595%25E5%258F%2591%25E7%259A%2584%25E8%25A1%2580%25E6%25A1%2588-http-post-denial-of-service&from=http%3A%2F%2Fwww.piao2010.com%2F2011%25E5%25B9%25B4%25E4%25B8%25AA%25E4%25BA%25BA%25E6%2580%25BB%25E7%25BB%2593">
                        <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/11/29/11663736.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;">一次分享引发的血案 --- HTTP Post Denial Of Service</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" 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://www.piao2010.com/2011%e5%b9%b4%e4%b8%aa%e4%ba%ba%e6%80%bb%e7%bb%93/feed</wfw:commentRss>
		</item>
		<item>
		<title>关于linux文件时间属性(atime mtime ctime)</title>
		<link>http://www.piao2010.com/%e5%85%b3%e4%ba%8elinux%e6%96%87%e4%bb%b6%e6%97%b6%e9%97%b4%e5%b1%9e%e6%80%a7atime-mtime-ctime</link>
		<comments>http://www.piao2010.com/%e5%85%b3%e4%ba%8elinux%e6%96%87%e4%bb%b6%e6%97%b6%e9%97%b4%e5%b1%9e%e6%80%a7atime-mtime-ctime#comments</comments>
		<pubDate>Mon, 16 Jan 2012 06:19:03 +0000</pubDate>
		<dc:creator>飘(piao2010)</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[atime]]></category>

		<category><![CDATA[creation time]]></category>

		<category><![CDATA[ctime]]></category>

		<category><![CDATA[mtime]]></category>

		<guid isPermaLink="false">http://www.piao2010.com/?p=1022</guid>
		<description><![CDATA[关于linux文件时间属性(atime mtime ctime) <table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E6%25B7%25BB%25E5%258A%25A0%25E6%2596%25B0%25E7%25A1%25AC%25E7%259B%2598&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%2585%25B3%25E4%25BA%258Elinux%25E6%2596%2587%25E4%25BB%25B6%25E6%2597%25B6%25E9%2597%25B4%25E5%25B1%259E%25E6%2580%25A7atime-mtime-ctime">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux添加新硬盘</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E5%25AE%2589%25E5%2585%25A8%25E9%2598%25B2%25E6%258A%25A4%25E5%258D%2581%25E5%25A4%25A7%25E6%258B%259B%25E6%2595%25B0&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%2585%25B3%25E4%25BA%258Elinux%25E6%2596%2587%25E4%25BB%25B6%25E6%2597%25B6%25E9%2597%25B4%25E5%25B1%259E%25E6%2580%25A7atime-mtime-ctime">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux安全防护十大招数</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E7%25B3%25BB%25E7%25BB%259F%25E4%25B8%258B%25E7%259A%2584%25E7%25BD%2591%25E7%25BB%259C%25E7%259B%2591%25E5%2590%25AC%25E6%258A%2580%25E6%259C%25AF&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%2585%25B3%25E4%25BA%258Elinux%25E6%2596%2587%25E4%25BB%25B6%25E6%2597%25B6%25E9%2597%25B4%25E5%25B1%259E%25E6%2580%25A7atime-mtime-ctime">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux系统下的网络监听技术</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Fsniffit%25E5%25AE%2598%25E6%2596%25B9%25E6%2596%2587%25E4%25BB%25B6&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%2585%25B3%25E4%25BA%258Elinux%25E6%2596%2587%25E4%25BB%25B6%25E6%2597%25B6%25E9%2597%25B4%25E5%25B1%259E%25E6%2580%25A7atime-mtime-ctime">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Sniffit官方文件</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258Elinux%25E7%259A%2584subversion%25E9%2585%258D%25E7%25BD%25AE&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%2585%25B3%25E4%25BA%258Elinux%25E6%2596%2587%25E4%25BB%25B6%25E6%2597%25B6%25E9%2597%25B4%25E5%25B1%259E%25E6%2580%25A7atime-mtime-ctime">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">基于Linux的Subversion配置</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" 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>前阵子和两个朋友在吃饭时无意中提到了linux系统是否有文件创建时间，因为之前遇到过这个问题，查过一些资料，所以我说linux是没有文件创建时间的。关于文件的时间属性可以查一下stat系统调用：man 2 stat<span id="more-1022"></span></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1022code1'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10221"><td class="code" id="p1022code1"><pre class="c" style="font-family:monospace;">  <span style="color: #993333;">struct</span> stat <span style="color: #009900;">&#123;</span>
              dev_t     st_dev<span style="color: #339933;">;</span>     <span style="color: #808080; font-style: italic;">/* ID of device containing file */</span>
              ino_t     st_ino<span style="color: #339933;">;</span>     <span style="color: #808080; font-style: italic;">/* inode number */</span>
              mode_t    st_mode<span style="color: #339933;">;</span>    <span style="color: #808080; font-style: italic;">/* protection */</span>
              nlink_t   st_nlink<span style="color: #339933;">;</span>   <span style="color: #808080; font-style: italic;">/* number of hard links */</span>
              uid_t     st_uid<span style="color: #339933;">;</span>     <span style="color: #808080; font-style: italic;">/* user ID of owner */</span>
              gid_t     st_gid<span style="color: #339933;">;</span>     <span style="color: #808080; font-style: italic;">/* group ID of owner */</span>
              dev_t     st_rdev<span style="color: #339933;">;</span>    <span style="color: #808080; font-style: italic;">/* device ID (if special file) */</span>
              off_t     st_size<span style="color: #339933;">;</span>    <span style="color: #808080; font-style: italic;">/* total size, in bytes */</span>
              blksize_t st_blksize<span style="color: #339933;">;</span> <span style="color: #808080; font-style: italic;">/* blocksize for filesystem I/O */</span>
              blkcnt_t  st_blocks<span style="color: #339933;">;</span>  <span style="color: #808080; font-style: italic;">/* number of blocks allocated */</span>
              time_t    st_atime<span style="color: #339933;">;</span>   <span style="color: #808080; font-style: italic;">/* time of last access */</span>
              time_t    st_mtime<span style="color: #339933;">;</span>   <span style="color: #808080; font-style: italic;">/* time of last modification */</span>
              time_t    st_ctime<span style="color: #339933;">;</span>   <span style="color: #808080; font-style: italic;">/* time of last status change */</span>
          <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//省略不相关部分</span>
       Not all of the Linux filesystems implement all of the time fields.  <span style="color: #202020;">Some</span> file system types allow mounting in  such  a  way  that  file
       accesses <span style="color: #b1b100;">do</span> not cause an update of the st_atime field. <span style="color: #009900;">&#40;</span>See <span style="color: #ff0000;">'noatime'</span> in mount<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">8</span><span style="color: #009900;">&#41;</span>.<span style="color: #009900;">&#41;</span>
     The  field st_atime is changed by file accesses<span style="color: #339933;">,</span> e.<span style="color: #202020;">g</span>. <span style="color: #202020;">by</span> execve<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> mknod<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> pipe<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> utime<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span> and read<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span>of more than zero bytes<span style="color: #009900;">&#41;</span>.
       <span style="color: #202020;">Other</span> routines<span style="color: #339933;">,</span> like mmap<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> may or may not update st_atime.
&nbsp;
       <span style="color: #202020;">The</span> field st_mtime is changed by file modifications<span style="color: #339933;">,</span> e.<span style="color: #202020;">g</span>. <span style="color: #202020;">by</span> mknod<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> truncate<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> utime<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span> and write<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span>of more than  zero  bytes<span style="color: #009900;">&#41;</span>.
       <span style="color: #202020;">Moreover</span><span style="color: #339933;">,</span>  st_mtime  of  a  directory  is  changed  by the creation or deletion of files in that directory.  <span style="color: #202020;">The</span> st_mtime field is not
       changed <span style="color: #b1b100;">for</span> changes in owner<span style="color: #339933;">,</span> group<span style="color: #339933;">,</span> hard link count<span style="color: #339933;">,</span> or mode.
&nbsp;
       <span style="color: #202020;">The</span> field st_ctime is changed by writing or by setting inode information <span style="color: #009900;">&#40;</span>i.<span style="color: #202020;">e</span>.<span style="color: #339933;">,</span> owner<span style="color: #339933;">,</span> group<span style="color: #339933;">,</span> link count<span style="color: #339933;">,</span> mode<span style="color: #339933;">,</span> etc.<span style="color: #009900;">&#41;</span>.</pre></td></tr></table></div>

<p>从上述可以得到：<br />
st_atime：<font color='red'>文件访问时间</font>，会改变这个时间的系统调用execve(2), mknod(2), pipe(2), utime(2) and read(2) (of more than zero bytes)。<br />
st_mtime：<font color='red'>文件内容更新时间</font>，会改变这个时间的系统调用mknod(2), truncate(2), utime(2) and write(2) (of more than zero bytes)，<font color='red'>目录的mtime 随着文件的创建、删除而更新。</font><br />
st_ctime：<font color='red'>文件状态更新时间，包括文件内容更新和indoe</font>信息的更新，会改变这个时间的命令chmod chown。</p>
<p>我们知道文件的基本信息是保存在inode里的，顺便看一下这个结构体：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1022code2'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10222"><td class="code" id="p1022code2"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">struct</span> inode <span style="color: #009900;">&#123;</span>
	<span style="color: #993333;">struct</span> hlist_node	i_hash<span style="color: #339933;">;</span>
	<span style="color: #993333;">struct</span> list_head	i_list<span style="color: #339933;">;</span>
	<span style="color: #993333;">struct</span> list_head	i_sb_list<span style="color: #339933;">;</span>
	<span style="color: #993333;">struct</span> list_head	i_dentry<span style="color: #339933;">;</span>
	<span style="color: #993333;">unsigned</span> <span style="color: #993333;">long</span>		i_ino<span style="color: #339933;">;</span>
	atomic_t		i_count<span style="color: #339933;">;</span>
	umode_t			i_mode<span style="color: #339933;">;</span>
	<span style="color: #993333;">unsigned</span> <span style="color: #993333;">int</span>		i_nlink<span style="color: #339933;">;</span>
	uid_t			i_uid<span style="color: #339933;">;</span>
	gid_t			i_gid<span style="color: #339933;">;</span>
	dev_t			i_rdev<span style="color: #339933;">;</span>
	loff_t			i_size<span style="color: #339933;">;</span>
	<span style="color: #993333;">struct</span> timespec		i_atime<span style="color: #339933;">;</span>
	<span style="color: #993333;">struct</span> timespec		i_mtime<span style="color: #339933;">;</span>
	<span style="color: #993333;">struct</span> timespec		i_ctime<span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//后面省略</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><font color='red'>linux 是没有文件创建时间的,这里的ctime并不是creation time，而是状态改变时间(change time).</font></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E6%25B7%25BB%25E5%258A%25A0%25E6%2596%25B0%25E7%25A1%25AC%25E7%259B%2598&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%2585%25B3%25E4%25BA%258Elinux%25E6%2596%2587%25E4%25BB%25B6%25E6%2597%25B6%25E9%2597%25B4%25E5%25B1%259E%25E6%2580%25A7atime-mtime-ctime">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux添加新硬盘</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E5%25AE%2589%25E5%2585%25A8%25E9%2598%25B2%25E6%258A%25A4%25E5%258D%2581%25E5%25A4%25A7%25E6%258B%259B%25E6%2595%25B0&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%2585%25B3%25E4%25BA%258Elinux%25E6%2596%2587%25E4%25BB%25B6%25E6%2597%25B6%25E9%2597%25B4%25E5%25B1%259E%25E6%2580%25A7atime-mtime-ctime">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux安全防护十大招数</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E7%25B3%25BB%25E7%25BB%259F%25E4%25B8%258B%25E7%259A%2584%25E7%25BD%2591%25E7%25BB%259C%25E7%259B%2591%25E5%2590%25AC%25E6%258A%2580%25E6%259C%25AF&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%2585%25B3%25E4%25BA%258Elinux%25E6%2596%2587%25E4%25BB%25B6%25E6%2597%25B6%25E9%2597%25B4%25E5%25B1%259E%25E6%2580%25A7atime-mtime-ctime">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux系统下的网络监听技术</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Fsniffit%25E5%25AE%2598%25E6%2596%25B9%25E6%2596%2587%25E4%25BB%25B6&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%2585%25B3%25E4%25BA%258Elinux%25E6%2596%2587%25E4%25BB%25B6%25E6%2597%25B6%25E9%2597%25B4%25E5%25B1%259E%25E6%2580%25A7atime-mtime-ctime">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Sniffit官方文件</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258Elinux%25E7%259A%2584subversion%25E9%2585%258D%25E7%25BD%25AE&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%2585%25B3%25E4%25BA%258Elinux%25E6%2596%2587%25E4%25BB%25B6%25E6%2597%25B6%25E9%2597%25B4%25E5%25B1%259E%25E6%2580%25A7atime-mtime-ctime">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">基于Linux的Subversion配置</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" 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://www.piao2010.com/%e5%85%b3%e4%ba%8elinux%e6%96%87%e4%bb%b6%e6%97%b6%e9%97%b4%e5%b1%9e%e6%80%a7atime-mtime-ctime/feed</wfw:commentRss>
		</item>
		<item>
		<title>linux诡异的半连接(SYN_RECV)队列长度(二)</title>
		<link>http://www.piao2010.com/linux%e8%af%a1%e5%bc%82%e7%9a%84%e5%8d%8a%e8%bf%9e%e6%8e%a5syn_recv%e9%98%9f%e5%88%97%e9%95%bf%e5%ba%a6%e4%ba%8c</link>
		<comments>http://www.piao2010.com/linux%e8%af%a1%e5%bc%82%e7%9a%84%e5%8d%8a%e8%bf%9e%e6%8e%a5syn_recv%e9%98%9f%e5%88%97%e9%95%bf%e5%ba%a6%e4%ba%8c#comments</comments>
		<pubDate>Sun, 20 Nov 2011 10:18:16 +0000</pubDate>
		<dc:creator>飘(piao2010)</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[安全相关]]></category>

		<category><![CDATA[SYN Flood]]></category>

		<category><![CDATA[SYN_RECV]]></category>

		<category><![CDATA[tcp_max_syn_backlog]]></category>

		<category><![CDATA[半连接]]></category>

		<guid isPermaLink="false">http://www.piao2010.com/?p=990</guid>
		<description><![CDATA[继续上回：我们已经确认了全连接队列的长度计算，接下来继续寻找半连接队列长度。
试着慢慢减小tcp_max_syn_backlog的值，但还是看不到半连接状态数量的变化。
实在没什么思路，只能Google之，搜出来的基本都是关于SYN Flood的文章，难道没同学关注过半连接队列的长度吗？
困扰数日终于在某个夜晚被我找一篇题为《关于半连接队列的释疑》的文章，激动呐。根据作者提供的思路我开始翻代码，注意我用的内核版本2.6.32，不同版本代码也有差异。
首先定位到tcp_v4_conn_request函数，在文件net\ipv4\tcp_ipv4.c中。

?View Code Cint tcp_v4_conn_request&#40;struct sock *sk, struct sk_buff *skb&#41;
&#123;
	struct inet_request_sock *ireq;
	struct tcp_options_received tmp_opt;
	struct request_sock *req;
	__be32 saddr = ip_hdr&#40;skb&#41;-&#62;saddr;
	__be32 daddr = ip_hdr&#40;skb&#41;-&#62;daddr;
	__u32 isn = TCP_SKB_CB&#40;skb&#41;-&#62;when;
	struct dst_entry *dst = NULL;
#ifdef CONFIG_SYN_COOKIES
	int want_cookie = 0;
#else
#define want_cookie 0 /* Argh, why doesn't gcc optimize this :( */
#endif
&#160;
	/* Never answer to SYNs send to broadcast or multicast */
	if &#40;skb-&#62;rtable-&#62;rt_flags [...]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25B8%2580&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25BA%258C">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux诡异的半连接(SYN_RECV)队列长度(一)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E6%25B7%25BB%25E5%258A%25A0%25E6%2596%25B0%25E7%25A1%25AC%25E7%259B%2598&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25BA%258C">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux添加新硬盘</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E7%25B3%25BB%25E7%25BB%259F%25E4%25B8%258B%25E7%259A%2584%25E7%25BD%2591%25E7%25BB%259C%25E7%259B%2591%25E5%2590%25AC%25E6%258A%2580%25E6%259C%25AF&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25BA%258C">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux系统下的网络监听技术</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E5%25AE%2589%25E5%2585%25A8%25E9%2598%25B2%25E6%258A%25A4%25E5%258D%2581%25E5%25A4%25A7%25E6%258B%259B%25E6%2595%25B0&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25BA%258C">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux安全防护十大招数</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258Elinux%25E7%259A%2584subversion%25E9%2585%258D%25E7%25BD%25AE&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25BA%258C">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">基于Linux的Subversion配置</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" 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>继续上回：我们已经确认了全连接队列的长度计算，接下来继续寻找半连接队列长度。<br />
试着慢慢减小tcp_max_syn_backlog的值，但还是看不到半连接状态数量的变化。<br />
实在没什么思路，只能Google之，搜出来的基本都是关于SYN Flood的文章，难道没同学关注过半连接队列的长度吗？<span id="more-990"></span><br />
困扰数日终于在某个夜晚被我找一篇题为<a href="http://blog.chinaunix.net/space.php?uid=20357359&#038;do=blog&#038;id=1963498" target="_blank">《关于半连接队列的释疑》</a>的文章，激动呐。根据作者提供的思路我开始翻代码，注意我用的内核版本2.6.32，不同版本代码也有差异。<br />
首先定位到tcp_v4_conn_request函数，在文件net\ipv4\tcp_ipv4.c中。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p990code11'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p99011"><td class="code" id="p990code11"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> tcp_v4_conn_request<span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> sock <span style="color: #339933;">*</span>sk<span style="color: #339933;">,</span> <span style="color: #993333;">struct</span> sk_buff <span style="color: #339933;">*</span>skb<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #993333;">struct</span> inet_request_sock <span style="color: #339933;">*</span>ireq<span style="color: #339933;">;</span>
	<span style="color: #993333;">struct</span> tcp_options_received tmp_opt<span style="color: #339933;">;</span>
	<span style="color: #993333;">struct</span> request_sock <span style="color: #339933;">*</span>req<span style="color: #339933;">;</span>
	__be32 saddr <span style="color: #339933;">=</span> ip_hdr<span style="color: #009900;">&#40;</span>skb<span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>saddr<span style="color: #339933;">;</span>
	__be32 daddr <span style="color: #339933;">=</span> ip_hdr<span style="color: #009900;">&#40;</span>skb<span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>daddr<span style="color: #339933;">;</span>
	__u32 isn <span style="color: #339933;">=</span> TCP_SKB_CB<span style="color: #009900;">&#40;</span>skb<span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>when<span style="color: #339933;">;</span>
	<span style="color: #993333;">struct</span> dst_entry <span style="color: #339933;">*</span>dst <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
<span style="color: #339933;">#ifdef CONFIG_SYN_COOKIES</span>
	<span style="color: #993333;">int</span> want_cookie <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #339933;">#else</span>
<span style="color: #339933;">#define want_cookie 0 /* Argh, why doesn't gcc optimize this :( */</span>
<span style="color: #339933;">#endif</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">/* Never answer to SYNs send to broadcast or multicast */</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>skb<span style="color: #339933;">-&gt;</span>rtable<span style="color: #339933;">-&gt;</span>rt_flags <span style="color: #339933;">&amp;</span> <span style="color: #009900;">&#40;</span>RTCF_BROADCAST <span style="color: #339933;">|</span> RTCF_MULTICAST<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">goto</span> drop<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">/* TW buckets are converted to open requests without
	 * limitations, they conserve resources and peer is
	 * evidently real one.
	 */</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//关键函数inet_csk_reqsk_queue_is_full</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>inet_csk_reqsk_queue_is_full<span style="color: #009900;">&#40;</span>sk<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>isn<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #339933;">#ifdef CONFIG_SYN_COOKIES</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>sysctl_tcp_syncookies<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			want_cookie <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span>
<span style="color: #339933;">#endif</span>
		<span style="color: #b1b100;">goto</span> drop<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">/* Accept backlog is full. If we have already queued enough
	 * of warm entries in syn queue, drop request. It is better than
	 * clogging syn queue with openreqs with exponentially increasing
	 * timeout.
	 */</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>sk_acceptq_is_full<span style="color: #009900;">&#40;</span>sk<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> inet_csk_reqsk_queue_young<span style="color: #009900;">&#40;</span>sk<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">goto</span> drop<span style="color: #339933;">;</span>
&nbsp;
	req <span style="color: #339933;">=</span> inet_reqsk_alloc<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>tcp_request_sock_ops<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>req<span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">goto</span> drop<span style="color: #339933;">;</span>
省略N多代码</pre></td></tr></table></div>

<p>跟进关键函数inet_csk_reqsk_queue_is_full，在文件include\net\inet_connection_sock.h中。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p990code12'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p99012"><td class="code" id="p990code12"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">static</span> <span style="color: #000000; font-weight: bold;">inline</span> <span style="color: #993333;">int</span> inet_csk_reqsk_queue_is_full<span style="color: #009900;">&#40;</span><span style="color: #993333;">const</span> <span style="color: #993333;">struct</span> sock <span style="color: #339933;">*</span>sk<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">return</span> reqsk_queue_is_full<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>inet_csk<span style="color: #009900;">&#40;</span>sk<span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>icsk_accept_queue<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>跟进关键函数reqsk_queue_is_full，在文件include\net\request_sock.h中。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p990code13'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p99013"><td class="code" id="p990code13"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">static</span> <span style="color: #000000; font-weight: bold;">inline</span> <span style="color: #993333;">int</span> reqsk_queue_is_full<span style="color: #009900;">&#40;</span><span style="color: #993333;">const</span> <span style="color: #993333;">struct</span> request_sock_queue <span style="color: #339933;">*</span>queue<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">//注意这里是用&gt;&gt;(右移)来判断的，不是大于号</span>
	<span style="color: #b1b100;">return</span> queue<span style="color: #339933;">-&gt;</span>listen_opt<span style="color: #339933;">-&gt;</span>qlen <span style="color: #339933;">&gt;&gt;</span> queue<span style="color: #339933;">-&gt;</span>listen_opt<span style="color: #339933;">-&gt;</span>max_qlen_log<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>查找qlen和max_qlen_log的定义，在文件include\net\request_sock.h中。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p990code14'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p99014"><td class="code" id="p990code14"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/** struct listen_sock - listen state
 *
 * @max_qlen_log - log_2 of maximal queued SYNs/REQUESTs
 */</span>
<span style="color: #993333;">struct</span> listen_sock <span style="color: #009900;">&#123;</span>
	u8			max_qlen_log<span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">// 2^max_qlen_log = 半连接队列最大长度</span>
	<span style="color: #808080; font-style: italic;">/* 3 bytes hole, try to use */</span>
	<span style="color: #993333;">int</span>			qlen<span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//全连接队列的当前长度</span>
	<span style="color: #993333;">int</span>			qlen_young<span style="color: #339933;">;</span>
	<span style="color: #993333;">int</span>			clock_hand<span style="color: #339933;">;</span>
	u32			hash_rnd<span style="color: #339933;">;</span>
	u32			nr_table_entries<span style="color: #339933;">;</span>
	<span style="color: #993333;">struct</span> request_sock	<span style="color: #339933;">*</span>syn_table<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>可见关键是如何计算max_qlen_log，前一篇提到了listen的系统调用：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p990code15'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p99015"><td class="code" id="p990code15"><pre class="c" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//file:net/socket.c</span>
&nbsp;
SYSCALL_DEFINE2<span style="color: #009900;">&#40;</span>listen<span style="color: #339933;">,</span> <span style="color: #993333;">int</span><span style="color: #339933;">,</span> fd<span style="color: #339933;">,</span> <span style="color: #993333;">int</span><span style="color: #339933;">,</span> backlog<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #993333;">struct</span> socket <span style="color: #339933;">*</span>sock<span style="color: #339933;">;</span>
	<span style="color: #993333;">int</span> err<span style="color: #339933;">,</span> fput_needed<span style="color: #339933;">;</span>
	<span style="color: #993333;">int</span> somaxconn<span style="color: #339933;">;</span>
&nbsp;
	sock <span style="color: #339933;">=</span> sockfd_lookup_light<span style="color: #009900;">&#40;</span>fd<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>err<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>fput_needed<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>sock<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		somaxconn <span style="color: #339933;">=</span> sock_net<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">-&gt;</span>sk<span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>core.<span style="color: #202020;">sysctl_somaxconn</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">//上限不超过somaxconn</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">unsigned</span><span style="color: #009900;">&#41;</span>backlog <span style="color: #339933;">&gt;</span> somaxconn<span style="color: #009900;">&#41;</span>
			backlog <span style="color: #339933;">=</span> somaxconn<span style="color: #339933;">;</span>
&nbsp;
		err <span style="color: #339933;">=</span> security_socket_listen<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> backlog<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>err<span style="color: #009900;">&#41;</span>
		        <span style="color: #666666; font-style: italic;">//这里是关键。</span>
			err <span style="color: #339933;">=</span> sock<span style="color: #339933;">-&gt;</span>ops<span style="color: #339933;">-&gt;</span>listen<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> backlog<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		fput_light<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">-&gt;</span>file<span style="color: #339933;">,</span> fput_needed<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> err<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>sock->ops->listen其实是inet_listen，在文件net\ipv4\af_inet.c中。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p990code16'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p99016"><td class="code" id="p990code16"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> inet_listen<span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> socket <span style="color: #339933;">*</span>sock<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> backlog<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #993333;">struct</span> sock <span style="color: #339933;">*</span>sk <span style="color: #339933;">=</span> sock<span style="color: #339933;">-&gt;</span>sk<span style="color: #339933;">;</span>
	<span style="color: #993333;">unsigned</span> <span style="color: #993333;">char</span> old_state<span style="color: #339933;">;</span>
	<span style="color: #993333;">int</span> err<span style="color: #339933;">;</span>
&nbsp;
	lock_sock<span style="color: #009900;">&#40;</span>sk<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	err <span style="color: #339933;">=</span> <span style="color: #339933;">-</span>EINVAL<span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">-&gt;</span>state <span style="color: #339933;">!=</span> SS_UNCONNECTED <span style="color: #339933;">||</span> sock<span style="color: #339933;">-&gt;</span>type <span style="color: #339933;">!=</span> SOCK_STREAM<span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">goto</span> out<span style="color: #339933;">;</span>
&nbsp;
	old_state <span style="color: #339933;">=</span> sk<span style="color: #339933;">-&gt;</span>sk_state<span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span> <span style="color: #339933;">&lt;&lt;</span> old_state<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span> <span style="color: #009900;">&#40;</span>TCPF_CLOSE <span style="color: #339933;">|</span> TCPF_LISTEN<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">goto</span> out<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">/* Really, if the socket is already in listen state
	 * we can only allow the backlog to be adjusted.
	 */</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>old_state <span style="color: #339933;">!=</span> TCP_LISTEN<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	        <span style="color: #666666; font-style: italic;">//关键函数inet_csk_listen_start</span>
		err <span style="color: #339933;">=</span> inet_csk_listen_start<span style="color: #009900;">&#40;</span>sk<span style="color: #339933;">,</span> backlog<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>err<span style="color: #009900;">&#41;</span>
			<span style="color: #b1b100;">goto</span> out<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	sk<span style="color: #339933;">-&gt;</span>sk_max_ack_backlog <span style="color: #339933;">=</span> backlog<span style="color: #339933;">;</span>
	err <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
out<span style="color: #339933;">:</span>
	release_sock<span style="color: #009900;">&#40;</span>sk<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> err<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>跟进inet_csk_listen_start，在文件net\ipv4\inet_connection_sock.c中。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p990code17'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p99017"><td class="code" id="p990code17"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> inet_csk_listen_start<span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> sock <span style="color: #339933;">*</span>sk<span style="color: #339933;">,</span> <span style="color: #993333;">const</span> <span style="color: #993333;">int</span> nr_table_entries<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #993333;">struct</span> inet_sock <span style="color: #339933;">*</span>inet <span style="color: #339933;">=</span> inet_sk<span style="color: #009900;">&#40;</span>sk<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #993333;">struct</span> inet_connection_sock <span style="color: #339933;">*</span>icsk <span style="color: #339933;">=</span> inet_csk<span style="color: #009900;">&#40;</span>sk<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//关键函数reqsk_queue_alloc</span>
	<span style="color: #993333;">int</span> rc <span style="color: #339933;">=</span> reqsk_queue_alloc<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>icsk<span style="color: #339933;">-&gt;</span>icsk_accept_queue<span style="color: #339933;">,</span> nr_table_entries<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #666666; font-style: italic;">//后面省略</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>跟进reqsk_queue_alloc，在文件net\core\request_sock.c中。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p990code18'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p99018"><td class="code" id="p990code18"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> reqsk_queue_alloc<span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> request_sock_queue <span style="color: #339933;">*</span>queue<span style="color: #339933;">,</span>
		      <span style="color: #993333;">unsigned</span> <span style="color: #993333;">int</span> nr_table_entries<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	size_t lopt_size <span style="color: #339933;">=</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> listen_sock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #993333;">struct</span> listen_sock <span style="color: #339933;">*</span>lopt<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">//这里开始影响到nr_table_entries的取值，内核版本小于2.6.20的话nr_table_entries是不会修改的</span>
        nr_table_entries <span style="color: #339933;">=</span> min_t<span style="color: #009900;">&#40;</span>u32<span style="color: #339933;">,</span> nr_table_entries<span style="color: #339933;">,</span> sysctl_max_syn_backlog<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	nr_table_entries <span style="color: #339933;">=</span> max_t<span style="color: #009900;">&#40;</span>u32<span style="color: #339933;">,</span> nr_table_entries<span style="color: #339933;">,</span> <span style="color: #0000dd;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	nr_table_entries <span style="color: #339933;">=</span> roundup_pow_of_two<span style="color: #009900;">&#40;</span>nr_table_entries <span style="color: #339933;">+</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//nr_table_entries到这里已经确定</span>
	lopt_size <span style="color: #339933;">+=</span> nr_table_entries <span style="color: #339933;">*</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> request_sock <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>lopt_size <span style="color: #339933;">&gt;</span> PAGE_SIZE<span style="color: #009900;">&#41;</span>
		lopt <span style="color: #339933;">=</span> __vmalloc<span style="color: #009900;">&#40;</span>lopt_size<span style="color: #339933;">,</span>
			GFP_KERNEL <span style="color: #339933;">|</span> __GFP_HIGHMEM <span style="color: #339933;">|</span> __GFP_ZERO<span style="color: #339933;">,</span>
			PAGE_KERNEL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">else</span>
		lopt <span style="color: #339933;">=</span> kzalloc<span style="color: #009900;">&#40;</span>lopt_size<span style="color: #339933;">,</span> GFP_KERNEL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>lopt <span style="color: #339933;">==</span> NULL<span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span>ENOMEM<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">//这里确定了lopt-&gt;max_qlen_log的值</span>
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>lopt<span style="color: #339933;">-&gt;</span>max_qlen_log <span style="color: #339933;">=</span> <span style="color: #0000dd;">3</span><span style="color: #339933;">;</span>
	     <span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span> <span style="color: #339933;">&lt;&lt;</span> lopt<span style="color: #339933;">-&gt;</span>max_qlen_log<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> nr_table_entries<span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//内核版本小于2.6.20的话这里是sysctl_max_syn_backlog</span>
	     lopt<span style="color: #339933;">-&gt;</span>max_qlen_log<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	get_random_bytes<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>lopt<span style="color: #339933;">-&gt;</span>hash_rnd<span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>lopt<span style="color: #339933;">-&gt;</span>hash_rnd<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	rwlock_init<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>queue<span style="color: #339933;">-&gt;</span>syn_wait_lock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	queue<span style="color: #339933;">-&gt;</span>rskq_accept_head <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
	lopt<span style="color: #339933;">-&gt;</span>nr_table_entries <span style="color: #339933;">=</span> nr_table_entries<span style="color: #339933;">;</span>
&nbsp;
	write_lock_bh<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>queue<span style="color: #339933;">-&gt;</span>syn_wait_lock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	queue<span style="color: #339933;">-&gt;</span>listen_opt <span style="color: #339933;">=</span> lopt<span style="color: #339933;">;</span>
	write_unlock_bh<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>queue<span style="color: #339933;">-&gt;</span>syn_wait_lock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>代码到此为止，然后我们计算一下为何在虚拟机S上的SYN_RECV状态数量会是<font color='red'>256</font></p>
<p>        nr_table_entries = listen的第二个参数int backlog ，<font color='red'>上限是系统的somaxconn</font><br />
	若  somaxconn = 128  sysctl_max_syn_backlog = 4096 backlog = 511 则<font color='red'> nr_table_entries = 128 </font></p>
<p>	nr_table_entries = min_t(u32, nr_table_entries, sysctl_max_syn_backlog);<br />
	取两者较小的一个<font color='red'> nr_table_entries = 128</font></p>
<p>	nr_table_entries = max_t(u32, nr_table_entries, 8);<br />
	取两者较大的一个<font color='red'> nr_table_entries = 128 </font></p>
<p>	nr_table_entries = roundup_pow_of_two(nr_table_entries + 1);  //roundup_pow_of_two - round the given value up to nearest power of two<br />
	<font color='red'> roundup_pow_of_two(128 + 1) = 256 </font></p>
<p>	for (lopt->max_qlen_log = 3; (1 << lopt->max_qlen_log) < nr_table_entries; lopt->max_qlen_log++);<br />
	<font color='red'> max_qlen_log = 8 </font></p>
<p>	判断半连接队列是否满 queue->listen_opt->qlen >> queue->listen_opt->max_qlen_log;<br />
 <font color='red'> queue->listen_opt->qlen = 256 </font> 时reqsk_queue_is_full返回1 , 进入drop<br />
	所以queue->listen_opt->qlen 取值<font color='red'> 0~255</font>， 因此SYN_RECV状态数量会是<font color='red'> 256 </font></p>
<p>	另外同事的测试结果为何与我的不同？<br />
	因为内核版本小于2.6.20的话max_qlen_log是直接由<font color='red'>sysctl_max_syn_backlog</font>决定的，所以半连接队列的长度就是等于sysctl_max_syn_backlog<br />
       文章有点长，不过总算是把问题给解决了。这里要特别感谢雨哥(<a href="http://blog.chinaunix.net/space.php?uid=20043340" target="_blank">博客</a>)，很多代码是他带着我分析的。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25B8%2580&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25BA%258C">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux诡异的半连接(SYN_RECV)队列长度(一)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E6%25B7%25BB%25E5%258A%25A0%25E6%2596%25B0%25E7%25A1%25AC%25E7%259B%2598&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25BA%258C">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux添加新硬盘</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E7%25B3%25BB%25E7%25BB%259F%25E4%25B8%258B%25E7%259A%2584%25E7%25BD%2591%25E7%25BB%259C%25E7%259B%2591%25E5%2590%25AC%25E6%258A%2580%25E6%259C%25AF&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25BA%258C">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux系统下的网络监听技术</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E5%25AE%2589%25E5%2585%25A8%25E9%2598%25B2%25E6%258A%25A4%25E5%258D%2581%25E5%25A4%25A7%25E6%258B%259B%25E6%2595%25B0&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25BA%258C">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux安全防护十大招数</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258Elinux%25E7%259A%2584subversion%25E9%2585%258D%25E7%25BD%25AE&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25BA%258C">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">基于Linux的Subversion配置</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" 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://www.piao2010.com/linux%e8%af%a1%e5%bc%82%e7%9a%84%e5%8d%8a%e8%bf%9e%e6%8e%a5syn_recv%e9%98%9f%e5%88%97%e9%95%bf%e5%ba%a6%e4%ba%8c/feed</wfw:commentRss>
		</item>
		<item>
		<title>linux诡异的半连接(SYN_RECV)队列长度(一)</title>
		<link>http://www.piao2010.com/linux%e8%af%a1%e5%bc%82%e7%9a%84%e5%8d%8a%e8%bf%9e%e6%8e%a5syn_recv%e9%98%9f%e5%88%97%e9%95%bf%e5%ba%a6%e4%b8%80</link>
		<comments>http://www.piao2010.com/linux%e8%af%a1%e5%bc%82%e7%9a%84%e5%8d%8a%e8%bf%9e%e6%8e%a5syn_recv%e9%98%9f%e5%88%97%e9%95%bf%e5%ba%a6%e4%b8%80#comments</comments>
		<pubDate>Sat, 19 Nov 2011 04:19:14 +0000</pubDate>
		<dc:creator>飘(piao2010)</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[安全相关]]></category>

		<category><![CDATA[somaxconn]]></category>

		<category><![CDATA[SYN Flood]]></category>

		<category><![CDATA[SYN_RECV]]></category>

		<category><![CDATA[tcp_max_syn_backlog]]></category>

		<category><![CDATA[半连接]]></category>

		<guid isPermaLink="false">http://www.piao2010.com/?p=969</guid>
		<description><![CDATA[linux诡异的半连接(SYN_RECV)队列长度<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25BA%258C&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25B8%2580">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux诡异的半连接(SYN_RECV)队列长度(二)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E5%25AE%2589%25E5%2585%25A8%25E9%2598%25B2%25E6%258A%25A4%25E5%258D%2581%25E5%25A4%25A7%25E6%258B%259B%25E6%2595%25B0&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25B8%2580">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux安全防护十大招数</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E6%25B7%25BB%25E5%258A%25A0%25E6%2596%25B0%25E7%25A1%25AC%25E7%259B%2598&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25B8%2580">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux添加新硬盘</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E7%25B3%25BB%25E7%25BB%259F%25E4%25B8%258B%25E7%259A%2584%25E7%25BD%2591%25E7%25BB%259C%25E7%259B%2591%25E5%2590%25AC%25E6%258A%2580%25E6%259C%25AF&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25B8%2580">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux系统下的网络监听技术</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258Elinux%25E7%259A%2584subversion%25E9%2585%258D%25E7%25BD%25AE&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25B8%2580">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">基于Linux的Subversion配置</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" 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>最近在学习TCP方面的基础知识，对于古老的SYN Flood也有了更多认识。SYN Flood利用的是TCP协议缺陷，发送大量伪造的TCP连接请求，从而使得被攻击方资源耗尽（CPU满负荷或内存不足）的攻击方式。<br />
SYN Flood的原理简单，实现也不复杂，而且网上有许多现成的程序。</p>
<p>我在两台虚拟机上(虚拟机C攻击虚拟机S)做测试，S上跑了apache监听80端口，用C对S的80端口发送SYN Flood，在无任何防护的情况下攻击效果显著。用netstat可以看见80端口存在大量的半连接状态(SYN_RECV)，用tcpdump抓包可以看见大量伪造IP发来的SYN连接，S也不断回复<font color='red'>SYN+ACK</font>给对方，可惜对方并不存在(如果存在则S会收到<font color='red'>RST</font>这样就失去效果了)，所以会超时重传。<br />
这个时候如果有正常客户A请求S的80端口，它的SYN包就被S丢弃了，因为半连接队列已经满了，达到攻击目的。<span id="more-969"></span></p>
<p>对于SYN Flood的防御一般会提到修改 net.ipv4.tcp_synack_retries, net.ipv4.tcp_syncookies, net.ipv4.tcp_max_syn_backlog<br />
目的就是减小SYN+ACK重传次数，增加半连接队列长度，启用syn cookie。<br />
当S开启syn cookie的时候情况会缓解，一旦半连接队列满了系统就会启用syn cookie功能，同时在/var/log/messages记录kernel: possible SYN flooding on port 80. Sending cookies.<br />
但也不是可以完全防御的，如果说攻击瞬间并发量足够大，毕竟S的CPU内存有限，一般大公司都有专业的防火墙设备来应对。</p>
<p>其中对于net.ipv4.tcp_max_syn_backlog的描述一般都称为半连接队列的长度，但在我实际测试的过程中却发现SYN_RECV状态的数量与net.ipv4.tcp_max_syn_backlog设置的值相差甚远。<br />
S系统配置如下：<br />
net.ipv4.tcp_synack_retries = 5<br />
net.ipv4.tcp_syncookies = 0<br />
<font color='red'>net.ipv4.tcp_max_syn_backlog = 4096</font><br />
但SYN_RECV状态的数量却只有<font color='red'>256</font></p>
<p>于是就开始相关资料，首先想到的是TCP/IP详解卷1中提到的backlog，man 2 listen:<br />
int listen(int sockfd, int backlog);<br />
       The  backlog  parameter defines the maximum length the queue of pending connections may grow to.  If a connection request arrives with<br />
       the queue full the client may receive an error with an indication of ECONNREFUSED or, if the underlying protocol supports  retransmis-<br />
       sion, the request may be ignored so that retries succeed.</p>
<p>NOTES<br />
       The behaviour of the backlog parameter on TCP sockets changed with Linux 2.2.  Now it specifies the queue length for completely estab-<br />
       lished sockets waiting to be accepted, instead of the number of incomplete connection requests. The maximum length of  the  queue  for<br />
       incomplete  sockets  can  be set using the tcp_max_syn_backlog sysctl.  When syncookies are enabled there is no logical maximum length<br />
       and this sysctl setting is ignored.  See tcp(7) for more information.</p>
<p><font color='red'>可见backlog在Linux 2.2之后表示的是已完成三次握手但还未被应用程序accept的队列长度。</font></p>
<p>man 7 tcp:<br />
tcp_max_syn_backlog (integer; default: see below)<br />
              The maximum number of queued connection requests which have still not received an acknowledgement from the  connecting  client.<br />
              If  this  number  is exceeded, the kernel will begin dropping requests.  The default value of 256 is increased to 1024 when the<br />
              memory present in the system is adequate or greater (>= 128Mb), and reduced to 128 for those systems with very low  memory  (<=<br />
              32Mb).   It  is  recommended  that if this needs to be increased above 1024, TCP_SYNQ_HSIZE in include/net/tcp.h be modified to<br />
              keep TCP_SYNQ_HSIZE*16<=tcp_max_syn_backlog, and the kernel be recompiled.</p>
<p>可见tcp_max_syn_backlog确实是半连接队列的长度，那为何会不准呢？<br />
这时候正好让同事也在两台机器上测试了一下，得到的数据居然与tcp_max_syn_backlog完全一致。<br />
开始怀疑是系统哪个地方配置有问题，又发现一个可疑的配置 net.core.somaxconn 它是listen的第二个参数int backlog的上限值，如果程序里的backlog大于<br />
net.core.somaxconn的话就会取net.core.somaxconn的值。S系统的<font color='red'>net.core.somaxconn = 128</font></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p969code19'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p96919"><td class="code" id="p969code19"><pre class="c" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//file:net/socket.c</span>
&nbsp;
SYSCALL_DEFINE2<span style="color: #009900;">&#40;</span>listen<span style="color: #339933;">,</span> <span style="color: #993333;">int</span><span style="color: #339933;">,</span> fd<span style="color: #339933;">,</span> <span style="color: #993333;">int</span><span style="color: #339933;">,</span> backlog<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #993333;">struct</span> socket <span style="color: #339933;">*</span>sock<span style="color: #339933;">;</span>
	<span style="color: #993333;">int</span> err<span style="color: #339933;">,</span> fput_needed<span style="color: #339933;">;</span>
	<span style="color: #993333;">int</span> somaxconn<span style="color: #339933;">;</span>
&nbsp;
	sock <span style="color: #339933;">=</span> sockfd_lookup_light<span style="color: #009900;">&#40;</span>fd<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>err<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>fput_needed<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>sock<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		somaxconn <span style="color: #339933;">=</span> sock_net<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">-&gt;</span>sk<span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>core.<span style="color: #202020;">sysctl_somaxconn</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">//上限不超过somaxconn</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">unsigned</span><span style="color: #009900;">&#41;</span>backlog <span style="color: #339933;">&gt;</span> somaxconn<span style="color: #009900;">&#41;</span>
			backlog <span style="color: #339933;">=</span> somaxconn<span style="color: #339933;">;</span>
&nbsp;
		err <span style="color: #339933;">=</span> security_socket_listen<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> backlog<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>err<span style="color: #009900;">&#41;</span>
			err <span style="color: #339933;">=</span> sock<span style="color: #339933;">-&gt;</span>ops<span style="color: #339933;">-&gt;</span>listen<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> backlog<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		fput_light<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">-&gt;</span>file<span style="color: #339933;">,</span> fput_needed<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> err<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>查了apache文档关于ListenBackLog 指令的说明，默认值是511.  可见最终全连接队列(backlog)应该是net.core.somaxconn = 128<br />
证实这点比较容易，用<a href="http://www.piao2010.com/%E4%B8%80%E6%AC%A1%E5%88%86%E4%BA%AB%E5%BC%95%E5%8F%91%E7%9A%84%E8%A1%80%E6%A1%88-http-post-denial-of-service" target="_blank">慢连接攻击</a>测试观察到虚拟机S的80端口ESTABLISHED状态最大数量384<br />
正好等于256(apache prefork模式MaxClients即apache可以响应的最大并发连接数) + 128(backlog即已完成三次握手等待apache accept的最大连接数)。说明全连接队列长度等于<font color='red'>min(backlog,somaxconn);</font><br />
好久没写这么多文字了，下回<a href="http://www.piao2010.com/linux%E8%AF%A1%E5%BC%82%E7%9A%84%E5%8D%8A%E8%BF%9E%E6%8E%A5syn_recv%E9%98%9F%E5%88%97%E9%95%BF%E5%BA%A6%E4%BA%8C" target="_blank" >linux诡异的半连接(SYN_RECV)队列长度(二)</a>继续。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25BA%258C&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25B8%2580">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux诡异的半连接(SYN_RECV)队列长度(二)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E5%25AE%2589%25E5%2585%25A8%25E9%2598%25B2%25E6%258A%25A4%25E5%258D%2581%25E5%25A4%25A7%25E6%258B%259B%25E6%2595%25B0&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25B8%2580">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux安全防护十大招数</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E6%25B7%25BB%25E5%258A%25A0%25E6%2596%25B0%25E7%25A1%25AC%25E7%259B%2598&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25B8%2580">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux添加新硬盘</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E7%25B3%25BB%25E7%25BB%259F%25E4%25B8%258B%25E7%259A%2584%25E7%25BD%2591%25E7%25BB%259C%25E7%259B%2591%25E5%2590%25AC%25E6%258A%2580%25E6%259C%25AF&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25B8%2580">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Linux系统下的网络监听技术</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258Elinux%25E7%259A%2584subversion%25E9%2585%258D%25E7%25BD%25AE&from=http%3A%2F%2Fwww.piao2010.com%2Flinux%25E8%25AF%25A1%25E5%25BC%2582%25E7%259A%2584%25E5%258D%258A%25E8%25BF%259E%25E6%258E%25A5syn_recv%25E9%2598%259F%25E5%2588%2597%25E9%2595%25BF%25E5%25BA%25A6%25E4%25B8%2580">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">基于Linux的Subversion配置</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" 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://www.piao2010.com/linux%e8%af%a1%e5%bc%82%e7%9a%84%e5%8d%8a%e8%bf%9e%e6%8e%a5syn_recv%e9%98%9f%e5%88%97%e9%95%bf%e5%ba%a6%e4%b8%80/feed</wfw:commentRss>
		</item>
		<item>
		<title>nginx module学习之ngx_http_not_modified_filter_module</title>
		<link>http://www.piao2010.com/nginx-module%e5%ad%a6%e4%b9%a0%e4%b9%8bngx_http_not_modified_filter_module</link>
		<comments>http://www.piao2010.com/nginx-module%e5%ad%a6%e4%b9%a0%e4%b9%8bngx_http_not_modified_filter_module#comments</comments>
		<pubDate>Sat, 22 Oct 2011 05:01:24 +0000</pubDate>
		<dc:creator>飘(piao2010)</dc:creator>
		
		<category><![CDATA[Nginx]]></category>

		<category><![CDATA[module]]></category>

		<category><![CDATA[高性能]]></category>

		<guid isPermaLink="false">http://www.piao2010.com/?p=954</guid>
		<description><![CDATA[整整半年没更新博客了，一方面是工作越来越忙：做不完的日常+学习主交易相关业务+各种报警故障处理。另外最近对nginx module比较感兴趣，可是偏偏C的编程功底差，所以学起来比较吃力，下班时间基本全搭进去了。
牛人都说nginx性能好，代码美，所以忍不住也想学习一下。网上推荐的资料主要是Emiller&#8217;s Guide To Nginx Module Development
英文不好的同学可以看看中文版的，不会那么吃力。另外网上还有各种版本的echo 模块范例，很适合新手入门。大致了解nginx module工作原理之后就可以开始学习nginx现有的module ，
首先从最简单的ngx_http_not_modified_filter开始吧。源文件在src/http/modules/ngx_http_not_modified_filter_module.c
之所以说它简单，是因为这个module 没有配置结构体，也没有指令。

?View Code C&#160;
/*
 * Copyright (C) Igor Sysoev
 */
&#160;
&#160;
#include &#60;ngx_config.h&#62;
#include &#60;ngx_core.h&#62;
#include &#60;ngx_http.h&#62;
&#160;
&#160;
static ngx_int_t ngx_http_test_precondition&#40;ngx_http_request_t *r&#41;;
static ngx_int_t ngx_http_test_not_modified&#40;ngx_http_request_t *r&#41;;
static ngx_int_t ngx_http_not_modified_filter_init&#40;ngx_conf_t *cf&#41;;
&#160;
/***************************************
模块上下文 context
只有一个 ngx_http_not_modified_filter_init
***************************************/
&#160;
static ngx_http_module_t  ngx_http_not_modified_filter_module_ctx = &#123;
    NULL,              [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><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="freebsd:Nginx+php+mysql" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Ffreebsdnginxphpmysql&from=http%3A%2F%2Fwww.piao2010.com%2Fnginx-module%25E5%25AD%25A6%25E4%25B9%25A0%25E4%25B9%258Bngx_http_not_modified_filter_module">
                        <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;">freebsd:Nginx+php+mysql</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="2011年个人总结" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F2011%25E5%25B9%25B4%25E4%25B8%25AA%25E4%25BA%25BA%25E6%2580%25BB%25E7%25BB%2593&from=http%3A%2F%2Fwww.piao2010.com%2Fnginx-module%25E5%25AD%25A6%25E4%25B9%25A0%25E4%25B9%258Bngx_http_not_modified_filter_module">
                        <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;">2011年个人总结</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="一次分享引发的血案 --- HTTP Post Denial Of Service" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E4%25B8%2580%25E6%25AC%25A1%25E5%2588%2586%25E4%25BA%25AB%25E5%25BC%2595%25E5%258F%2591%25E7%259A%2584%25E8%25A1%2580%25E6%25A1%2588-http-post-denial-of-service&from=http%3A%2F%2Fwww.piao2010.com%2Fnginx-module%25E5%25AD%25A6%25E4%25B9%25A0%25E4%25B9%258Bngx_http_not_modified_filter_module">
                        <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/11/29/11663736.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;">一次分享引发的血案 --- HTTP Post Denial Of Service</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="运用sslstrip进行中间人攻击(Bypass https)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E8%25BF%2590%25E7%2594%25A8sslstrip%25E8%25BF%259B%25E8%25A1%258C%25E4%25B8%25AD%25E9%2597%25B4%25E4%25BA%25BA%25E6%2594%25BB%25E5%2587%25BBbypass-https&from=http%3A%2F%2Fwww.piao2010.com%2Fnginx-module%25E5%25AD%25A6%25E4%25B9%25A0%25E4%25B9%258Bngx_http_not_modified_filter_module">
                        <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;">运用sslstrip进行中间人攻击(Bypass https)</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="破解禁止SSID广播" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E7%25A0%25B4%25E8%25A7%25A3%25E7%25A6%2581%25E6%25AD%25A2ssid%25E5%25B9%25BF%25E6%2592%25AD&from=http%3A%2F%2Fwww.piao2010.com%2Fnginx-module%25E5%25AD%25A6%25E4%25B9%25A0%25E4%25B9%258Bngx_http_not_modified_filter_module">
                        <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/11/29/11664017.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;">破解禁止SSID广播</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" 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>整整半年没更新博客了，一方面是工作越来越忙：做不完的日常+学习主交易相关业务+各种报警故障处理。另外最近对nginx module比较感兴趣，可是偏偏C的编程功底差，所以学起来比较吃力，下班时间基本全搭进去了。<br />
牛人都说nginx性能好，代码美，所以忍不住也想学习一下。网上推荐的资料主要是<a href="http://www.evanmiller.org/nginx-modules-guide.html" target="_blank">Emiller&#8217;s Guide To Nginx Module Development</a><br />
英文不好的同学可以看看中文版的，不会那么吃力。另外网上还有各种版本的echo 模块范例，很适合新手入门。大致了解nginx module工作原理之后就可以开始学习nginx现有的module ，<br />
首先从最简单的ngx_http_not_modified_filter开始吧。源文件在src/http/modules/ngx_http_not_modified_filter_module.c<br />
之所以说它简单，<span id="more-954"></span>是因为这个module 没有配置结构体，也没有指令。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p954code22'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p95422"><td class="code" id="p954code22"><pre class="c" style="font-family:monospace;">&nbsp;
<span style="color: #808080; font-style: italic;">/*
 * Copyright (C) Igor Sysoev
 */</span>
&nbsp;
&nbsp;
<span style="color: #339933;">#include &lt;ngx_config.h&gt;</span>
<span style="color: #339933;">#include &lt;ngx_core.h&gt;</span>
<span style="color: #339933;">#include &lt;ngx_http.h&gt;</span>
&nbsp;
&nbsp;
<span style="color: #993333;">static</span> ngx_int_t ngx_http_test_precondition<span style="color: #009900;">&#40;</span>ngx_http_request_t <span style="color: #339933;">*</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">static</span> ngx_int_t ngx_http_test_not_modified<span style="color: #009900;">&#40;</span>ngx_http_request_t <span style="color: #339933;">*</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">static</span> ngx_int_t ngx_http_not_modified_filter_init<span style="color: #009900;">&#40;</span>ngx_conf_t <span style="color: #339933;">*</span>cf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/***************************************
模块上下文 context
只有一个 ngx_http_not_modified_filter_init
***************************************/</span>
&nbsp;
<span style="color: #993333;">static</span> ngx_http_module_t  ngx_http_not_modified_filter_module_ctx <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
    NULL<span style="color: #339933;">,</span>                                  <span style="color: #808080; font-style: italic;">/* preconfiguration */</span>
    ngx_http_not_modified_filter_init<span style="color: #339933;">,</span>     <span style="color: #808080; font-style: italic;">/* postconfiguration */</span>
&nbsp;
    NULL<span style="color: #339933;">,</span>                                  <span style="color: #808080; font-style: italic;">/* create main configuration */</span>
    NULL<span style="color: #339933;">,</span>                                  <span style="color: #808080; font-style: italic;">/* init main configuration */</span>
&nbsp;
    NULL<span style="color: #339933;">,</span>                                  <span style="color: #808080; font-style: italic;">/* create server configuration */</span>
    NULL<span style="color: #339933;">,</span>                                  <span style="color: #808080; font-style: italic;">/* merge server configuration */</span>
&nbsp;
    NULL<span style="color: #339933;">,</span>                                  <span style="color: #808080; font-style: italic;">/* create location configuration */</span>
    NULL                                   <span style="color: #808080; font-style: italic;">/* merge location configuration */</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*********
模块定义
*********/</span>
&nbsp;
ngx_module_t  ngx_http_not_modified_filter_module <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
    NGX_MODULE_V1<span style="color: #339933;">,</span>
    <span style="color: #339933;">&amp;</span>ngx_http_not_modified_filter_module_ctx<span style="color: #339933;">,</span> <span style="color: #808080; font-style: italic;">/* module context */</span>
    NULL<span style="color: #339933;">,</span>                                  <span style="color: #808080; font-style: italic;">/* module directives */</span>
    NGX_HTTP_MODULE<span style="color: #339933;">,</span>                       <span style="color: #808080; font-style: italic;">/* module type */</span>
    NULL<span style="color: #339933;">,</span>                                  <span style="color: #808080; font-style: italic;">/* init master */</span>
    NULL<span style="color: #339933;">,</span>                                  <span style="color: #808080; font-style: italic;">/* init module */</span>
    NULL<span style="color: #339933;">,</span>                                  <span style="color: #808080; font-style: italic;">/* init process */</span>
    NULL<span style="color: #339933;">,</span>                                  <span style="color: #808080; font-style: italic;">/* init thread */</span>
    NULL<span style="color: #339933;">,</span>                                  <span style="color: #808080; font-style: italic;">/* exit thread */</span>
    NULL<span style="color: #339933;">,</span>                                  <span style="color: #808080; font-style: italic;">/* exit process */</span>
    NULL<span style="color: #339933;">,</span>                                  <span style="color: #808080; font-style: italic;">/* exit master */</span>
    NGX_MODULE_V1_PADDING
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #993333;">static</span> ngx_http_output_header_filter_pt  ngx_http_next_header_filter<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**********************************************
在函数ngx_http_not_modified_filter_init中被调用
**********************************************/</span>
&nbsp;
<span style="color: #993333;">static</span> ngx_int_t
ngx_http_not_modified_header_filter<span style="color: #009900;">&#40;</span>ngx_http_request_t <span style="color: #339933;">*</span>r<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">//如果不是主请求或者last_modified_time为－1则继续下一个filter</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>r<span style="color: #339933;">-&gt;</span>headers_out.<span style="color: #202020;">status</span> <span style="color: #339933;">!=</span> NGX_HTTP_OK
        <span style="color: #339933;">||</span> r <span style="color: #339933;">!=</span> r<span style="color: #339933;">-&gt;</span>main
        <span style="color: #339933;">||</span> r<span style="color: #339933;">-&gt;</span>headers_out.<span style="color: #202020;">last_modified_time</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> ngx_http_next_header_filter<span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//如果请求头带有if_unmodified_since字段则执行ngx_http_test_precondition(r)</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>r<span style="color: #339933;">-&gt;</span>headers_in.<span style="color: #202020;">if_unmodified_since</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> ngx_http_test_precondition<span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//如果请求头带有if_modified_since字段则执行ngx_http_test_not_modified(r)</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>r<span style="color: #339933;">-&gt;</span>headers_in.<span style="color: #202020;">if_modified_since</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> ngx_http_test_not_modified<span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> ngx_http_next_header_filter<span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #993333;">static</span> ngx_int_t
ngx_http_test_precondition<span style="color: #009900;">&#40;</span>ngx_http_request_t <span style="color: #339933;">*</span>r<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    time_t  iums<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//提取请求头中的if_unmodified_since保存到iums</span>
    iums <span style="color: #339933;">=</span> ngx_http_parse_time<span style="color: #009900;">&#40;</span>r<span style="color: #339933;">-&gt;</span>headers_in.<span style="color: #202020;">if_unmodified_since</span><span style="color: #339933;">-&gt;</span>value.<span style="color: #202020;">data</span><span style="color: #339933;">,</span>
                               r<span style="color: #339933;">-&gt;</span>headers_in.<span style="color: #202020;">if_unmodified_since</span><span style="color: #339933;">-&gt;</span>value.<span style="color: #202020;">len</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    ngx_log_debug2<span style="color: #009900;">&#40;</span>NGX_LOG_DEBUG_HTTP<span style="color: #339933;">,</span> r<span style="color: #339933;">-&gt;</span>connection<span style="color: #339933;">-&gt;</span>log<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span>
                 <span style="color: #ff0000;">&quot;http iums:%d lm:%d&quot;</span><span style="color: #339933;">,</span> iums<span style="color: #339933;">,</span> r<span style="color: #339933;">-&gt;</span>headers_out.<span style="color: #202020;">last_modified_time</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//如果iums 大于等于响应头的last_modified_time则继续下一个filter</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>iums <span style="color: #339933;">&gt;=</span> r<span style="color: #339933;">-&gt;</span>headers_out.<span style="color: #202020;">last_modified_time</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> ngx_http_next_header_filter<span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//否则响应PRECONDITION_FAILED</span>
    <span style="color: #b1b100;">return</span> ngx_http_filter_finalize_request<span style="color: #009900;">&#40;</span>r<span style="color: #339933;">,</span> NULL<span style="color: #339933;">,</span>
                                            NGX_HTTP_PRECONDITION_FAILED<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #993333;">static</span> ngx_int_t
ngx_http_test_not_modified<span style="color: #009900;">&#40;</span>ngx_http_request_t <span style="color: #339933;">*</span>r<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    time_t                     ims<span style="color: #339933;">;</span>
    ngx_http_core_loc_conf_t  <span style="color: #339933;">*</span>clcf<span style="color: #339933;">;</span>
&nbsp;
    clcf <span style="color: #339933;">=</span> ngx_http_get_module_loc_conf<span style="color: #009900;">&#40;</span>r<span style="color: #339933;">,</span> ngx_http_core_module<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//如果配置了NGX_HTTP_IMS_OFF直接进入下一个filter</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>clcf<span style="color: #339933;">-&gt;</span>if_modified_since <span style="color: #339933;">==</span> NGX_HTTP_IMS_OFF<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> ngx_http_next_header_filter<span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    ims <span style="color: #339933;">=</span> ngx_http_parse_time<span style="color: #009900;">&#40;</span>r<span style="color: #339933;">-&gt;</span>headers_in.<span style="color: #202020;">if_modified_since</span><span style="color: #339933;">-&gt;</span>value.<span style="color: #202020;">data</span><span style="color: #339933;">,</span>
                              r<span style="color: #339933;">-&gt;</span>headers_in.<span style="color: #202020;">if_modified_since</span><span style="color: #339933;">-&gt;</span>value.<span style="color: #202020;">len</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    ngx_log_debug2<span style="color: #009900;">&#40;</span>NGX_LOG_DEBUG_HTTP<span style="color: #339933;">,</span> r<span style="color: #339933;">-&gt;</span>connection<span style="color: #339933;">-&gt;</span>log<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span>
                   <span style="color: #ff0000;">&quot;http ims:%d lm:%d&quot;</span><span style="color: #339933;">,</span> ims<span style="color: #339933;">,</span> r<span style="color: #339933;">-&gt;</span>headers_out.<span style="color: #202020;">last_modified_time</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//如果iums不等于响应头的last_modified_time</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>ims <span style="color: #339933;">!=</span> r<span style="color: #339933;">-&gt;</span>headers_out.<span style="color: #202020;">last_modified_time</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//如果配置了NGX_HTTP_IMS_EXACT或者iums小于响应头的last_modified_time，继续下一个filter</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>clcf<span style="color: #339933;">-&gt;</span>if_modified_since <span style="color: #339933;">==</span> NGX_HTTP_IMS_EXACT
            <span style="color: #339933;">||</span> ims <span style="color: #339933;">&lt;</span> r<span style="color: #339933;">-&gt;</span>headers_out.<span style="color: #202020;">last_modified_time</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">return</span> ngx_http_next_header_filter<span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//产生http status 304响应</span>
    r<span style="color: #339933;">-&gt;</span>headers_out.<span style="color: #202020;">status</span> <span style="color: #339933;">=</span> NGX_HTTP_NOT_MODIFIED<span style="color: #339933;">;</span>
    r<span style="color: #339933;">-&gt;</span>headers_out.<span style="color: #202020;">status_line</span>.<span style="color: #202020;">len</span> <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    r<span style="color: #339933;">-&gt;</span>headers_out.<span style="color: #202020;">content_type</span>.<span style="color: #202020;">len</span> <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    ngx_http_clear_content_length<span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ngx_http_clear_accept_ranges<span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>r<span style="color: #339933;">-&gt;</span>headers_out.<span style="color: #202020;">content_encoding</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        r<span style="color: #339933;">-&gt;</span>headers_out.<span style="color: #202020;">content_encoding</span><span style="color: #339933;">-&gt;</span>hash <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
        r<span style="color: #339933;">-&gt;</span>headers_out.<span style="color: #202020;">content_encoding</span> <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> ngx_http_next_header_filter<span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/***************************************
相比典型的filter模块init，此模块少了body_filter，更简单
***************************************/</span>
&nbsp;
<span style="color: #993333;">static</span> ngx_int_t
ngx_http_not_modified_filter_init<span style="color: #009900;">&#40;</span>ngx_conf_t <span style="color: #339933;">*</span>cf<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    ngx_http_next_header_filter <span style="color: #339933;">=</span> ngx_http_top_header_filter<span style="color: #339933;">;</span>
    ngx_http_top_header_filter <span style="color: #339933;">=</span> ngx_http_not_modified_header_filter<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> NGX_OK<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>关于HTTP请求头中的if_unmodified_since 和 if_modified_since 字段可以参考<a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html" target="_blank">rfc2616</a></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p954code23'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p95423"><td class="code" id="p954code23"><pre class="c" style="font-family:monospace;"><span style="color:#800080;">14.25</span> If<span style="color: #339933;">-</span>Modified<span style="color: #339933;">-</span>Since
&nbsp;
The If<span style="color: #339933;">-</span>Modified<span style="color: #339933;">-</span>Since request<span style="color: #339933;">-</span>header field is used with a method to make it conditional<span style="color: #339933;">:</span> <span style="color: #b1b100;">if</span> the requested variant has not been modified since the time specified in this field<span style="color: #339933;">,</span> an entity will not be returned from the server<span style="color: #339933;">;</span> instead<span style="color: #339933;">,</span> a <span style="color: #0000dd;">304</span> <span style="color: #009900;">&#40;</span>not modified<span style="color: #009900;">&#41;</span> response will be returned without any message<span style="color: #339933;">-</span>body.
&nbsp;
       <span style="color: #202020;">If</span><span style="color: #339933;">-</span>Modified<span style="color: #339933;">-</span>Since <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;If-Modified-Since&quot;</span> <span style="color: #ff0000;">&quot;:&quot;</span> HTTP<span style="color: #339933;">-</span>date
An example of the field is<span style="color: #339933;">:</span>
&nbsp;
       If<span style="color: #339933;">-</span>Modified<span style="color: #339933;">-</span>Since<span style="color: #339933;">:</span> Sat<span style="color: #339933;">,</span> <span style="color: #0000dd;">29</span> Oct <span style="color: #0000dd;">1994</span> <span style="color: #0000dd;">19</span><span style="color: #339933;">:</span><span style="color: #0000dd;">43</span><span style="color: #339933;">:</span><span style="color: #0000dd;">31</span> GMT
A GET method with an If<span style="color: #339933;">-</span>Modified<span style="color: #339933;">-</span>Since header and no Range header requests that the identified entity be transferred only <span style="color: #b1b100;">if</span> it has been modified since the date given by the If<span style="color: #339933;">-</span>Modified<span style="color: #339933;">-</span>Since header. <span style="color: #202020;">The</span> algorithm <span style="color: #b1b100;">for</span> determining this includes the following cases<span style="color: #339933;">:</span>
&nbsp;
      a<span style="color: #009900;">&#41;</span> If the request would normally result in anything other than a
         <span style="color: #0000dd;">200</span> <span style="color: #009900;">&#40;</span>OK<span style="color: #009900;">&#41;</span> status<span style="color: #339933;">,</span> or <span style="color: #b1b100;">if</span> the passed If<span style="color: #339933;">-</span>Modified<span style="color: #339933;">-</span>Since date is
         invalid<span style="color: #339933;">,</span> the response is exactly the same as <span style="color: #b1b100;">for</span> a normal GET.
         <span style="color: #202020;">A</span> date which is later than the server<span style="color: #ff0000;">'s current time is
         invalid.
      b) If the variant has been modified since the If-Modified-Since
         date, the response is exactly the same as for a normal GET.
      c) If the variant has not been modified since a valid If-
         Modified-Since date, the server SHOULD return a 304 (Not
         Modified) response.
The purpose of this feature is to allow efficient updates of cached information with a minimum amount of transaction overhead.
&nbsp;
      Note: The Range request-header field modifies the meaning of If-
      Modified-Since; see section 14.35 for full details.
      Note: If-Modified-Since times are interpreted by the server, whose
      clock might not be synchronized with the client.
      Note: When handling an If-Modified-Since header field, some
      servers will use an exact date comparison function, rather than a
      less-than function, for deciding whether to send a 304 (Not
      Modified) response. To get best results when sending an If-
      Modified-Since header field for cache validation, clients are
      advised to use the exact date string received in a previous Last-
      Modified header field whenever possible.
      Note: If a client uses an arbitrary date in the If-Modified-Since
      header instead of a date taken from the Last-Modified header for
      the same request, the client should be aware of the fact that this
      date is interpreted in the server'</span>s understanding of time. <span style="color: #202020;">The</span>
      client should consider unsynchronized clocks and rounding problems
      due to the different encodings of time between the client and
      server. <span style="color: #202020;">This</span> includes the possibility of race conditions <span style="color: #b1b100;">if</span> the
      document has changed between the time it was first requested and
      the If<span style="color: #339933;">-</span>Modified<span style="color: #339933;">-</span>Since date of a subsequent request<span style="color: #339933;">,</span> and the
      possibility of clock<span style="color: #339933;">-</span>skew<span style="color: #339933;">-</span>related problems <span style="color: #b1b100;">if</span> the If<span style="color: #339933;">-</span>Modified<span style="color: #339933;">-</span>
      Since date is derived from the client<span style="color: #ff0000;">'s clock without correction
      to the server'</span>s clock. <span style="color: #202020;">Corrections</span> <span style="color: #b1b100;">for</span> different time bases
      between client and server are at best approximate due to network
      latency.
<span style="color: #202020;">The</span> result of a request having both an If<span style="color: #339933;">-</span>Modified<span style="color: #339933;">-</span>Since header field and either an If<span style="color: #339933;">-</span>Match or an If<span style="color: #339933;">-</span>Unmodified<span style="color: #339933;">-</span>Since header fields is undefined by this specification.
&nbsp;
<span style="color:#800080;">14.28</span> If<span style="color: #339933;">-</span>Unmodified<span style="color: #339933;">-</span>Since
&nbsp;
The If<span style="color: #339933;">-</span>Unmodified<span style="color: #339933;">-</span>Since request<span style="color: #339933;">-</span>header field is used with a method to make it conditional. <span style="color: #202020;">If</span> the requested resource has not been modified since the time specified in this field<span style="color: #339933;">,</span> the server SHOULD perform the requested operation as <span style="color: #b1b100;">if</span> the If<span style="color: #339933;">-</span>Unmodified<span style="color: #339933;">-</span>Since header were not present.
&nbsp;
<span style="color: #202020;">If</span> the requested variant has been modified since the specified time<span style="color: #339933;">,</span> the server MUST NOT perform the requested operation<span style="color: #339933;">,</span> and MUST <span style="color: #b1b100;">return</span> a <span style="color: #0000dd;">412</span> <span style="color: #009900;">&#40;</span>Precondition Failed<span style="color: #009900;">&#41;</span>.
&nbsp;
      <span style="color: #202020;">If</span><span style="color: #339933;">-</span>Unmodified<span style="color: #339933;">-</span>Since <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;If-Unmodified-Since&quot;</span> <span style="color: #ff0000;">&quot;:&quot;</span> HTTP<span style="color: #339933;">-</span>date
An example of the field is<span style="color: #339933;">:</span>
&nbsp;
       If<span style="color: #339933;">-</span>Unmodified<span style="color: #339933;">-</span>Since<span style="color: #339933;">:</span> Sat<span style="color: #339933;">,</span> <span style="color: #0000dd;">29</span> Oct <span style="color: #0000dd;">1994</span> <span style="color: #0000dd;">19</span><span style="color: #339933;">:</span><span style="color: #0000dd;">43</span><span style="color: #339933;">:</span><span style="color: #0000dd;">31</span> GMT
If the request normally <span style="color: #009900;">&#40;</span>i.<span style="color: #202020;">e</span>.<span style="color: #339933;">,</span> without the If<span style="color: #339933;">-</span>Unmodified<span style="color: #339933;">-</span>Since header<span style="color: #009900;">&#41;</span> would result in anything other than a 2xx or <span style="color: #0000dd;">412</span> status<span style="color: #339933;">,</span> the If<span style="color: #339933;">-</span>Unmodified<span style="color: #339933;">-</span>Since header SHOULD be ignored.
&nbsp;
<span style="color: #202020;">If</span> the specified date is invalid<span style="color: #339933;">,</span> the header is ignored.
&nbsp;
<span style="color: #202020;">The</span> result of a request having both an If<span style="color: #339933;">-</span>Unmodified<span style="color: #339933;">-</span>Since header field and either an If<span style="color: #339933;">-</span>None<span style="color: #339933;">-</span>Match or an If<span style="color: #339933;">-</span>Modified<span style="color: #339933;">-</span>Since header fields is undefined by this specification.
&nbsp;
<span style="color:#800080;">14.29</span> Last<span style="color: #339933;">-</span>Modified
&nbsp;
The Last<span style="color: #339933;">-</span>Modified entity<span style="color: #339933;">-</span>header field indicates the date and time at which the origin server believes the variant was last modified.
&nbsp;
       <span style="color: #202020;">Last</span><span style="color: #339933;">-</span>Modified  <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;Last-Modified&quot;</span> <span style="color: #ff0000;">&quot;:&quot;</span> HTTP<span style="color: #339933;">-</span>date
An example of its use is
&nbsp;
       Last<span style="color: #339933;">-</span>Modified<span style="color: #339933;">:</span> Tue<span style="color: #339933;">,</span> <span style="color: #0000dd;">15</span> Nov <span style="color: #0000dd;">1994</span> <span style="color: #0000dd;">12</span><span style="color: #339933;">:</span><span style="color: #0000dd;">45</span><span style="color: #339933;">:</span><span style="color: #0000dd;">26</span> GMT
The exact meaning of this header field depends on the implementation of the origin server and the nature of the original resource. <span style="color: #202020;">For</span> files<span style="color: #339933;">,</span> it may be just the file system last<span style="color: #339933;">-</span>modified time. <span style="color: #202020;">For</span> entities with dynamically included parts<span style="color: #339933;">,</span> it may be the most recent of the set of last<span style="color: #339933;">-</span>modify times <span style="color: #b1b100;">for</span> its component parts. <span style="color: #202020;">For</span> database gateways<span style="color: #339933;">,</span> it may be the last<span style="color: #339933;">-</span>update time stamp of the record. <span style="color: #202020;">For</span> virtual objects<span style="color: #339933;">,</span> it may be the last time the internal state changed.
&nbsp;
<span style="color: #202020;">An</span> origin server MUST NOT send a Last<span style="color: #339933;">-</span>Modified date which is later than the server<span style="color: #ff0000;">'s time of message origination. In such cases, where the resource'</span>s last modification would indicate some time in the future<span style="color: #339933;">,</span> the server MUST replace that date with the message origination date.
&nbsp;
<span style="color: #202020;">An</span> origin server SHOULD obtain the Last<span style="color: #339933;">-</span>Modified value of the entity as close as possible to the time that it generates the Date value of its response. <span style="color: #202020;">This</span> allows a recipient to make an accurate assessment of the entity<span style="color: #ff0000;">'s modification time, especially if the entity changes near the time that the response is generated.
&nbsp;
HTTP/1.1 servers SHOULD send Last-Modified whenever feasible.</span></pre></td></tr></table></div>

<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><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="freebsd:Nginx+php+mysql" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Ffreebsdnginxphpmysql&from=http%3A%2F%2Fwww.piao2010.com%2Fnginx-module%25E5%25AD%25A6%25E4%25B9%25A0%25E4%25B9%258Bngx_http_not_modified_filter_module">
                        <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;">freebsd:Nginx+php+mysql</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="2011年个人总结" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F2011%25E5%25B9%25B4%25E4%25B8%25AA%25E4%25BA%25BA%25E6%2580%25BB%25E7%25BB%2593&from=http%3A%2F%2Fwww.piao2010.com%2Fnginx-module%25E5%25AD%25A6%25E4%25B9%25A0%25E4%25B9%258Bngx_http_not_modified_filter_module">
                        <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;">2011年个人总结</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="一次分享引发的血案 --- HTTP Post Denial Of Service" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E4%25B8%2580%25E6%25AC%25A1%25E5%2588%2586%25E4%25BA%25AB%25E5%25BC%2595%25E5%258F%2591%25E7%259A%2584%25E8%25A1%2580%25E6%25A1%2588-http-post-denial-of-service&from=http%3A%2F%2Fwww.piao2010.com%2Fnginx-module%25E5%25AD%25A6%25E4%25B9%25A0%25E4%25B9%258Bngx_http_not_modified_filter_module">
                        <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/11/29/11663736.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;">一次分享引发的血案 --- HTTP Post Denial Of Service</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="运用sslstrip进行中间人攻击(Bypass https)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E8%25BF%2590%25E7%2594%25A8sslstrip%25E8%25BF%259B%25E8%25A1%258C%25E4%25B8%25AD%25E9%2597%25B4%25E4%25BA%25BA%25E6%2594%25BB%25E5%2587%25BBbypass-https&from=http%3A%2F%2Fwww.piao2010.com%2Fnginx-module%25E5%25AD%25A6%25E4%25B9%25A0%25E4%25B9%258Bngx_http_not_modified_filter_module">
                        <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;">运用sslstrip进行中间人攻击(Bypass https)</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="破解禁止SSID广播" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E7%25A0%25B4%25E8%25A7%25A3%25E7%25A6%2581%25E6%25AD%25A2ssid%25E5%25B9%25BF%25E6%2592%25AD&from=http%3A%2F%2Fwww.piao2010.com%2Fnginx-module%25E5%25AD%25A6%25E4%25B9%25A0%25E4%25B9%258Bngx_http_not_modified_filter_module">
                        <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/11/29/11664017.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;">破解禁止SSID广播</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" 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://www.piao2010.com/nginx-module%e5%ad%a6%e4%b9%a0%e4%b9%8bngx_http_not_modified_filter_module/feed</wfw:commentRss>
		</item>
		<item>
		<title>YUI Compressor PHP Script</title>
		<link>http://www.piao2010.com/yui-compressor-php-script</link>
		<comments>http://www.piao2010.com/yui-compressor-php-script#comments</comments>
		<pubDate>Fri, 15 Apr 2011 14:17:45 +0000</pubDate>
		<dc:creator>飘(piao2010)</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[YUICompressor]]></category>

		<guid isPermaLink="false">http://www.piao2010.com/?p=940</guid>
		<description><![CDATA[前两天UED乔福童鞋让我帮忙写个mac下的YUI Compressor CMD Script ，BASH 不熟悉只能拿PHP写一个了，脚本比较简单，模仿windows版本的抄了一遍，丢出来更新下博客 ：) 比较偷懒没有支持整个目录压缩，需要的同学请自行改进吧。哈哈

?View Code PHP#!/usr/local/php/bin/php

&#60;?php
/*
模仿YUI Compressor CMD Script(http://ourtools.googlecode.com/svn-history/r10/trunk/closure-compiler/compiler.cmd)
写的PHP版小工具
author:piao2010
website:http://piao2010.com
update:2011-04-12
*/
&#160;
//定义jar包路径
$yuicompressor_jar = &#34;/Library/yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar&#34;;
//需要压缩的文件
$source_file = $argv&#91;1&#93;;
$cur_dir = getcwd&#40;&#41;;
$source_file = $cur_dir.DIRECTORY_SEPARATOR.$source_file;
$path_parts = pathinfo&#40; $source_file &#41;;
//print_r($path_parts);
&#160;
//REM 过滤文件后缀，只压缩 js css
&#160;
if &#40; !preg_match&#40;'/(js)&#124;(css)/i' , $path_parts&#91;'extension'&#93;&#41; &#41;
	exit&#40;'Only support js and css file ! '&#41;;
&#160;
if &#40; !file_exists&#40; $source_file &#41; &#41;
	exit&#40;' source_file does not exist ! '&#41;;
&#160;
if &#40; $_ENV&#91;'JAVA_HOME'&#93; == '' [...]<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="Intel 3945ABG用OmniPeek 4.1抓包破解WEP无线网络" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Fintel-3945abg%25E7%2594%25A8omnipeek-41%25E6%258A%2593%25E5%258C%2585%25E7%25A0%25B4%25E8%25A7%25A3wep%25E6%2597%25A0%25E7%25BA%25BF%25E7%25BD%2591%25E7%25BB%259C&from=http%3A%2F%2Fwww.piao2010.com%2Fyui-compressor-php-script">
                        <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/11/29/11664021.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;">Intel 3945ABG用OmniPeek 4.1抓包破解WEP无线网络</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="worldpress插件shortstat XSS （0day）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Fworldpress%25E6%258F%2592%25E4%25BB%25B6shortstat-xss-%25EF%25BC%25880day%25EF%25BC%2589&from=http%3A%2F%2Fwww.piao2010.com%2Fyui-compressor-php-script">
                        <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/11/29/11663791.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;">worldpress插件shortstat XSS （0day）</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="利用SSH Tunnel(隧道)作安全代理" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E5%2588%25A9%25E7%2594%25A8ssh-tunnel%25E9%259A%25A7%25E9%2581%2593%25E4%25BD%259C%25E5%25AE%2589%25E5%2585%25A8%25E4%25BB%25A3%25E7%2590%2586&from=http%3A%2F%2Fwww.piao2010.com%2Fyui-compressor-php-script">
                        <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/11/29/11663960.bmp" 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;">利用SSH Tunnel(隧道)作安全代理</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="一次分享引发的血案 --- HTTP Post Denial Of Service" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E4%25B8%2580%25E6%25AC%25A1%25E5%2588%2586%25E4%25BA%25AB%25E5%25BC%2595%25E5%258F%2591%25E7%259A%2584%25E8%25A1%2580%25E6%25A1%2588-http-post-denial-of-service&from=http%3A%2F%2Fwww.piao2010.com%2Fyui-compressor-php-script">
                        <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/11/29/11663736.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;">一次分享引发的血案 --- HTTP Post Denial Of Service</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" 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>前两天UED乔福童鞋让我帮忙写个mac下的YUI Compressor CMD Script ，BASH 不熟悉只能拿PHP写一个了，脚本比较简单，模仿windows版本的抄了一遍，丢出来更新下博客 ：) 比较偷懒没有支持整个目录压缩，需要的同学请<span id="more-940"></span>自行改进吧。哈哈</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p940code25'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p94025"><td class="code" id="p940code25"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/local/php/bin/php
</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
模仿YUI Compressor CMD Script(http://ourtools.googlecode.com/svn-history/r10/trunk/closure-compiler/compiler.cmd)
写的PHP版小工具
author:piao2010
website:http://piao2010.com
update:2011-04-12
*/</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//定义jar包路径</span>
<span style="color: #000088;">$yuicompressor_jar</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/Library/yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar&quot;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//需要压缩的文件</span>
<span style="color: #000088;">$source_file</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$argv</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$cur_dir</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/getcwd"><span style="color: #990000;">getcwd</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$source_file</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cur_dir</span><span style="color: #339933;">.</span><span style="color: #009900; font-weight: bold;">DIRECTORY_SEPARATOR</span><span style="color: #339933;">.</span><span style="color: #000088;">$source_file</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$path_parts</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/pathinfo"><span style="color: #990000;">pathinfo</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$source_file</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//print_r($path_parts);</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//REM 过滤文件后缀，只压缩 js css</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><a href="http://www.php.net/preg_match"><span style="color: #990000;">preg_match</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/(js)|(css)/i'</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$path_parts</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'extension'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
	<a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Only support js and css file ! '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><a href="http://www.php.net/file_exists"><span style="color: #990000;">file_exists</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$source_file</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
	<a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' source_file does not exist ! '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_ENV</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'JAVA_HOME'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span>
	<a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No JAVA_HOME! '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$java</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_ENV</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'JAVA_HOME'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/bin/java'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$native2ascii</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_ENV</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'JAVA_HOME'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/bin/native2ascii'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//REM 生成压缩后的文件名，规则为：</span>
<span style="color: #666666; font-style: italic;">//REM 1. 文件名有.source时: filename.source.js -&gt; filename.js</span>
<span style="color: #666666; font-style: italic;">//REM 2. 其它情况：filename.js -&gt; filename-min.js</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$path_parts</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'filename'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'.source'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$tmp</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'.source'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'.'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$path_parts</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'filename'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$result_file</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tmp</span><span style="color: #339933;">.</span><span style="color: #000088;">$path_parts</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'extension'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #000088;">$result_file</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$path_parts</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'filename'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'-min.'</span><span style="color: #339933;">.</span><span style="color: #000088;">$path_parts</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'extension'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$result_file</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cur_dir</span><span style="color: #339933;">.</span><span style="color: #009900; font-weight: bold;">DIRECTORY_SEPARATOR</span><span style="color: #339933;">.</span><span style="color: #000088;">$result_file</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$source_file</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;n&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$result_file</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;n&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$cmd</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$java</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; -jar &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$yuicompressor_jar</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">.</span><span style="color: #000088;">$source_file</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; --charset=gb18030 -o &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$result_file</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$cmd</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;n&quot;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/system"><span style="color: #990000;">system</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$cmd</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">@</span><a href="http://www.php.net/copy"><span style="color: #990000;">copy</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$result_file</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$result_file</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_bak'</span> <span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Copy bak file failed! '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//REM 下面解决编码问题：当 js 文件的编码与页面编码不一致时，非 ascii 字符会导致乱码，处理办法是：</span>
<span style="color: #666666; font-style: italic;">//REM 1. 首先调用 native2ascii.exe 将非 ascii 字符转换为 uxxxx 即可</span>
&nbsp;
<span style="color: #000088;">$cmd2</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$native2ascii</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' -encoding GB18030 '</span><span style="color: #339933;">.</span><span style="color: #000088;">$result_file</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_bak '</span><span style="color: #339933;">.</span><span style="color: #000088;">$result_file</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$cmd2</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;n&quot;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/system"><span style="color: #990000;">system</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$cmd2</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">@</span><a href="http://www.php.net/unlink"><span style="color: #990000;">unlink</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$result_file</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_bak'</span> <span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Remove bak file failed! '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//REM 2. 对于 css 文件，还需要将 uxxxx 中的 u 去掉（css 只认识xxxx）</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$path_parts</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'extension'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'css'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$result_file</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;u&quot;</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$content</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<a href="http://www.php.net/file_put_contents"><span style="color: #990000;">file_put_contents</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$result_file</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$content</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Seems finished ! &quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<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="worldpress插件shortstat XSS （0day）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Fworldpress%25E6%258F%2592%25E4%25BB%25B6shortstat-xss-%25EF%25BC%25880day%25EF%25BC%2589&from=http%3A%2F%2Fwww.piao2010.com%2Fyui-compressor-php-script">
                        <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/11/29/11663791.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;">worldpress插件shortstat XSS （0day）</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="Intel 3945ABG用OmniPeek 4.1抓包破解WEP无线网络" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Fintel-3945abg%25E7%2594%25A8omnipeek-41%25E6%258A%2593%25E5%258C%2585%25E7%25A0%25B4%25E8%25A7%25A3wep%25E6%2597%25A0%25E7%25BA%25BF%25E7%25BD%2591%25E7%25BB%259C&from=http%3A%2F%2Fwww.piao2010.com%2Fyui-compressor-php-script">
                        <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/11/29/11664021.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;">Intel 3945ABG用OmniPeek 4.1抓包破解WEP无线网络</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="利用SSH Tunnel(隧道)作安全代理" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E5%2588%25A9%25E7%2594%25A8ssh-tunnel%25E9%259A%25A7%25E9%2581%2593%25E4%25BD%259C%25E5%25AE%2589%25E5%2585%25A8%25E4%25BB%25A3%25E7%2590%2586&from=http%3A%2F%2Fwww.piao2010.com%2Fyui-compressor-php-script">
                        <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/11/29/11663960.bmp" 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;">利用SSH Tunnel(隧道)作安全代理</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="破解禁止SSID广播" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E7%25A0%25B4%25E8%25A7%25A3%25E7%25A6%2581%25E6%25AD%25A2ssid%25E5%25B9%25BF%25E6%2592%25AD&from=http%3A%2F%2Fwww.piao2010.com%2Fyui-compressor-php-script">
                        <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/11/29/11664017.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;">破解禁止SSID广播</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" 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://www.piao2010.com/yui-compressor-php-script/feed</wfw:commentRss>
		</item>
		<item>
		<title>基于虚拟主机的apache + jboss 负载均衡配置</title>
		<link>http://www.piao2010.com/%e5%9f%ba%e4%ba%8e%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e7%9a%84apache-jboss-%e8%b4%9f%e8%bd%bd%e5%9d%87%e8%a1%a1%e9%85%8d%e7%bd%ae</link>
		<comments>http://www.piao2010.com/%e5%9f%ba%e4%ba%8e%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e7%9a%84apache-jboss-%e8%b4%9f%e8%bd%bd%e5%9d%87%e8%a1%a1%e9%85%8d%e7%bd%ae#comments</comments>
		<pubDate>Sat, 26 Mar 2011 14:52:34 +0000</pubDate>
		<dc:creator>飘(piao2010)</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[jboss]]></category>

		<category><![CDATA[mod_jk]]></category>

		<guid isPermaLink="false">http://www.piao2010.com/?p=932</guid>
		<description><![CDATA[前阵子有个项目需要用到基于虚拟主机的apache + jboss 负载均衡配置，所以整理了一下分享给大家，主要就是mod_jk的配置。

?View Code BASHapache + jboss 基于域名虚拟主机的负载均衡配置
&#160;
#**********飘零的代码*************#
&#160;
httpd.conf文件关键配置如下
&#160;
Include &#34;mod_jk.conf&#34;
&#160;
NameVirtualHost *
&#160;
&#160;
&#60;VirtualHost *&#62;
    ServerName xx.piao2010.com
    DocumentRoot /xx/htdocs/
    JkMountFile &#34;xx_jk.properties&#34;
    JkLogFile /logs/xx_jk.log
    JkLogLevel warn
&#60;/VirtualHost&#62;
&#160;
&#160;
&#60;VirtualHost *&#62;
    ServerName yy.piao2010.com
    DocumentRoot /yy/htdocs/
    JkMountFile &#34;yy.properties&#34;
   [...]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E4%25B8%2580%25E6%25AC%25A1%25E5%2588%2586%25E4%25BA%25AB%25E5%25BC%2595%25E5%258F%2591%25E7%259A%2584%25E8%25A1%2580%25E6%25A1%2588-http-post-denial-of-service&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258E%25E8%2599%259A%25E6%258B%259F%25E4%25B8%25BB%25E6%259C%25BA%25E7%259A%2584apache-jboss-%25E8%25B4%259F%25E8%25BD%25BD%25E5%259D%2587%25E8%25A1%25A1%25E9%2585%258D%25E7%25BD%25AE">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">一次分享引发的血案 --- HTTP Post Denial Of Service</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Fapachephpmysql&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258E%25E8%2599%259A%25E6%258B%259F%25E4%25B8%25BB%25E6%259C%25BA%25E7%259A%2584apache-jboss-%25E8%25B4%259F%25E8%25BD%25BD%25E5%259D%2587%25E8%25A1%25A1%25E9%2585%258D%25E7%25BD%25AE">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">apache+php+mysql</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Fvm%25E8%2599%259A%25E6%258B%259F%25E6%259C%25BA%25E5%25BC%2580%25E6%259C%25BA%25E8%2587%25AA%25E5%2590%25AF%25E5%258A%25A8&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258E%25E8%2599%259A%25E6%258B%259F%25E4%25B8%25BB%25E6%259C%25BA%25E7%259A%2584apache-jboss-%25E8%25B4%259F%25E8%25BD%25BD%25E5%259D%2587%25E8%25A1%25A1%25E9%2585%258D%25E7%25BD%25AE">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">vm虚拟机开机自启动</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Fvsftpd-%25E8%2599%259A%25E6%258B%259F%25E7%2594%25A8%25E6%2588%25B7%25E9%2585%258D%25E7%25BD%25AE&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258E%25E8%2599%259A%25E6%258B%259F%25E4%25B8%25BB%25E6%259C%25BA%25E7%259A%2584apache-jboss-%25E8%25B4%259F%25E8%25BD%25BD%25E5%259D%2587%25E8%25A1%25A1%25E9%2585%258D%25E7%25BD%25AE">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">vsftpd 虚拟用户配置</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258Elinux%25E7%259A%2584subversion%25E9%2585%258D%25E7%25BD%25AE&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258E%25E8%2599%259A%25E6%258B%259F%25E4%25B8%25BB%25E6%259C%25BA%25E7%259A%2584apache-jboss-%25E8%25B4%259F%25E8%25BD%25BD%25E5%259D%2587%25E8%25A1%25A1%25E9%2585%258D%25E7%25BD%25AE">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">基于Linux的Subversion配置</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" 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>前阵子有个项目需要用到基于虚拟主机的apache + jboss 负载均衡配置，所以整理了一下分享给大家，主要就是mod_jk的配置。<span id="more-932"></span></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p932code27'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p93227"><td class="code" id="p932code27"><pre class="bash" style="font-family:monospace;">apache + jboss 基于域名虚拟主机的负载均衡配置
&nbsp;
<span style="color: #666666; font-style: italic;">#**********飘零的代码*************#</span>
&nbsp;
httpd.conf文件关键配置如下
&nbsp;
Include <span style="color: #ff0000;">&quot;mod_jk.conf&quot;</span>
&nbsp;
NameVirtualHost <span style="color: #000000; font-weight: bold;">*</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>VirtualHost <span style="color: #000000; font-weight: bold;">*&gt;</span>
    ServerName xx.piao2010.com
    DocumentRoot <span style="color: #000000; font-weight: bold;">/</span>xx<span style="color: #000000; font-weight: bold;">/</span>htdocs<span style="color: #000000; font-weight: bold;">/</span>
    JkMountFile <span style="color: #ff0000;">&quot;xx_jk.properties&quot;</span>
    JkLogFile <span style="color: #000000; font-weight: bold;">/</span>logs<span style="color: #000000; font-weight: bold;">/</span>xx_jk.log
    JkLogLevel warn
<span style="color: #000000; font-weight: bold;">&lt;/</span>VirtualHost<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>VirtualHost <span style="color: #000000; font-weight: bold;">*&gt;</span>
    ServerName yy.piao2010.com
    DocumentRoot <span style="color: #000000; font-weight: bold;">/</span>yy<span style="color: #000000; font-weight: bold;">/</span>htdocs<span style="color: #000000; font-weight: bold;">/</span>
    JkMountFile <span style="color: #ff0000;">&quot;yy.properties&quot;</span>
    JkLogFile <span style="color: #000000; font-weight: bold;">/</span>yy_jk.log
    JkLogLevel warn
<span style="color: #000000; font-weight: bold;">&lt;/</span>VirtualHost<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#**********飘零的代码*************#</span>
mod_jk.conf文件关键配置如下
&nbsp;
LoadModule jk_module <span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/</span>mod_jk.so
&nbsp;
JkWorkerProperty worker.list=lbxx,lbyy
&nbsp;
JkWorkerProperty worker.xx1.type=ajp13
JkWorkerProperty worker.xx1.host=xx1的IP
JkWorkerProperty worker.xx1.port=<span style="color: #000000;">8009</span>
JkWorkerProperty worker.xx1.socket_timeout=<span style="color: #000000;">30</span>
JkWorkerProperty worker.xx1.socket_keepalive=<span style="color: #000000;">1</span>
JkWorkerProperty worker.xx1.recycle_timeout=<span style="color: #000000;">15</span>
JkWorkerProperty worker.xx1.lbfactor=<span style="color: #000000;">100</span>
&nbsp;
JkWorkerProperty worker.xx2.type=ajp13
JkWorkerProperty worker.xx2.host=xx2的IP
JkWorkerProperty worker.xx2.port=<span style="color: #000000;">8009</span>
JkWorkerProperty worker.xx2.socket_timeout=<span style="color: #000000;">30</span>
JkWorkerProperty worker.xx2.socket_keepalive=<span style="color: #000000;">1</span>
JkWorkerProperty worker.xx2.recycle_timeout=<span style="color: #000000;">15</span>
JkWorkerProperty worker.xx2.lbfactor=<span style="color: #000000;">100</span>
&nbsp;
&nbsp;
JkWorkerProperty worker.yy1.type=ajp13
JkWorkerProperty worker.yy1.host=yy1的IP
JkWorkerProperty worker.yy1.port=<span style="color: #000000;">8009</span>
JkWorkerProperty worker.yy1.socket_timeout=<span style="color: #000000;">30</span>
JkWorkerProperty worker.yy1.socket_keepalive=<span style="color: #000000;">1</span>
JkWorkerProperty worker.yy1.recycle_timeout=<span style="color: #000000;">15</span>
JkWorkerProperty worker.yy1.lbfactor=<span style="color: #000000;">100</span>
&nbsp;
JkWorkerProperty worker.yy2.type=ajp13
JkWorkerProperty worker.yy2.host=yy2的IP
JkWorkerProperty worker.yy2.port=<span style="color: #000000;">8009</span>
JkWorkerProperty worker.yy2.socket_timeout=<span style="color: #000000;">30</span>
JkWorkerProperty worker.yy2.socket_keepalive=<span style="color: #000000;">1</span>
JkWorkerProperty worker.yy2.recycle_timeout=<span style="color: #000000;">15</span>
JkWorkerProperty worker.yy2.lbfactor=<span style="color: #000000;">100</span>
&nbsp;
&nbsp;
&nbsp;
JkWorkerProperty worker.lbxx.type=lb                                                                                                      
JkWorkerProperty worker.lbxx.balanced_workers=xx1,xx2
&nbsp;
&nbsp;
JkWorkerProperty worker.lbyy.type=lb                                                                                                       
JkWorkerProperty worker.lbyy.balanced_workers=yy1,yy2                                                                     
&nbsp;
JkMountCopy All                                                                                                                            
JkLogFile <span style="color: #000000; font-weight: bold;">/</span>logs<span style="color: #000000; font-weight: bold;">/</span>mod_jk.log                                                                                                  
JkLogLevel info                                                                                                                            
JkOptions +ForwardURICompat  
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#**********飘零的代码*************#</span>
&nbsp;
&nbsp;
xx_jk.properties 配置如下
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">/*</span>.do=lbxx
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#**********飘零的代码*************#</span>
&nbsp;
yy_jk.properties 配置如下
&nbsp;
<span style="color: #000000; font-weight: bold;">/*</span>.do=lbyy
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#**********飘零的代码*************#</span></pre></td></tr></table></div>

<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E4%25B8%2580%25E6%25AC%25A1%25E5%2588%2586%25E4%25BA%25AB%25E5%25BC%2595%25E5%258F%2591%25E7%259A%2584%25E8%25A1%2580%25E6%25A1%2588-http-post-denial-of-service&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258E%25E8%2599%259A%25E6%258B%259F%25E4%25B8%25BB%25E6%259C%25BA%25E7%259A%2584apache-jboss-%25E8%25B4%259F%25E8%25BD%25BD%25E5%259D%2587%25E8%25A1%25A1%25E9%2585%258D%25E7%25BD%25AE">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">一次分享引发的血案 --- HTTP Post Denial Of Service</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Fapachephpmysql&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258E%25E8%2599%259A%25E6%258B%259F%25E4%25B8%25BB%25E6%259C%25BA%25E7%259A%2584apache-jboss-%25E8%25B4%259F%25E8%25BD%25BD%25E5%259D%2587%25E8%25A1%25A1%25E9%2585%258D%25E7%25BD%25AE">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">apache+php+mysql</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Fvm%25E8%2599%259A%25E6%258B%259F%25E6%259C%25BA%25E5%25BC%2580%25E6%259C%25BA%25E8%2587%25AA%25E5%2590%25AF%25E5%258A%25A8&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258E%25E8%2599%259A%25E6%258B%259F%25E4%25B8%25BB%25E6%259C%25BA%25E7%259A%2584apache-jboss-%25E8%25B4%259F%25E8%25BD%25BD%25E5%259D%2587%25E8%25A1%25A1%25E9%2585%258D%25E7%25BD%25AE">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">vm虚拟机开机自启动</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Fvsftpd-%25E8%2599%259A%25E6%258B%259F%25E7%2594%25A8%25E6%2588%25B7%25E9%2585%258D%25E7%25BD%25AE&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258E%25E8%2599%259A%25E6%258B%259F%25E4%25B8%25BB%25E6%259C%25BA%25E7%259A%2584apache-jboss-%25E8%25B4%259F%25E8%25BD%25BD%25E5%259D%2587%25E8%25A1%25A1%25E9%2585%258D%25E7%25BD%25AE">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">vsftpd 虚拟用户配置</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258Elinux%25E7%259A%2584subversion%25E9%2585%258D%25E7%25BD%25AE&from=http%3A%2F%2Fwww.piao2010.com%2F%25E5%259F%25BA%25E4%25BA%258E%25E8%2599%259A%25E6%258B%259F%25E4%25B8%25BB%25E6%259C%25BA%25E7%259A%2584apache-jboss-%25E8%25B4%259F%25E8%25BD%25BD%25E5%259D%2587%25E8%25A1%25A1%25E9%2585%258D%25E7%25BD%25AE">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">基于Linux的Subversion配置</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" 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://www.piao2010.com/%e5%9f%ba%e4%ba%8e%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e7%9a%84apache-jboss-%e8%b4%9f%e8%bd%bd%e5%9d%87%e8%a1%a1%e9%85%8d%e7%bd%ae/feed</wfw:commentRss>
		</item>
		<item>
		<title>web安全分享PPT</title>
		<link>http://www.piao2010.com/web%e5%ae%89%e5%85%a8%e5%88%86%e4%ba%abppt</link>
		<comments>http://www.piao2010.com/web%e5%ae%89%e5%85%a8%e5%88%86%e4%ba%abppt#comments</comments>
		<pubDate>Mon, 07 Mar 2011 10:55:21 +0000</pubDate>
		<dc:creator>飘(piao2010)</dc:creator>
		
		<category><![CDATA[安全相关]]></category>

		<category><![CDATA[csrf]]></category>

		<category><![CDATA[XSS]]></category>

		<guid isPermaLink="false">http://www.piao2010.com/?p=921</guid>
		<description><![CDATA[PPT是周末做的，给部门的同学做了一次web安全分享，里面的内容多数来源于Internet，希望大牛们别介意哈，已经隐去了涉及到公司的部分内容。
Web安全分享 -公开版
View more presentations from piao2010.

<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E5%2588%25A9%25E7%2594%25A8%25E7%25BD%2591%25E6%2598%2593%25E5%258D%259A%25E5%25AE%25A2xss%25E5%2592%258Ccsrf%25E6%25BC%258F%25E6%25B4%259E%25E7%25BC%2596%25E5%2586%2599%25E8%25A0%2595%25E8%2599%25AB&from=http%3A%2F%2Fwww.piao2010.com%2Fweb%25E5%25AE%2589%25E5%2585%25A8%25E5%2588%2586%25E4%25BA%25ABppt">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">利用网易博客XSS和CSRF漏洞编写蠕虫</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Fworldpress%25E6%258F%2592%25E4%25BB%25B6shortstat-xss-%25EF%25BC%25880day%25EF%25BC%2589&from=http%3A%2F%2Fwww.piao2010.com%2Fweb%25E5%25AE%2589%25E5%2585%25A8%25E5%2588%2586%25E4%25BA%25ABppt">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">worldpress插件shortstat XSS （0day）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E6%25AF%2595%25E4%25B8%259A3%25E4%25B8%25AA%25E6%259C%2588%25E4%25BB%25A5%25E6%259D%25A5%25E7%259A%2584%25E6%259D%2582%25E4%25BA%258B%25E6%259D%2582%25E6%2584%259F&from=http%3A%2F%2Fwww.piao2010.com%2Fweb%25E5%25AE%2589%25E5%2585%25A8%25E5%2588%2586%25E4%25BA%25ABppt">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">毕业3个月以来的杂事杂感</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E7%25BB%25A7%25E7%25BB%25AD%25E5%258F%2591%25E6%258E%2598worldpress%25E6%258F%2592%25E4%25BB%25B6shortstat-xss%25E6%25BC%258F%25E6%25B4%259E&from=http%3A%2F%2Fwww.piao2010.com%2Fweb%25E5%25AE%2589%25E5%2585%25A8%25E5%2588%2586%25E4%25BA%25ABppt">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">继续发掘worldpress插件shortstat XSS漏洞</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E6%25B7%25B1%25E5%2585%25A5%25E5%2588%2586%25E6%259E%2590%25E8%25B7%25A8%25E7%25AB%2599&from=http%3A%2F%2Fwww.piao2010.com%2Fweb%25E5%25AE%2589%25E5%2585%25A8%25E5%2588%2586%25E4%25BA%25ABppt">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">深入分析跨站(XSS)</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" 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>PPT是周末做的，给部门的同学做了一次web安全分享，里面的内容多数来源于Internet，希望大牛们别介意哈，已经隐去了涉及到公司的部分内容。</p>
<div style="width:425px" id="__ss_7175391"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/piao2010/web-7175391" title="Web安全分享 -公开版">Web安全分享 -公开版</a></strong><object id="__sse7175391" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=web-110307044616-phpapp01&#038;stripped_title=web-7175391&#038;userName=piao2010" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse7175391" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=web-110307044616-phpapp01&#038;stripped_title=web-7175391&#038;userName=piao2010" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/piao2010">piao2010</a>.</div>
</div>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E5%2588%25A9%25E7%2594%25A8%25E7%25BD%2591%25E6%2598%2593%25E5%258D%259A%25E5%25AE%25A2xss%25E5%2592%258Ccsrf%25E6%25BC%258F%25E6%25B4%259E%25E7%25BC%2596%25E5%2586%2599%25E8%25A0%2595%25E8%2599%25AB&from=http%3A%2F%2Fwww.piao2010.com%2Fweb%25E5%25AE%2589%25E5%2585%25A8%25E5%2588%2586%25E4%25BA%25ABppt">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">利用网易博客XSS和CSRF漏洞编写蠕虫</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2Fworldpress%25E6%258F%2592%25E4%25BB%25B6shortstat-xss-%25EF%25BC%25880day%25EF%25BC%2589&from=http%3A%2F%2Fwww.piao2010.com%2Fweb%25E5%25AE%2589%25E5%2585%25A8%25E5%2588%2586%25E4%25BA%25ABppt">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">worldpress插件shortstat XSS （0day）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E6%25AF%2595%25E4%25B8%259A3%25E4%25B8%25AA%25E6%259C%2588%25E4%25BB%25A5%25E6%259D%25A5%25E7%259A%2584%25E6%259D%2582%25E4%25BA%258B%25E6%259D%2582%25E6%2584%259F&from=http%3A%2F%2Fwww.piao2010.com%2Fweb%25E5%25AE%2589%25E5%2585%25A8%25E5%2588%2586%25E4%25BA%25ABppt">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">毕业3个月以来的杂事杂感</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E7%25BB%25A7%25E7%25BB%25AD%25E5%258F%2591%25E6%258E%2598worldpress%25E6%258F%2592%25E4%25BB%25B6shortstat-xss%25E6%25BC%258F%25E6%25B4%259E&from=http%3A%2F%2Fwww.piao2010.com%2Fweb%25E5%25AE%2589%25E5%2585%25A8%25E5%2588%2586%25E4%25BA%25ABppt">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">继续发掘worldpress插件shortstat XSS漏洞</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.piao2010.com%2F%25E6%25B7%25B1%25E5%2585%25A5%25E5%2588%2586%25E6%259E%2590%25E8%25B7%25A8%25E7%25AB%2599&from=http%3A%2F%2Fwww.piao2010.com%2Fweb%25E5%25AE%2589%25E5%2585%25A8%25E5%2588%2586%25E4%25BA%25ABppt">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">深入分析跨站(XSS)</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" 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://www.piao2010.com/web%e5%ae%89%e5%85%a8%e5%88%86%e4%ba%abppt/feed</wfw:commentRss>
		</item>
	</channel>
</rss>

