My Java Blog Park

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 on 2006-09-28 15:53 2195113 阅读(231) 评论(0)  编辑  收藏 所属分类: Base Knowledge


只有注册用户登录后才能发表评论。


网站导航: