<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆 - 9  文章 - 21  trackbacks - 0
    <2008年2月>
    272829303112
    3456789
    10111213141516
    17181920212223
    2425262728291
    2345678

    常用鏈接

    留言簿(1)

    隨筆分類(9)

    隨筆檔案(9)

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    HTTP

    HTTP就是一種請求/響應模式。

    HTTP事務

    1. 連接 建立和服務器的連接
    2. 查詢 請求服務器上的資源
    3. 處理 服務器接受和處理請求
    4. 響應 服務器將請求的資源發送回客戶端
    5. 終止 事務完成后,關閉連接,除非客戶機與服務器之間立即發生另一事務。

    用telnet程序驗證這個過程

    連接

    telnet www.baidu.com 80

    80是HTTP協議默認的端口。

    查詢

    GET / HTTP/1.0↙

    ↙表示回車。

    GET / HTTP/1.0
    查詢方法名,有GET和POST
    GET方法不支持消息體
    服務器資源 HTTP版本

    在telnet中測試HTTP的POST是很麻煩的事。這里就不講了,何況GET和POST很類似。

    處理

    Baidu服務器根據請求,處理請求。如果用的是Servlet,就是執行那個Servlet的doGet方法。

    響應



    HTTP/1.1 200 OK
    Date: Sun, 03 Feb 2008 08:08:44 GMT
    Server: BWS/1.0
    Content-Length: 3022
    Content-Type: text/html
    Cache-Control: private
    Expires: Sun, 03 Feb 2008 08:08:44 GMT
    Set-Cookie: BAIDUID=2BB1B837C8EC6794A132C5D8DDD76721:FG=1; expires=Sun, 03-Feb-38 08:08:44 GMT; path=/; domain=.baidu.com
    P3P: CP=" OTI DSP COR IVA OUR IND COM "

    <html><head><meta http-equiv=Content-Type content="text/html;charset=gb2312"><title>百度一下,你就知道 </title><style>body{margin:4px 0}p{margin:0;padding:0}img{border:0}td,p,#u{font-size:12px}#b,#u,#l td,a{font-family:arial}#kw{font:16px Verdana;height:1.78em;padding-top:2px}#b{height:30px;padding-top:4px}#b,#b a{color:#77c;font-size:12px}#u{padding-right:10px;line-height:19px;text-align:right;margin-bottom:3px !important;margin-bottom:10px}#sb{height:2em;width:5.6em}#km{height:50px}#km a{font-family:宋體}#l{margin-bottom:5px}#m{margin-left:100px;width:22.1em;text-align:center}p,#b,table{width:600px;border:0}#sb,#km,#l,#m{font-size:14px}#m a,#m b{margin-right:1.14em}a{color:#00c}a:active{color:#f60}</style></head>
    <body><div id=u></div><center><a href=http://hi.baidu.com/baidu target=_blank><img src=http://www.baidu.com/img/logo.gif width=174 height=59 alt="點此進入 百度空間"></a><br><br><br><br><table cellpadding=0 cellspacing=0 id=l><tr><td align=left><div id=m><a onclick=s(this) href=http://news.baidu.com>新&nbsp;聞</a><b>網&nbsp;頁</b><a onclick=s(this) href=http://tieba.baidu.com>貼&nbsp;吧</a><a onclick=s(this) href=http://zhidao.baidu.com>知&nbsp;道</a><a onclick=s(this) href=http://mp3.baidu.com>MP3</a><a onclick=s(this) href=http://image.baidu.com>圖&nbsp;片</a></div></td></tr></table>
    <table cellpadding=0 cellspacing=0><tr valign=top><td width=92></td><td height=62 nowrap><form name=f action=/s><input type=text name=wd id=kw size=36 maxlength=100><script>var w=document.f.wd;w.focus();document.getElementById("u").innerHTML='<a ;function s(o){if(w.value.length>0){var h=o.href;var q=encodeURIComponent(w.value);if(h.indexOf("q=")!=-1){o.href=h.replace(new RegExp("q=[^&$]*"),"q="+q)}else{o.href+="?q="+q}}};(function(){if(new RegExp("q=([^&]+)").test(location.search)){w.value=decodeURIComponent(RegExp.$1)}})()</script><input type=hidden name=cl value=3> <input type=submit value=百度一下 id=sb><br><br></form></td><td width=100><a href=/search/jiqiao.html>幫助</a><br><a href=/gaoji/advanced.html>高級</a></td></tr></table>
    <p id=km>&nbsp;<a href=http://hi.baidu.com>空間</a>&nbsp;|&nbsp;<a href=http://www.baidu.com/more>更多>></a></p>
    <p style=height:60px></p>
    <p style=height:30px><a onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.baidu.com')" href=http://utility.baidu.com/traf/click.php?id=215&url=http://www.baidu.com>把百度設為首頁</a></p><p style=height:14px><a href=http://jingjia.baidu.com>企業推廣</a> | <a href=http://top.baidu.com>搜索風云榜</a> | <a href=/home.html>關于百度</a> | <a href=http://ir.baidu.com>About Baidu</a></p><p id=b>&copy;2008 Baidu <a href=http://www.baidu.com/duty>使用百度前必讀</a> <a href=http://www.miibeian.gov.cn target=_blank>京ICP證030173號</a> <a href=http://www.hd315.gov.cn/beian/view.asp?bianhao=010202001092500412><img src=http://gimg.baidu.com/img/gs.gif></a></p></center></body></html><!--4eca38de351397c2-->

    失去了跟主機的連接。

    終止

    用telnet連接web服務器,連接會立馬終止。如果用瀏覽器訪問,瀏覽器會取得與頁面有關的所有圖像、樣式表和腳本文件等,才終止連接。

    HTTP查詢和響應的消息格式

    HTTP查詢和響應的消息格式差不多。

    格式
    initliaze line
    key1:value1
    key2:value2

    [Optional message body]
    查詢格式
    GET /newaddr?name=jack&email=2 HTTP/1.0
    accept:*/*
    accept-language:zh-cn
    ... ...


    響應格式
    (具體見上面)
    HTTP/1.1 200 OK
    Date: Sun, 03 Feb 2008 08:08:44 GMT
    Server: BWS/1.0
    ... ...

    <html>...</html>

    后記

    HTTP定義了查詢和響應的消息格式。但每個瀏覽器和服務器在這種格式下,有自己定義的內容。服務器通過瀏覽器請求的消息,知道瀏覽器具體是什么型號的,是什么操作系統。這些具體怎么做的,下文分解

    posted on 2008-02-04 18:57 李四飛刀 閱讀(1794) 評論(0)  編輯  收藏 所屬分類: Struts2

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 成人免费淫片在线费观看| 1a级毛片免费观看| 亚洲国产人成中文幕一级二级| 亚洲日韩AV一区二区三区四区| 三年片在线观看免费观看高清电影| 亚洲精品mv在线观看| 国产免费久久精品99re丫y| 456亚洲人成在线播放网站| 免费看片A级毛片免费看| 亚洲av日韩专区在线观看| 吃奶摸下高潮60分钟免费视频| 黄色免费网址在线观看| 亚洲午夜精品第一区二区8050| 久久国产精品免费一区二区三区| 亚洲va久久久噜噜噜久久男同| 99精品在线免费观看| 亚洲Av无码一区二区二三区| 国产男女性潮高清免费网站| 日韩精品视频在线观看免费| 亚洲熟妇中文字幕五十中出| 久久w5ww成w人免费| 亚洲人成小说网站色| 亚洲AV日韩精品一区二区三区 | 国产亚洲精品精品国产亚洲综合| 国产精品免费久久久久电影网| 久久久久久久综合日本亚洲| 无码国产精品一区二区免费| 亚洲а∨精品天堂在线| 最近高清中文字幕无吗免费看| 亚洲中文字幕无码中文字| 亚洲区日韩区无码区| 日韩免费无码视频一区二区三区| 亚洲国产日韩精品| 激情综合色五月丁香六月亚洲| 67pao强力打造高清免费| 综合一区自拍亚洲综合图区| 亚洲乳大丰满中文字幕| 国产香蕉九九久久精品免费| 一级黄色免费大片| 亚洲一卡2卡4卡5卡6卡在线99| 亚洲精品无码久久毛片|