报文"/>
HTTP:DIGEST认证的请求和响应报文
以下是HTTP DIGEST认证的请求和响应报文的例子,供以后参考。
IE
----first request:
GET /boe/checkedServlet HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, */*
Accept-Language: zh-cn
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.30729)
Accept-Encoding: gzip, deflate
Host: 127.0.0.1:8000
Connection: Keep-Alive
----first response:
HTTP/1.1 401 Unauthorized
Server: Apache-Coyote/1.1
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 08:00:00 CST
WWW-Authenticate: Digest realm="MyUserRegistry", qop="auth", nonce="75aa99a687ee7f0257d74d18d79482a5", opaque="b5dbd577b5f27cbed5528cdd36fa013a"
Content-Type: text/html;charset=utf-8
Content-Length: 954
Date: Mon, 30 May 2011 12:01:31 GMT<html><head><title>Apache Tomcat/6.0.29 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 401 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>This request requires HTTP authentication ().</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.29</h3></body></html>HTTP/1.1 200 OK
/
----second request with userName=admin, password=1234:
GET /boe/checkedServlet HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, */*
Accept-Language: zh-cn
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.30729)
Accept-Encoding: gzip, deflate
Host: 127.0.0.1:8000
Connection: Keep-Alive
Authorization: Digest username="admin",realm="MyUserRegistry",nonce="75aa99a687ee7f0257d74d18d79482a5",uri="/boe/checkedServlet",cnonce="c7610c2c78d9d095cbe02ac569c5940a",nc=00000001,response="cc1ece8a10aae565a78140399c2fe706",qop="auth",opaque="b5dbd577b5f27cbed5528cdd36fa013a"
----second response:
Server: Apache-Coyote/1.1
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 08:00:00 CST
Content-Length: 0
Date: Mon, 30 May 2011 12:01:47 GMT
Firefox
----first request:
GET /boe/checkedServlet HTTP/1.1
Host: 127.0.0.1:8000
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; zh-CN; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
----first response:
HTTP/1.1 401 Unauthorized
Server: Apache-Coyote/1.1
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 08:00:00 CST
WWW-Authenticate: Digest realm="MyUserRegistry", qop="auth", nonce="41b7da876d83d2deddcf745916687dd6", opaque="695943daf44100c597fb82a1dde4cf48"
Content-Type: text/html;charset=utf-8
Content-Length: 954
Date: Mon, 30 May 2011 12:07:07 GMT<html><head><title>Apache Tomcat/6.0.29 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 401 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>This request requires HTTP authentication ().</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.29</h3></body></html>
/
----second request with userName=admin, password=1234:
GET /boe/checkedServlet HTTP/1.1
Host: 127.0.0.1:8000
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; zh-CN; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Authorization: Digest username="admin", realm="MyUserRegistry", nonce="41b7da876d83d2deddcf745916687dd6", uri="/boe/checkedServlet", response="833a4cb6b8f6b9ec418239df72e4aa54", opaque="695943daf44100c597fb82a1dde4cf48", qop=auth, nc=00000001, cnonce="082c875dcb2ca740"
----second response:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 08:00:00 CST
Content-Length: 0
Date: Mon, 30 May 2011 12:07:35 GMT
更多推荐
HTTP:DIGEST认证的请求和响应报文
发布评论