1. ..檔案名探測以保證安全;
2. 常用MIME類型識别;
3. Trailing-slash重定向;
4. index.html首頁的處理;
5. 目錄清單;
micro_httpd借助于xinetd(inetd)運作,xinetd的原理與機制參考:
<a href="http://blog.chinaunix.net/space.php?uid=20196318&do=blog&id=172787" target="_blank">http://blog.chinaunix.net/space.php?uid=20196318&do=blog&id=172787</a>
借助xinetd,microhttpd在處理請求時,可從标準輸入讀取用戶端的請求,向标準輸出寫入對用戶端的響應。是以micro_httpd的核心在于分析http請求參數,并發送響應資料。
<b>micro_httpd</b><b>的部署與使用</b>
2. 設定micro_httpd的服務端口号,編輯/etc/services檔案,為其配置設定一個未用的端口号,本例中使用48888,在/etc/services檔案末尾添加兩行:
micro_httpd 48888/tcp
micro_httpd 48888/udp
3. 添加micro_httpd的xinetd配置檔案:
vi /etc/xinetd.d/micro_httpd
service micro_httpd
{
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/local/sbin/micro_httpd
server_args = /var/www/html
disable = no
flags = IPv4
}
# 其中server_args為配置micro_httpd運作時的根目錄
4. 重新開機xinetd服務以加載新的配置。/etc/init.d/xinetd restart
5. 測試,拷貝測試檔案到micro_httpd的根目錄,并通過浏覽器通路:
<b></b>
<b>http</b><b>協定相關</b>
1. 請求與響應封包格式
<a href="http://apps.hi.baidu.com/share/detail/24694860" target="_blank">http://apps.hi.baidu.com/share/detail/24694860</a>
<a href="http://blog.csdn.net/yang3290325/archive/2009/01/05/3710976.aspx" target="_blank">http://blog.csdn.net/yang3290325/archive/2009/01/05/3710976.aspx</a>
2. 檢視http請求與響應内容頭
<a href="http://www.51testing.com/?167686/viewspace-106751.html" target="_blank">http://www.51testing.com/?167686/viewspace-106751.html</a>
<a href="http://blog.sina.com.cn/s/blog_5f1fe33f0100d9zp.html" target="_blank">http://blog.sina.com.cn/s/blog_5f1fe33f0100d9zp.html</a>
3. URL Encoding:
<a href="http://www.ruanyifeng.com/blog/2010/02/url_encoding.html" target="_blank">http://www.ruanyifeng.com/blog/2010/02/url_encoding.html</a>
<a href="http://www.blooberry.com/indexdot/html/topics/urlencoding.htm" target="_blank">http://www.blooberry.com/indexdot/html/topics/urlencoding.htm</a>
<b> </b>
<b></b>
<b>micro_httpd</b><b>源代碼分析</b>