My Java Blog Park

          2006年9月28日 #

          http學習筆記

          一.HTTP請求:
          HTTP請求分為:
          ? 1).請求行
          ? 2).消息頭
          ? 3).空行
          ? 4).正文

          1.請求行
          ? [方法 URI HTTP版本信息]
          ? 如: GET /index.htm HTTP/1.0

          2.方法(全部大寫):
          ? GET????? 請求URI標識的資源
          ? HEAD???? 請求獲取響應消息頭
          ? PUT????? 請求存儲資源,并用URI作為其標識
          ? POST???? 請求服務器接收信息
          ? CONNECT? ?
          ? TRACE???
          ? DELETE
          ? OPTIONS


          二.HTTP響應:
          ? 1).狀態行
          ? 2).消息頭
          ? 3).空行
          ? 4).正文(資源的內容,比如index.htm文件的文本內容)


          1.狀態行
          ? HTTP版本信息 狀態碼 響應碼描述
          ? 例: HTTP/1.1 200 OK

          2.狀態碼(第一位表示響應的類別)
          ? 1xx:
          ? 2xx:
          ? 3xx:
          ? 4xx:
          ? 5xx:
          HTTP協議狀態碼具體意義
          ?? 100? :? Continue
          ?? 101? :? witchingProtocols
          ?? 200? :? OK
          ?? 201? :? Created
          ?? 202? :? Accepted
          ?? 203? :? Non-AuthoritativeInformation
          ?? 204? :? NoContent
          ?? 205? :? ResetContent
          ?? 206? :? PartialContent
          ?? 300? :? MultipleChoices
          ?? 301? :? MovedPermanently
          ?? 302? :? Found
          ?? 303? :? SeeOther
          ?? 304? :? NotModified
          ?? 305? :? UseProxy
          ?? 307? :? TemporaryRedirect
          ?? 400? :? BadRequest
          ?? 401? :? Unauthorized
          ?? 402? :? PaymentRequired
          ?? 403? :? Forbidden
          ?? 404? :? NotFound
          ?? 405? :? MethodNotAllowed
          ?? 406? :? NotAcceptable
          ?? 407? :? ProxyAuthenticationRequired
          ?? 408? :? RequestTime-out
          ?? 409? :? Conflict
          ?? 410? :? Gone
          ?? 411? :? LengthRequired
          ?? 412? :? PreconditionFailed
          ?? 413? :? RequestEntityTooLarge
          ?? 414? :? Request-URITooLarge
          ?? 415? :? UnsupportedMediaType
          ?? 416? :? Requestedrangenotsatisfiable
          ?? 417? :? ExpectationFailed
          ?? 500? :? InternalServerError
          ?? 501? :? NotImplemented
          ?? 502? :? BadGateway
          ?? 503? :? ServiceUnavailable
          ?? 504? :? GatewayTime-out
          ?? 505? :? HTTPVersionnotsupported

          三.HTTP消息頭:
          1. 普通
          2. 請求頭
          3. 響應頭
          4. 實體頭

          格式:(名字大小寫無關)
          <名字>:<空格><值>

          1.普通頭
          ? .Cache-Control? (HTTP1.1,? HTTP1.0:Pragma)
          ????? 緩存指令:
          ????? 請求時: no-cache,no-store,max-age,max-stale,min-fresh,only-if-cached
          ????? 響應時: public,private,no-cache,no-store,no-transform,must-revalidate,proxy-revalidate,max-age,s-maxage.
          ????? 例: Cache-Control: no-cache
          ? .Date
          ????? 客戶端:在發送正文時要包含Date,
          ????? 服務器:在響應時包含Date.
          ? .Connection
          ? .Pragma(1.0用)

          2. 請求頭
          ? .Accept
          ? .Accept-Charset
          ? .Accept-Encoding
          ? .Accept-Language
          ? .Authorization
          ? .Host(必須的)
          ? .User-agent

          3.響應頭
          ? .Location
          ? .Server
          ? .WWW-Authenticate,要包含在401中.

          4.實體頭
          ? .Content-Encoding
          ? .Content-Language
          ? .Content-Length
          ? .Content-Type
          ? .Last-Modified
          ? .Expires

          ?

          posted @ 2006-09-28 15:53 2195113 閱讀(245) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 宁明县| 鹤山市| 驻马店市| 靖州| 藁城市| 米脂县| 连州市| 兰考县| 峨边| 安图县| 荥阳市| 榕江县| 左贡县| 昌江| 垦利县| 宜黄县| 湘潭市| 榕江县| 景宁| 加查县| 天等县| 峡江县| 洪泽县| 河津市| 日土县| 安远县| 德清县| 刚察县| 建始县| 晋中市| 开江县| 容城县| 德江县| 承德市| 田林县| 互助| 石楼县| 肇东市| 宜兴市| 北碚区| 体育|