<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://icylife.net/yunshu/rss.php" rel="self" type="application/rss+xml" />
		<title>心路</title>
		<link>http://www.icylife.net/yunshu</link>
		<description>心路</description>
		<language>zh-cn</language>
		<item>
			<title><![CDATA[两个故事]]></title>
			<category>八卦</category>
			<author>wustyunshu@yahoo.com.cn(云舒)</author>
			<link>http://www.icylife.net/yunshu/show.php?id=608</link>
			<guid>http://www.icylife.net/yunshu/show.php?id=608</guid>
			<description>
				<![CDATA[
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 累的头晕眼花，编两个故事消遣一下。如有雷同，那肯定是你抄我的。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 第一个是英雄的故事。很久以前，有一个古老而又很有特色的国家。这个国家民主，富裕，发达，但是遗憾的是大家都跑得不快。后来有一天，这个国家出现了一个跑得很快的人，甚至跑赢了以跑步速度快而著称的飞毛腿先生。于是乎，他出名了，大家都认为他是英雄。有些人是发自内心的，有些人是为了自己的利益，有些人是为了陶冶别人的爱国情操，有些人是因为脑残&mdash;&mdash;总之基本上都认为他是英雄，敢反对的都被打入另册。就这样，这个人成了英雄。本来他自己是不相信自己是英雄的，但是大家都这么认为，他就也相信了。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;可是后来有一天，他在一个很重要的赌博中跑步摔倒了，输了，没有得到象征千王之王的牌子。于是乎，大家就把他踩在了脚下，当然这些人当中，依然包含了发自内心的，为了自己的利益的，陶冶别人爱国情操的，和脑残的。本来就是一个普通人，被一个喜欢陶冶别人爱国主义情操的队伍在身上树起了一块散发着英雄光芒的牌子，最后又被踩成连普通人都不如的懦夫。不过既然享受了英雄的荣耀，那么就也忍受一下被人踩的感觉吧&mdash;&mdash;享受的同时应该能料到的。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 一块牌子而已，得了也就那样，丢了也就那样。看看北方的巨人吧，已经在痛扁敢冒犯他威严的邻居了&mdash;&mdash;有人敢说这个没有牌子的国家是病夫么？</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 第二个故事是关于C133P的。从前有很多C133P，传说每一个人都有很多钱。原来他们考完了C133P之后，发现上班也不是特别理想，就去写书，写一些考C133P的秘技，结果书卖得很好，于是乎有钱了。读了他们的书的那些人，考试也都通过了，也发现了工作的不如意，于是灵机一动也去写书，最终也发达了，一代接一代&hellip;&hellip;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 纯属消遣，没有一点是真的。</p>
				]]>
			</description>
			<pubDate>Wed, 20 Aug 2008 18:16:43 +0800</pubDate>
		</item>
		<item>
			<title><![CDATA[几个免费的方案]]></title>
			<category>技术</category>
			<author>wustyunshu@yahoo.com.cn(云舒)</author>
			<link>http://www.icylife.net/yunshu/show.php?id=607</link>
			<guid>http://www.icylife.net/yunshu/show.php?id=607</guid>
			<description>
				<![CDATA[
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 最近没什么好写的，推荐几个东西吧，可能有些人不知道。其实有些免费的东西，或者开源的东西，都不错，差的就在于都是一个个零散的东西，没有做成一个系统的方案。不过有些集成的东西逐渐成熟了，一般的场合用一下，应该问题不大。</p>
<ul>
    <li>OSSIM</li>
</ul>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OSSIM是一个开源的SOC（Security Operations Center）系统，官方主页是<a href="http://www.ossim.net/" target="_blank">http://www.ossim.net/</a>，它可以集中管理多个免费的安全工具，如Nessus，Snorts，Tcptrack，OSSEC，Nagios，Ntop等等。提供一个完整的WEB界面，可提供监控，报警，定时扫描，报表等服务，形成一套完整的解决方案。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img height="358" width="640" src="http://www.ossim.net/screenshots/metrics.png" alt="" /></p>
<ul>
    <li>Sguil</li>
</ul>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sguil是一个网络流量安全分析监控系统，官方主页在<a href="http://sguil.sourceforge.net/" target="_blank">http://sguil.sourceforge.net/</a>，它是Snort的WEB前端，提供实时的流量监控，可以查看每一个事件，状态连接，以及原始的数据包信息，简单的说，就是一个NIDS系统。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img height="456" width="640" src="http://sguil.sourceforge.net/images/sguil_main.png" alt="" /></p>
<ul>
    <li>Inprotect</li>
</ul>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Inprotect类似是OSSIM的精简版，只保留了管理扫描器的功能，主要是管理Nessus和Nmap，提供报表，定时扫描等功能。Nessus和Nmap虽然开源免费，功能强大，但是免费版都没有很好的报表可供管理人员解读，以便了解宏观的网络安全状况，Inprotect恰好弥补了这一点。吴鲁加曾经在2004年写过一篇文章《用自由软件构建中小企业弱点评估系统》，介绍过Inprotect，不过那时候似乎做企业安全的人不多，都在搞溢出。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 目前商业版的扫描工具，在扫描方面并不比Nessus出色，某些公司的只怕还不如，只是报表做得好看一点。用Inprotect来管理后台的Nessus和Nmap做漏洞管理，是个不错的选择。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img alt="" src="http://sourceforge.net/dbimage.php?id=149150" /></p>
<ul>
    <li>Panabit</li>
</ul>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Panabit是国人自己基于FreeBSD做的一个流量管理系统，类似于IPS，不开源，但是可免费使用。功能非常强大，可解码非常多的应用层协议，包括各种P2P协议的管理&mdash;&mdash;我想这个应该是很多网络管理人员头疼的事情吧。官方主页是<a target="_blank" href="http://www.panabit.com/">http://www.panabit.com/</a>，中文的，文档也比较全。据我所知，国内有些公司在内网会部署Panabit来做P2P流量控制。不过IPS之类的系统，要想有更大的市场，做互备可能是免不了的&mdash;&mdash;就算不开启阻断功能，也会担心单点故障啊。</p>
				]]>
			</description>
			<pubDate>Tue, 19 Aug 2008 16:13:33 +0800</pubDate>
		</item>
		<item>
			<title><![CDATA[今天是鬼节]]></title>
			<category>琐记</category>
			<author>wustyunshu@yahoo.com.cn(云舒)</author>
			<link>http://www.icylife.net/yunshu/show.php?id=606</link>
			<guid>http://www.icylife.net/yunshu/show.php?id=606</guid>
			<description>
				<![CDATA[
<p>今天农历七月十五，俗说的鬼节，佛家叫做盂兰盆节，道家称为中元节。</p>
<p>中元的名称，是由上元而来。上元佳节，就是元宵了。元宵佳节要用灯笼庆祝，所以中元节也免不了放灯。不过人鬼有别，人为阳，鬼为阴；陆为阳，水为阴。所以上元张灯在陆地，中元张灯在水里。无数盏灯，放在水中轻轻飘着，星星点点，在朦胧的烟气中闪烁，倒也颇有点《倩女幽魂》那种凄美迷离的意境。至于为什么中元是鬼节，道家是这么讲的，&ldquo;天官紫微大帝赐福，诞于正月十五，称上元节。地官清虚大帝赦罪，诞于七月十五，称中元节。水官洞阴大帝解厄，诞于十月十五，称下元节。中元地官清虚大帝于七月十五中元时普渡孤魂野鬼，有罪的人也可向其祈求赦罪。&rdquo;《修行记》云，&ldquo;中元日 ，地官降下，定人间善恶，道士於是夜诵经，饿节囚徒亦得解脱。&rdquo;</p>
<p>盂兰盆，梵文Ullam-bana的音译。盂兰是倒悬的意思，说轮回就像倒悬的蝙蝠一样，是痛苦的，而在这天供奉则可接触逝者像倒悬一样的苦。盆&mdash;&mdash;不好意思，就是盆，装东西吃的那东西。佛家一向是讲究人生即苦的，《心经》中有八苦，生，老，病，死，怨憎会，爱别离，求不得。而且所谓&ldquo;人生在世如身处荆棘林中，心不动则人不妄动，不动则不伤&rdquo;，怎么彻底解脱？供奉，信佛&hellip;&hellip;怕苦的人还是有的，所以佛教也就兴盛起来了，这也就是他们比道教牛X有市场的地方。就像现在卖防火墙的，先DDOS你一下，怕了吧？没关系，我们的设备可以防御。扯远了，对于盂兰盆佛经中是这么说的，&ldquo;有目莲僧者，法力宏大。其母堕落饿鬼道中，食物入口，即化为烈焰，饥苦太甚。目莲无法解救母厄，于是求教于佛，为说盂兰盆经，教于七月十五日作盂兰盆以救其母。&rdquo;</p>
<p>不过上面的都是和谐版，在我老家，流行的是另外两个个佛家传说。地藏王菩萨看见自己的母亲在地狱受苦，于是在七月十五这天用佛经和禅杖，闯进地狱最底层，将他的母亲救了出来。但是由于他打破了鬼门关，导致很多鬼混跟着他后面跑了出来，为祸人间。所以人们在这天晚上，供奉布施，并且在水上点灯，指引他们回到冥界。另一个传说还是上面的目莲和尚&mdash;&mdash;目莲和尚并没有通过盂兰盆会将他的母亲从地狱救出来，于是用自己的愿力打开地狱，不惜放尽地狱中的八百万恶鬼，才救出自己的母亲。佛祖为了惩罚他，将其贬入凡间，并让他再将那八百万恶鬼一个一个地招回地狱。于是目连下届，转世为人，就是写出&ldquo;我花开尽百花杀&rdquo;的黄巢，杀尽八百万恶鬼转世，将他们重新带回地狱。又想起了本朝的一位诗人，&ldquo;遍地哀鸿满城血，无非一念救苍生&rdquo;，罢了，这个就不多说。</p>
<p>城里对鬼节没什么感觉，但是在农村还是很隆重的，我记得小时候在农村老家七月十五晚上，基本上是没人赶外出走夜路的。都在家祭拜祖先的，傍晚时分有些人家还要拿些饭菜到水边，一般是池塘边，给那些可怜的孤魂野鬼享用。在饭菜旁边，点上蜡烛，少些冥币，为鬼魂引路。从这样来看，道教的灯会和佛教的施舍自动结合到了一起，倒也很有意思。</p>
				]]>
			</description>
			<pubDate>Fri, 15 Aug 2008 14:31:45 +0800</pubDate>
		</item>
		<item>
			<title><![CDATA[内网架构，又头疼了]]></title>
			<category>技术</category>
			<author>wustyunshu@yahoo.com.cn(云舒)</author>
			<link>http://www.icylife.net/yunshu/show.php?id=605</link>
			<guid>http://www.icylife.net/yunshu/show.php?id=605</guid>
			<description>
				<![CDATA[
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 最近开始设计新大楼的内网架构，又头疼了。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 和yahoo的，以及其它一些公司的情况完全不同。网络非常大，各个子公司之间的互相访问，员工位置在不同大楼之间的频繁变动，非常的麻烦。常规基于用户名的动态vlan划分等成熟方案都不是很适合，基本上没有可以参考的设计。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这是一个挑战，不过我会努力试试。</p>
				]]>
			</description>
			<pubDate>Fri, 15 Aug 2008 11:04:28 +0800</pubDate>
		</item>
		<item>
			<title><![CDATA[FlashGet都出溢出了]]></title>
			<category>技术</category>
			<author>wustyunshu@yahoo.com.cn(云舒)</author>
			<link>http://www.icylife.net/yunshu/show.php?id=604</link>
			<guid>http://www.icylife.net/yunshu/show.php?id=604</guid>
			<description>
				<![CDATA[
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 刚才hi群里面，有人发了一个FlashGet的溢出，POC在<a target="_blank" href="http://www.milw0rm.com/exploits/6240">http://www.milw0rm.com/exploits/6240</a>，确实很有意思啊。如果自己做一个假的FTP服务器，就可以坐等别人自己送上门了。只要自己写一个支持登陆，CWD，PWD等三个命令的假FTP服务器就行了，登陆的地方随便什么密码都返回成功，直到PWD命令的时候，返回一个超长的字符串，然后就!@#$%了。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FTP服务器架好了，就剩下两个问题，第一是怎么让别人找到这个连接。第二个就是怎么调用FlashGet来下载。这个不难，首先第一个问题，用骗的&hellip;&hellip; 你可以针对别人的爱好，比如说想看NBC开幕式的，你就告诉他你有高清版的NBC开幕式下载。喜欢看日本动作片的，你可以告诉他你有大量日本动作大片下 载。只要对方想看，把你做的网页发过去就行了。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 现在要解决的是第二个问题，怎么调用flashget下载链接。这个其实也不难的，仔细想想，不是很多下载网站都有一个flashget下载专用地址么？ 我们要做的就是把那里的代码扒出来。其实就是js对原始URL做一些变换，调用其中的convertFgURL函数和 Flashget_SetHref_js函数就可以了。JS代码如下：</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> fg_base64EncodeChars = <span style="color: rgb(51, 102, 204);">&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/&quot;</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> fg_base64DecodeChars = <span style="color: rgb(0, 51, 102); font-weight: bold;">new</span> Array<span style="color: rgb(102, 204, 102);">(</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>,</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>,</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">62</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">63</span>,</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(204, 0, 0);">52</span>, <span style="color: rgb(204, 0, 0);">53</span>, <span style="color: rgb(204, 0, 0);">54</span>, <span style="color: rgb(204, 0, 0);">55</span>, <span style="color: rgb(204, 0, 0);">56</span>, <span style="color: rgb(204, 0, 0);">57</span>, <span style="color: rgb(204, 0, 0);">58</span>, <span style="color: rgb(204, 0, 0);">59</span>, <span style="color: rgb(204, 0, 0);">60</span>, <span style="color: rgb(204, 0, 0);">61</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>,</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(204, 0, 0);">-1</span>,  <span style="color: rgb(204, 0, 0);">0</span>,  <span style="color: rgb(204, 0, 0);">1</span>,  <span style="color: rgb(204, 0, 0);">2</span>,  <span style="color: rgb(204, 0, 0);">3</span>,  <span style="color: rgb(204, 0, 0);">4</span>,  <span style="color: rgb(204, 0, 0);">5</span>,  <span style="color: rgb(204, 0, 0);">6</span>,  <span style="color: rgb(204, 0, 0);">7</span>,  <span style="color: rgb(204, 0, 0);">8</span>,  <span style="color: rgb(204, 0, 0);">9</span>, <span style="color: rgb(204, 0, 0);">10</span>, <span style="color: rgb(204, 0, 0);">11</span>, <span style="color: rgb(204, 0, 0);">12</span>, <span style="color: rgb(204, 0, 0);">13</span>, <span style="color: rgb(204, 0, 0);">14</span>,</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(204, 0, 0);">15</span>, <span style="color: rgb(204, 0, 0);">16</span>, <span style="color: rgb(204, 0, 0);">17</span>, <span style="color: rgb(204, 0, 0);">18</span>, <span style="color: rgb(204, 0, 0);">19</span>, <span style="color: rgb(204, 0, 0);">20</span>, <span style="color: rgb(204, 0, 0);">21</span>, <span style="color: rgb(204, 0, 0);">22</span>, <span style="color: rgb(204, 0, 0);">23</span>, <span style="color: rgb(204, 0, 0);">24</span>, <span style="color: rgb(204, 0, 0);">25</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>,</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">26</span>, <span style="color: rgb(204, 0, 0);">27</span>, <span style="color: rgb(204, 0, 0);">28</span>, <span style="color: rgb(204, 0, 0);">29</span>, <span style="color: rgb(204, 0, 0);">30</span>, <span style="color: rgb(204, 0, 0);">31</span>, <span style="color: rgb(204, 0, 0);">32</span>, <span style="color: rgb(204, 0, 0);">33</span>, <span style="color: rgb(204, 0, 0);">34</span>, <span style="color: rgb(204, 0, 0);">35</span>, <span style="color: rgb(204, 0, 0);">36</span>, <span style="color: rgb(204, 0, 0);">37</span>, <span style="color: rgb(204, 0, 0);">38</span>, <span style="color: rgb(204, 0, 0);">39</span>, <span style="color: rgb(204, 0, 0);">40</span>,</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(204, 0, 0);">41</span>, <span style="color: rgb(204, 0, 0);">42</span>, <span style="color: rgb(204, 0, 0);">43</span>, <span style="color: rgb(204, 0, 0);">44</span>, <span style="color: rgb(204, 0, 0);">45</span>, <span style="color: rgb(204, 0, 0);">46</span>, <span style="color: rgb(204, 0, 0);">47</span>, <span style="color: rgb(204, 0, 0);">48</span>, <span style="color: rgb(204, 0, 0);">49</span>, <span style="color: rgb(204, 0, 0);">50</span>, <span style="color: rgb(204, 0, 0);">51</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span>, <span style="color: rgb(204, 0, 0);">-1</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">function</span> fg_base64encode<span style="color: rgb(102, 204, 102);">(</span>str<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> out, i, len;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> c1, c2, c3;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">len = str.<span style="color: rgb(0, 102, 0);">length</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">i = <span style="color: rgb(204, 0, 0);">0</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out = <span style="color: rgb(51, 102, 204);">&quot;&quot;</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">while</span><span style="color: rgb(102, 204, 102);">(</span>i &lt; len<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">c1 = str.<span style="color: rgb(0, 102, 0);">charCodeAt</span><span style="color: rgb(102, 204, 102);">(</span>i++<span style="color: rgb(102, 204, 102);">)</span> &amp; 0xff;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>i == len<span style="color: rgb(102, 204, 102);">)</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += fg_base64EncodeChars.<span style="color: rgb(0, 102, 0);">charAt</span><span style="color: rgb(102, 204, 102);">(</span>c1 &gt;&gt; <span style="color: rgb(204, 0, 0);">2</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += fg_base64EncodeChars.<span style="color: rgb(0, 102, 0);">charAt</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c1 &amp; 0x3<span style="color: rgb(102, 204, 102);">)</span> &lt;&lt; <span style="color: rgb(204, 0, 0);">4</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += <span style="color: rgb(51, 102, 204);">&quot;==&quot;</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">c2 = str.<span style="color: rgb(0, 102, 0);">charCodeAt</span><span style="color: rgb(102, 204, 102);">(</span>i++<span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>i == len<span style="color: rgb(102, 204, 102);">)</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += fg_base64EncodeChars.<span style="color: rgb(0, 102, 0);">charAt</span><span style="color: rgb(102, 204, 102);">(</span>c1 &gt;&gt; <span style="color: rgb(204, 0, 0);">2</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += fg_base64EncodeChars.<span style="color: rgb(0, 102, 0);">charAt</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c1 &amp; 0x3<span style="color: rgb(102, 204, 102);">)</span>&lt;&lt; <span style="color: rgb(204, 0, 0);">4</span><span style="color: rgb(102, 204, 102);">)</span> | <span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c2 &amp; 0xF0<span style="color: rgb(102, 204, 102);">)</span> &gt;&gt; <span style="color: rgb(204, 0, 0);">4</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += fg_base64EncodeChars.<span style="color: rgb(0, 102, 0);">charAt</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c2 &amp; 0xF<span style="color: rgb(102, 204, 102);">)</span> &lt;&lt; <span style="color: rgb(204, 0, 0);">2</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += <span style="color: rgb(51, 102, 204);">&quot;=&quot;</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">c3 = str.<span style="color: rgb(0, 102, 0);">charCodeAt</span><span style="color: rgb(102, 204, 102);">(</span>i++<span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += fg_base64EncodeChars.<span style="color: rgb(0, 102, 0);">charAt</span><span style="color: rgb(102, 204, 102);">(</span>c1 &gt;&gt; <span style="color: rgb(204, 0, 0);">2</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += fg_base64EncodeChars.<span style="color: rgb(0, 102, 0);">charAt</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c1 &amp; 0x3<span style="color: rgb(102, 204, 102);">)</span>&lt;&lt; <span style="color: rgb(204, 0, 0);">4</span><span style="color: rgb(102, 204, 102);">)</span> | <span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c2 &amp; 0xF0<span style="color: rgb(102, 204, 102);">)</span> &gt;&gt; <span style="color: rgb(204, 0, 0);">4</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += fg_base64EncodeChars.<span style="color: rgb(0, 102, 0);">charAt</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c2 &amp; 0xF<span style="color: rgb(102, 204, 102);">)</span> &lt;&lt; <span style="color: rgb(204, 0, 0);">2</span><span style="color: rgb(102, 204, 102);">)</span> | <span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c3 &amp; 0xC0<span style="color: rgb(102, 204, 102);">)</span> &gt;&gt;<span style="color: rgb(204, 0, 0);">6</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += fg_base64EncodeChars.<span style="color: rgb(0, 102, 0);">charAt</span><span style="color: rgb(102, 204, 102);">(</span>c3 &amp; 0x3F<span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">return</span> out;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">function</span> fg_base64decode<span style="color: rgb(102, 204, 102);">(</span>str<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> c1, c2, c3, c4;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> i, len, out;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">len = str.<span style="color: rgb(0, 102, 0);">length</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">i = <span style="color: rgb(204, 0, 0);">0</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out = <span style="color: rgb(51, 102, 204);">&quot;&quot;</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">while</span><span style="color: rgb(102, 204, 102);">(</span>i &lt; len<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 153, 0); font-style: italic;">/* c1 */</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">do</span> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">c1 = fg_base64DecodeChars<span style="color: rgb(102, 204, 102);">[</span>str.<span style="color: rgb(0, 102, 0);">charCodeAt</span><span style="color: rgb(102, 204, 102);">(</span>i++<span style="color: rgb(102, 204, 102);">)</span> &amp; 0xff<span style="color: rgb(102, 204, 102);">]</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span> <span style="color: rgb(0, 0, 102); font-weight: bold;">while</span><span style="color: rgb(102, 204, 102);">(</span>i &lt; len &amp;&amp; c1 == <span style="color: rgb(204, 0, 0);">-1</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>c1 == <span style="color: rgb(204, 0, 0);">-1</span><span style="color: rgb(102, 204, 102);">)</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 153, 0); font-style: italic;">/* c2 */</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">do</span> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">c2 = fg_base64DecodeChars<span style="color: rgb(102, 204, 102);">[</span>str.<span style="color: rgb(0, 102, 0);">charCodeAt</span><span style="color: rgb(102, 204, 102);">(</span>i++<span style="color: rgb(102, 204, 102);">)</span> &amp; 0xff<span style="color: rgb(102, 204, 102);">]</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span> <span style="color: rgb(0, 0, 102); font-weight: bold;">while</span><span style="color: rgb(102, 204, 102);">(</span>i &lt; len &amp;&amp; c2 == <span style="color: rgb(204, 0, 0);">-1</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>c2 == <span style="color: rgb(204, 0, 0);">-1</span><span style="color: rgb(102, 204, 102);">)</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += String.<span style="color: rgb(0, 102, 0);">fromCharCode</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c1 &lt;&lt; <span style="color: rgb(204, 0, 0);">2</span><span style="color: rgb(102, 204, 102);">)</span> | <span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c2 &amp; 0x30<span style="color: rgb(102, 204, 102);">)</span> &gt;&gt; <span style="color: rgb(204, 0, 0);">4</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 153, 0); font-style: italic;">/* c3 */</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">do</span> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">c3 = str.<span style="color: rgb(0, 102, 0);">charCodeAt</span><span style="color: rgb(102, 204, 102);">(</span>i++<span style="color: rgb(102, 204, 102);">)</span> &amp; 0xff;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>c3 == <span style="color: rgb(204, 0, 0);">61</span><span style="color: rgb(102, 204, 102);">)</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">return</span> out;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">c3 = fg_base64DecodeChars<span style="color: rgb(102, 204, 102);">[</span>c3<span style="color: rgb(102, 204, 102);">]</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span> <span style="color: rgb(0, 0, 102); font-weight: bold;">while</span><span style="color: rgb(102, 204, 102);">(</span>i &lt; len &amp;&amp; c3 == <span style="color: rgb(204, 0, 0);">-1</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>c3 == <span style="color: rgb(204, 0, 0);">-1</span><span style="color: rgb(102, 204, 102);">)</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += String.<span style="color: rgb(0, 102, 0);">fromCharCode</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c2 &amp; 0XF<span style="color: rgb(102, 204, 102);">)</span> &lt;&lt; <span style="color: rgb(204, 0, 0);">4</span><span style="color: rgb(102, 204, 102);">)</span> | <span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c3 &amp; 0x3C<span style="color: rgb(102, 204, 102);">)</span> &gt;&gt; <span style="color: rgb(204, 0, 0);">2</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 153, 0); font-style: italic;">/* c4 */</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">do</span> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">c4 = str.<span style="color: rgb(0, 102, 0);">charCodeAt</span><span style="color: rgb(102, 204, 102);">(</span>i++<span style="color: rgb(102, 204, 102);">)</span> &amp; 0xff;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>c4 == <span style="color: rgb(204, 0, 0);">61</span><span style="color: rgb(102, 204, 102);">)</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">return</span> out;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">c4 = fg_base64DecodeChars<span style="color: rgb(102, 204, 102);">[</span>c4<span style="color: rgb(102, 204, 102);">]</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span> <span style="color: rgb(0, 0, 102); font-weight: bold;">while</span><span style="color: rgb(102, 204, 102);">(</span>i &lt; len &amp;&amp; c4 == <span style="color: rgb(204, 0, 0);">-1</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>c4 == <span style="color: rgb(204, 0, 0);">-1</span><span style="color: rgb(102, 204, 102);">)</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += String.<span style="color: rgb(0, 102, 0);">fromCharCode</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c3 &amp; 0x03<span style="color: rgb(102, 204, 102);">)</span> &lt;&lt; <span style="color: rgb(204, 0, 0);">6</span><span style="color: rgb(102, 204, 102);">)</span> | c4<span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">return</span> out;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">function</span> fg_utf16to8<span style="color: rgb(102, 204, 102);">(</span>str<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> out, i, len, c;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out = <span style="color: rgb(51, 102, 204);">&quot;&quot;</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">len = str.<span style="color: rgb(0, 102, 0);">length</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">for</span><span style="color: rgb(102, 204, 102);">(</span>i = <span style="color: rgb(204, 0, 0);">0</span>; i &lt; len; i++<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">c = str.<span style="color: rgb(0, 102, 0);">charCodeAt</span><span style="color: rgb(102, 204, 102);">(</span>i<span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">if</span> <span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c &gt;= 0x0001<span style="color: rgb(102, 204, 102);">)</span> &amp;&amp; <span style="color: rgb(102, 204, 102);">(</span>c &lt;= 0x007F<span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += str.<span style="color: rgb(0, 102, 0);">charAt</span><span style="color: rgb(102, 204, 102);">(</span>i<span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span> <span style="color: rgb(0, 0, 102); font-weight: bold;">else</span> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span> <span style="color: rgb(102, 204, 102);">(</span>c &gt; 0x07FF<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += String.<span style="color: rgb(0, 102, 0);">fromCharCode</span><span style="color: rgb(102, 204, 102);">(</span>0xE0 | <span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c &gt;&gt; <span style="color: rgb(204, 0, 0);">12</span><span style="color: rgb(102, 204, 102);">)</span> &amp; 0x0F<span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += String.<span style="color: rgb(0, 102, 0);">fromCharCode</span><span style="color: rgb(102, 204, 102);">(</span>0x80 | <span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c &gt;&gt;  <span style="color: rgb(204, 0, 0);">6</span><span style="color: rgb(102, 204, 102);">)</span> &amp; 0x3F<span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += String.<span style="color: rgb(0, 102, 0);">fromCharCode</span><span style="color: rgb(102, 204, 102);">(</span>0x80 | <span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c &gt;&gt;  <span style="color: rgb(204, 0, 0);">0</span><span style="color: rgb(102, 204, 102);">)</span> &amp; 0x3F<span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span> <span style="color: rgb(0, 0, 102); font-weight: bold;">else</span> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += String.<span style="color: rgb(0, 102, 0);">fromCharCode</span><span style="color: rgb(102, 204, 102);">(</span>0xC0 | <span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c &gt;&gt;  <span style="color: rgb(204, 0, 0);">6</span><span style="color: rgb(102, 204, 102);">)</span> &amp; 0x1F<span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += String.<span style="color: rgb(0, 102, 0);">fromCharCode</span><span style="color: rgb(102, 204, 102);">(</span>0x80 | <span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c &gt;&gt;  <span style="color: rgb(204, 0, 0);">0</span><span style="color: rgb(102, 204, 102);">)</span> &amp; 0x3F<span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">return</span> out;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">function</span> fg_utf8to16<span style="color: rgb(102, 204, 102);">(</span>str<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> out, i, len, c;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> char2, char3;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out = <span style="color: rgb(51, 102, 204);">&quot;&quot;</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">len = str.<span style="color: rgb(0, 102, 0);">length</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">i = <span style="color: rgb(204, 0, 0);">0</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">while</span><span style="color: rgb(102, 204, 102);">(</span>i &lt; len<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">c = str.<span style="color: rgb(0, 102, 0);">charCodeAt</span><span style="color: rgb(102, 204, 102);">(</span>i++<span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">switch</span><span style="color: rgb(102, 204, 102);">(</span>c &gt;&gt; <span style="color: rgb(204, 0, 0);">4</span><span style="color: rgb(102, 204, 102);">)</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">case</span> <span style="color: rgb(204, 0, 0);">0</span>: <span style="color: rgb(0, 0, 102); font-weight: bold;">case</span> <span style="color: rgb(204, 0, 0);">1</span>: <span style="color: rgb(0, 0, 102); font-weight: bold;">case</span> <span style="color: rgb(204, 0, 0);">2</span>: <span style="color: rgb(0, 0, 102); font-weight: bold;">case</span> <span style="color: rgb(204, 0, 0);">3</span>: <span style="color: rgb(0, 0, 102); font-weight: bold;">case</span> <span style="color: rgb(204, 0, 0);">4</span>: <span style="color: rgb(0, 0, 102); font-weight: bold;">case</span> <span style="color: rgb(204, 0, 0);">5</span>: <span style="color: rgb(0, 0, 102); font-weight: bold;">case</span> <span style="color: rgb(204, 0, 0);">6</span>: <span style="color: rgb(0, 0, 102); font-weight: bold;">case</span> <span style="color: rgb(204, 0, 0);">7</span>:</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 153, 0); font-style: italic;">// 0xxxxxxx</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += str.<span style="color: rgb(0, 102, 0);">charAt</span><span style="color: rgb(102, 204, 102);">(</span>i<span style="color: rgb(204, 0, 0);">-1</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">case</span> <span style="color: rgb(204, 0, 0);">12</span>: <span style="color: rgb(0, 0, 102); font-weight: bold;">case</span> <span style="color: rgb(204, 0, 0);">13</span>:</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 153, 0); font-style: italic;">// 110x xxxx   10xx xxxx</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">char2 = str.<span style="color: rgb(0, 102, 0);">charCodeAt</span><span style="color: rgb(102, 204, 102);">(</span>i++<span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += String.<span style="color: rgb(0, 102, 0);">fromCharCode</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c &amp; 0x1F<span style="color: rgb(102, 204, 102);">)</span> &lt;&lt; <span style="color: rgb(204, 0, 0);">6</span><span style="color: rgb(102, 204, 102);">)</span> | <span style="color: rgb(102, 204, 102);">(</span>char2 &amp; 0x3F<span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">case</span> <span style="color: rgb(204, 0, 0);">14</span>:</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 153, 0); font-style: italic;">// 1110 xxxx  10xx xxxx  10xx xxxx</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">char2 = str.<span style="color: rgb(0, 102, 0);">charCodeAt</span><span style="color: rgb(102, 204, 102);">(</span>i++<span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">char3 = str.<span style="color: rgb(0, 102, 0);">charCodeAt</span><span style="color: rgb(102, 204, 102);">(</span>i++<span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">out += String.<span style="color: rgb(0, 102, 0);">fromCharCode</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>c &amp; 0x0F<span style="color: rgb(102, 204, 102);">)</span> &lt;&lt; <span style="color: rgb(204, 0, 0);">12</span><span style="color: rgb(102, 204, 102);">)</span> |</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>char2 &amp; 0x3F<span style="color: rgb(102, 204, 102);">)</span> &lt;&lt; <span style="color: rgb(204, 0, 0);">6</span><span style="color: rgb(102, 204, 102);">)</span> |</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>char3 &amp; 0x3F<span style="color: rgb(102, 204, 102);">)</span> &lt;&lt; <span style="color: rgb(204, 0, 0);">0</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">break</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">return</span> out;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">function</span> convertFgURL<span style="color: rgb(102, 204, 102);">(</span>url,id<span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">try</span><span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">FlashgetDown<span style="color: rgb(102, 204, 102);">(</span>FlashgetEncode_js<span style="color: rgb(102, 204, 102);">(</span>url,id<span style="color: rgb(102, 204, 102);">)</span>,id<span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span><span style="color: rgb(0, 0, 102); font-weight: bold;">catch</span><span style="color: rgb(102, 204, 102);">(</span>e<span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 153, 0); font-style: italic;">//alert(e.message);</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">location.<span style="color: rgb(0, 102, 0);">href</span> = url;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">function</span> Flashget_SetHref_js<span style="color: rgb(102, 204, 102);">(</span>obj,uid,url<span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">obj.<span style="color: rgb(0, 102, 0);">href</span> = FlashgetEncode_js<span style="color: rgb(102, 204, 102);">(</span>url,uid<span style="color: rgb(102, 204, 102);">)</span> ;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">function</span> FlashgetEncode_js<span style="color: rgb(102, 204, 102);">(</span>t_url,uid<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> prefix = <span style="color: rgb(51, 102, 204);">&quot;Flashget://&quot;</span>;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> FlashgetURL =  prefix + fg_base64encode<span style="color: rgb(102, 204, 102);">(</span>fg_utf16to8<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">&quot;[FLASHGET]&quot;</span> +t_url + <span style="color: rgb(51, 102, 204);">&quot;[FLASHGET]&quot;</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>+<span style="color: rgb(51, 102, 204);">&quot;&amp;&quot;</span>+uid;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(0, 0, 102); font-weight: bold;">return</span> FlashgetURL;</div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span></div></li><li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;">&nbsp;</div>我这篇文章说的任何东西，我都没有自己测试过。直白的说，这就是传说中的YY，哈哈。</li></ol></pre>
				]]>
			</description>
			<pubDate>Thu, 14 Aug 2008 10:16:28 +0800</pubDate>
		</item>
		<item>
			<title><![CDATA[赤壁下集]]></title>
			<category>八卦</category>
			<author>wustyunshu@yahoo.com.cn(云舒)</author>
			<link>http://www.icylife.net/yunshu/show.php?id=602</link>
			<guid>http://www.icylife.net/yunshu/show.php?id=602</guid>
			<description>
				<![CDATA[
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 幻影七年，仲夏，太虚幻境帝国新建雀巢，兴办奥迪加一圈大会，邀万邦首领观礼，共享盛世。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;左右或进上曰：&ldquo;臣有一计，可兴我朝。&ldquo;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;上问之，对曰：&rdquo;番酋到时，皆引入雀巢之内。吾等号令关闭城门，以弹击之，绝无遗漏，此为&lsquo;关门打狗&rsquo;之计也。番邦若有疑惑，吾等可以雀巢不堪万人俯卧撑对之。此计若成，则番邦群龙无首，吾国可兴矣！&ldquo;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;上思之再三，曰：&rdquo;俯卧撑三字，何以服天下？别思良策，或暂缓图之。&ldquo;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;又曰：&rdquo;以弹击之难避人耳目，然刀斧手何如？陛下掷杯为号，臣亲领刀斧手千余，纵美猴王布鞋神勇盖世，料亦难档。&ldquo;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;上曰：&rdquo;吾等天朝上国，不为此等之事。汝等可思别策。&ldquo;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;左右对曰：&ldquo;陛下仁慈，若不忍，吾等亦有&lsquo;驱虎狼吞&rsquo;之计，无需天朝动手&rdquo;。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;上以目视之，问曰：&ldquo;计将安出？&rdquo;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;对曰：&ldquo;吾等安席之时，可将金太阳王置于美猴王布鞋之左，巴古王孙悟空卡卡罗特为其右。待陛下致辞，可曰因地震天灾，灭灯静默五分钟。吾料定，此片刻之间，大事可定矣。&rdquo;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;上曰：&ldquo;亦不可。事虽可成，然美猴王国岂肯罢休？吾不忍见苍生遭祸。&rdquo;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;左右劝曰：&ldquo;太祖皇帝曾有诗，&lsquo;遍地哀鸿遍地血, 无非一念救苍生&rsquo;，成大事者，不拘小节。&rdquo;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;上默不语，然意似有所动。某者不解，良久，曰，&ldquo;吾知之矣&rdquo;，乃去。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;欲知后事如何，请关注太虚幻境帝国边缘电视台。</p>
				]]>
			</description>
			<pubDate>Fri, 08 Aug 2008 13:35:02 +0800</pubDate>
		</item>
		<item>
			<title><![CDATA[因为系统陈旧，加州政府电脑无法处理减薪命令]]></title>
			<category>八卦</category>
			<author>wustyunshu@yahoo.com.cn(云舒)</author>
			<link>http://www.icylife.net/yunshu/show.php?id=601</link>
			<guid>http://www.icylife.net/yunshu/show.php?id=601</guid>
			<description>
				<![CDATA[
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;上周，为了应付至今没有通过的州预算，共和党的加利福尼亚州州长阿诺德&middot;施瓦辛格（<a target="_blank" href="http://en.wikipedia.org/wiki/Arnold_Schwarzenegger">Arnold Schwarzenegge</a>）下达了一项强制性的减薪命令，要求二十万名州公务员接受每小时6.55美元的联邦最低薪水。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;民主党州审计官John Chiang从原则和法律依据上反对减薪命令，称这是不可行的，<a target="_blank" href="http://www.sacbee.com/111/story/1132588.html">因为政府工资支付系统太陈旧了</a>，它使用的是越南时代的程序语言，大学生已经不再学习了。John Chiang在周一说要重新配置工资支付系统至少需要6个月时间，而施瓦辛格坚持要在一个月内实现。这套系统基于<a target="_blank" href="http://zh.wikipedia.org/wiki/COBOL">COBOL</a>，一位商业顾问称要找到COBOL程序员非常困难。如果想在一个月内解决工资问题，施瓦辛格必须重新雇用上周被他解雇的半退休的计算机程序员。</p>
				]]>
			</description>
			<pubDate>Wed, 06 Aug 2008 21:59:28 +0800</pubDate>
		</item>
		<item>
			<title><![CDATA[这几天]]></title>
			<category>技术</category>
			<author>wustyunshu@yahoo.com.cn(云舒)</author>
			<link>http://www.icylife.net/yunshu/show.php?id=600</link>
			<guid>http://www.icylife.net/yunshu/show.php?id=600</guid>
			<description>
				<![CDATA[
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这几天做了两件事情，第一件是沟通，第二件还是沟通。和IT沟通现在的内网，计划中的新内网。和SA沟通现在的机房，计划中的新机房。简单的说，累并快乐者。虽然嘴巴说干了，但是喜欢这种感觉。从开始的抵触，到配合，到最后有问题的时候主动找过来咨询，要的就是这样的感觉，这种过程。其实没有太多的技巧，就是告诉别人，你可以为他做什么，这样做他有什么好处。并且在做的过程中，逐渐用自己的技术，慢慢的让他们产生信任，依赖的感觉。还好最近一段时间的努力，新的架构都通过了，等着最后的实施吧。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 下午发现我们的<a href="http://planet.ph4nt0m.org" target="_blank">聚合博客plane</a>t不能更新某些RSS了，仔细检查了一下，原来有些人在博客写了火星字，导致认不出来。更有甚者，比如CSDN&mdash;&mdash;所谓的开发者网络，他们博客的RSS根本就没有编码这中东西，而且时间也是错的。最终对抓取程序做了点升级，不是UTF-8的按照宣告的编码转换成UTF-8，没有编码的不管了，终于解决了问题。再鄙视一下CSDN，顺便再提一下，真的不喜欢过于宽松的协议，都严格些吧。</p>
				]]>
			</description>
			<pubDate>Wed, 06 Aug 2008 16:31:37 +0800</pubDate>
		</item>
		<item>
			<title><![CDATA[校内跨站]]></title>
			<category>技术</category>
			<author>wustyunshu@yahoo.com.cn(云舒)</author>
			<link>http://www.icylife.net/yunshu/show.php?id=599</link>
			<guid>http://www.icylife.net/yunshu/show.php?id=599</guid>
			<description>
				<![CDATA[
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 早上还以为仅仅是转跳，没想到还可以跨站，呵呵。<a href="http://login.xiaonei.com/Login.do?rf=r&amp;origURL=&quot;&gt;&lt;script&gt;alert(/xxx/)&lt;/script&gt;" target="_blank">http://login.xiaonei.com/Login.do?rf=r&amp;origURL=&quot;&gt;&lt;script&gt;alert(/xxx/)&lt;/script&gt;</a></p>
				]]>
			</description>
			<pubDate>Wed, 06 Aug 2008 10:24:35 +0800</pubDate>
		</item>
		<item>
			<title><![CDATA[校内网也有URL转跳问题]]></title>
			<category>技术</category>
			<author>wustyunshu@yahoo.com.cn(云舒)</author>
			<link>http://www.icylife.net/yunshu/show.php?id=598</link>
			<guid>http://www.icylife.net/yunshu/show.php?id=598</guid>
			<description>
				<![CDATA[
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 前几天看了下PW的代码，注射那是很多的，不过剑心达人已经开始发了，难道也要连发一个星期？呵呵。BTW，今天去校内看东西的时候，发现xiaonei登陆也有URL转跳的问题，不过我老觉得这个不算漏洞，或许可以做个页面来骗人偷密码吧。<a target="_blank" href="http://login.xiaonei.com/Login.do?rf=r&amp;origURL=http%3A%2F%2Fwww.icylife.net%2Fyunshu">http://login.xiaonei.com/Login.do?rf=r&amp;origURL=http%3A%2F%2Fwww.icylife.net%2Fyunshu</a></p>
				]]>
			</description>
			<pubDate>Wed, 06 Aug 2008 09:35:24 +0800</pubDate>
		</item>
		<item>
			<title><![CDATA[PHPWIND代码]]></title>
			<category>琐记</category>
			<author>wustyunshu@yahoo.com.cn(云舒)</author>
			<link>http://www.icylife.net/yunshu/show.php?id=597</link>
			<guid>http://www.icylife.net/yunshu/show.php?id=597</guid>
			<description>
				<![CDATA[
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这几天累了的时候就略微看了看PHPWIND的代码，不客气的说，代码安全性方面就是一堆垃圾。</p>
				]]>
			</description>
			<pubDate>Tue, 05 Aug 2008 14:09:56 +0800</pubDate>
		</item>
		<item>
			<title><![CDATA[跳蚤实验]]></title>
			<category>八卦</category>
			<author>wustyunshu@yahoo.com.cn(云舒)</author>
			<link>http://www.icylife.net/yunshu/show.php?id=596</link>
			<guid>http://www.icylife.net/yunshu/show.php?id=596</guid>
			<description>
				<![CDATA[
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 最近某国很多事情乱七八糟的，老是让我想起一个很古老的实验，跳蚤能听见声音嘛？这个实验是这样的。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;实验器材：跳蚤一只，小刀一把，&nbsp; <br />
&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;实验过程：1、把跳蚤放在桌上，对它喊：跳！跳蚤跳了起来。&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2、将跳蚤的腿砍掉，再把它放在桌子上，对它喊：跳！跳蚤不动。&nbsp; <br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;结论：跳蚤是用腿听声音的。</p>
				]]>
			</description>
			<pubDate>Mon, 04 Aug 2008 10:36:49 +0800</pubDate>
		</item>
		<item>
			<title><![CDATA[粗糙的C#版HTTP代理]]></title>
			<category>技术</category>
			<author>wustyunshu@yahoo.com.cn(云舒)</author>
			<link>http://www.icylife.net/yunshu/show.php?id=595</link>
			<guid>http://www.icylife.net/yunshu/show.php?id=595</guid>
			<description>
				<![CDATA[
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;很久以前答应给KJ写个C#版的代理类，结果一直拖着，直到从socks5代理降低要求为HTTP代理。最近稍微空一点，晚上敲了敲代码，做了个简陋的东西。不过写这个东西才发现，原来我对HTTP协议并不是那么了解，这个还是有许多问题的，不过我会继续改进，维护这段代码&mdash;&mdash;虽然以前说过类似的没做到，但是这次是认真的。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;前些时候一个无锡人在我博客留言，说我读再多的书，也改变不了我是个程序员的本质。或许它觉得它是在鄙视我，不过我到觉得它是在赞扬我&mdash;&mdash;我真的算不上是个程序员，写代码的能力实在是太烂了&mdash;&mdash;不过我会努力的。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 说说这段代码的问题吧。首先是字符串切割的问题，要将客户端提交过来的GET，POST等原始请求切割，分离出主机名，端口，URL等数据。这里用正则匹配是最好的，遗憾的是我不擅长此道，所以使用了手动切割的办法，很笨重繁琐，但是毕竟它工作得很好。第二个问题是Keep-Alive的问题，这里我没有处理好。最开始我在http proxy里面修改客户端请求，强行将keep-alive修改为close，但是发现在某些站点的时候会出错。于是使用了类似select的方法读取数据，直到超时关闭两端的连接。我猜测，这里如果解析content-length会更好，但是略微繁琐了点，还是等我仔细阅读下RFC再看怎么修改吧。第三个是CONNECT方法的问题，这个到很简单，转发数据就行了，因此是这个代码中写得最好的一部分，用来登陆QQ还是不错的。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 说实话，我不喜欢HTTP这种太宽松的协议，感觉灵活得让我难以把握。直接看代码吧，我加了很多debug信息，真的要用就去掉好了。调用这个类很简单，看main函数的实现就好了。为了方便贴代码，我写的时候就把三个类写到一个文件里面去了。顺便要说的是，虽然有类，但是没有任何面向对象的东西&mdash;&mdash;这也再次证明，其实我算不上一个程序员，最多是个代码爱好者。</p>
<ol>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">using</span> <span style="color: #000000">System</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">using</span> <span style="color: #000000">System</span>.<span style="color: #0000ff">Net</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">using</span> <span style="color: #000000">System</span>.<span style="color: #0000ff">Net</span>.<span style="color: #0000ff">Sockets</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">using</span> <span style="color: #000000">System</span>.<span style="color: #0000ff">Text</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">using</span> <span style="color: #000000">System</span>.<span style="color: #0000ff">IO</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">using</span> <span style="color: #000000">System</span>.<span style="color: #0000ff">Threading</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">using</span> <span style="color: #000000">System</span>.<span style="color: #0000ff">Collections</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">namespace</span> HttpProxy</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">{</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">public</span> <span style="color: #ff0000">class</span> HttpProxy</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">{</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #ff0000">int</span> ProxyPort;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">/// &lt;summary&gt;</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">/// 代理服务器入口类构造函数</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">/// &lt;/summary&gt;</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">/// &lt;param name=&quot;Port&quot;&gt;Http Proxy监听的端口&lt;/param&gt;</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">public</span> HttpProxy<span style="color: #000000">(</span> <span style="color: #ff0000">int</span> Port<span style="color: #000000">)</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">{</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">ProxyPort = Port;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">}</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">/// &lt;summary&gt;</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">/// 启动Http代理服务器</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">/// &lt;/summary&gt;</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">public</span> <span style="color: #0600ff">void</span> Start<span style="color: #000000">(</span> <span style="color: #000000">)</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">{</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">TcpListener tcplistener = <span style="color: #0600ff">null</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">try</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">{</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">// 开始监听端口</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">tcplistener = <span style="color: #008000">new</span> TcpListener<span style="color: #000000">(</span>Dns.<span style="color: #0000ff">GetHostAddresses</span><span style="color: #000000">(</span>Dns.<span style="color: #0000ff">GetHostName</span><span style="color: #000000">(</span><span style="color: #000000">)</span><span style="color: #000000">)</span><span style="color: #000000">[</span><span style="color: #ff0000">0</span><span style="color: #000000">]</span>, ProxyPort<span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">tcplistener.<span style="color: #0000ff">Start</span><span style="color: #000000">(</span><span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">Console.<span style="color: #0000ff">WriteLine</span><span style="color: #000000">(</span><span style="color: #808080">&quot;侦听端口号: &quot;</span> + ProxyPort.<span style="color: #0000ff">ToString</span><span style="color: #000000">(</span><span style="color: #000000">)</span><span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">}</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">catch</span> <span style="color: #000000">(</span>Exception e<span style="color: #000000">)</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">{</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">Console.<span style="color: #0000ff">WriteLine</span><span style="color: #000000">(</span><span style="color: #808080">&quot;启动代理服务器失败: &quot;</span> + e.<span style="color: #0000ff">Message</span><span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">}</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">while</span> <span style="color: #000000">(</span><span style="color: #0600ff">true</span><span style="color: #000000">)</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">{</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">try</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">{</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">// 接受客户端连接</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">Socket socket = tcplistener.<span style="color: #0000ff">AcceptSocket</span><span style="color: #000000">(</span><span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">HttpSession Session = <span style="color: #008000">new</span> HttpSession<span style="color: #000000">(</span>socket<span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">// 启动新线程，处理连接</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">Thread thread = <span style="color: #008000">new</span> Thread<span style="color: #000000">(</span><span style="color: #008000">new</span> ThreadStart<span style="color: #000000">(</span>Session.<span style="color: #0000ff">Start</span><span style="color: #000000">)</span><span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">thread.<span style="color: #0000ff">Start</span><span style="color: #000000">(</span><span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">}</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">catch</span><span style="color: #000000">(</span> Exception e <span style="color: #000000">)</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">{</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">Console.<span style="color: #0000ff">WriteLine</span><span style="color: #000000">(</span><span style="color: #808080">&quot;接受客户端连接异常: &quot;</span> + e.<span style="color: #0000ff">Message</span> <span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">}</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">}</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">}</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">}</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">public</span> <span style="color: #ff0000">class</span> HttpSession</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">{</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">// 客户端socket</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">Socket ClientSocket;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">// 设定编码</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">Encoding ASCII = Encoding.<span style="color: #0000ff">ASCII</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">/// &lt;summary&gt;</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">/// 构造函数</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">/// &lt;/summary&gt;</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">/// &lt;param name=&quot;socket&quot;&gt;客户端socket&lt;/param&gt;</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">public</span> HttpSession<span style="color: #000000">(</span>Socket socket<span style="color: #000000">)</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">{</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">this</span>.<span style="color: #0000ff">ClientSocket</span> = socket;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">}</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">public</span> <span style="color: #0600ff">void</span> Start<span style="color: #000000">(</span><span style="color: #000000">)</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">{</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">// 客户端缓冲区，读取客户端命令</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #ff0000">Byte</span><span style="color: #000000">[</span><span style="color: #000000">]</span> ReadBuff = <span style="color: #008000">new</span> <span style="color: #ff0000">byte</span><span style="color: #000000">[</span><span style="color: #ff0000">1024</span> * <span style="color: #ff0000">10</span><span style="color: #000000">]</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">try</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">{</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #ff0000">int</span> Length = ClientSocket.<span style="color: #0000ff">Receive</span><span style="color: #000000">(</span>ReadBuff<span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">// 没有读到数据</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">if</span> <span style="color: #000000">(</span><span style="color: #ff0000">0</span> == Length<span style="color: #000000">)</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">{</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">Console.<span style="color: #0000ff">WriteLine</span><span style="color: #000000">(</span><span style="color: #808080">&quot;从客户端读取命令错误&quot;</span><span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">ClientSocket.<span style="color: #0000ff">Shutdown</span><span style="color: #000000">(</span>SocketShutdown.<span style="color: #0000ff">Both</span><span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">ClientSocket.<span style="color: #0000ff">Close</span><span style="color: #000000">(</span><span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">return</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">}</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">}</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">// 读取出现异常</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #0600ff">catch</span> <span style="color: #000000">(</span>Exception e<span style="color: #000000">)</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">{</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">Console.<span style="color: #0000ff">WriteLine</span><span style="color: #000000">(</span><span style="color: #808080">&quot;读取客户端异常: &quot;</span> + e.<span style="color: #0000ff">Message</span><span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #000000">}</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">// 来自客户端的HTTP请求字符串</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #ff0000">string</span> ClientMsg = ASCII.<span style="color: #0000ff">GetString</span><span style="color: #000000">(</span>ReadBuff<span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">// 根据rnrn截取请求行</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #ff0000">string</span> Line = ClientMsg.<span style="color: #0000ff">Substring</span><span style="color: #000000">(</span><span style="color: #ff0000">0</span>, ClientMsg.<span style="color: #0000ff">IndexOf</span><span style="color: #000000">(</span><span style="color: #808080">&quot;rn&quot;</span><span style="color: #000000">)</span><span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #ff0000">string</span><span style="color: #000000">[</span><span style="color: #000000">]</span> CmdArray = Line.<span style="color: #0000ff">Split</span><span style="color: #000000">(</span><span style="color: #808080">' '</span><span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">// GET http://www.test.com:80/index.php HTTP/1.1</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #008080; font-style: italic">// CONNECT www.test.com:443 HTTP/1.1</span></div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #ff0000">string</span> Cmd = CmdArray<span style="color: #000000">[</span><span style="color: #ff0000">0</span><span style="color: #000000">]</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace"><span style="color: #ff0000">string</span> RawUrl = CmdArray<span style="color: #000000">[</span><span style="color: #ff0000">1</span><span style="color: #000000">]</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">Console.<span style="color: #0000ff">WriteLine</span><span style="color: #000000">(</span><span style="color: #808080">&quot;原始请求: {0}&quot;</span>, Line<span style="color: #000000">)</span>;</div>
    </li>
    <li style="font-weight: normal; color: black; font-style: normal; font-family: 'Courier New', Courier, monospace">
    <div style="font-weight: normal; font-family: 'Courier New', Courier, monospace">&nbsp;</div>
    </li>
    <li style="font-weight: normal; color: black; 