我正在为CalDAV服务器开发日历客户端。我的应用程序可以使用Google CalDAV。我试图从雅虎日历中获取日历。导致错误请求错误的请求有什么问题?
获取选项请求:
OPTIONS https://caldav.calendar.yahoo.com/dav/aliasgarikh/Calendar/testcalendar HTTP/1.1
Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Host: caldav.calendar.yahoo.com
Content-Length: 0
Connection: Keep-Alive
获取选项回复:
HTTP/1.1 200 OK
Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sun, 05-Jun-2016 20:11:56 GMT
WSHost: tardis018.cal.bf1.yahoo.com
DAV: 1, 3, access-control, extended-mkcol, calendar-access
MS-Author-Via: DAV
Allow: MKCOL, REPORT, MOVE, COPY, HEAD, POST, GET, DELETE, MKCALENDAR, ACL, PROPFIND, OPTIONS, PROPPATCH, PUT
Content-Length: 0
Date: Mon, 06 Jun 2016 20:11:55 GMT
Server: ATS
Age: 1
Connection: keep-alive
Via: http/1.1 calgate116.cal.ne1.yahoo.com (ApacheTrafficServer)
获取日历请求:
PROPFIND https://caldav.calendar.yahoo.com/dav/aliasgarikh/Calendar/testcalendar HTTP/1.1
Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Depth: 0
Host: caldav.calendar.yahoo.com
Content-Type: text/xml
Content-Length: 103
<options xmlns="DAV:">
<calendar-collection-set xmlns="urn:ietf:params:xml:ns:caldav" />
</options>
获取日历回复:
HTTP/1.1 400 Bad Request
Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sun, 05-Jun-2016 20:11:57 GMT
WSHost: tardis041.cal.bf1.yahoo.com
Cache-Control: must-revalidate,no-cache,no-store
Content-Type: text/html;charset=utf-8
Content-Length: 3190
Vary: Accept-Encoding
Date: Mon, 06 Jun 2016 20:11:56 GMT
Server: ATS
Age: 2
Connection: keep-alive
Via: http/1.1 calgate116.cal.ne1.yahoo.com (ApacheTrafficServer)
<!doctype html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Yahoo! - Error report</title>
<style>
/* nn4 hide */ /*/*/
body {
font: small/ 1.2em arial, helvetica, clean, sans-serif;
font: x-small;
text-align: center;
}
table {
font-size: inherit;
font: x-small;
}
html>body {
font: 83%/ 1.2em arial, helvetica, clean, sans-serif;
}
input {
font-size: 100%;
vertical-align: middle;
}
p,form {
margin: 0;
padding: 0;
}
p {
padding-bottom: 6px;
margin-bottom: 10px;
}
#doc {
width: 48.5em;
margin: 0 auto;
border: 1px solid #fff;
text-align: center;
}
#ygma {
text-align: right;
margin-bottom: 53px
}
#ygma img {
float: left;
}
#ygma div {
border-bottom: 1px solid #ccc;
padding-bottom: 8px;
margin-left: 152px;
}
#bd {
clear: both;
text-align: left;
width: 75%;
margin: 0 auto 20px;
}
h1 {
font-size: 135%;
text-align: center;
margin: 0 0 15px;
}
legend {
display: none;
}
fieldset {
border: 0 solid #fff;
padding: .8em 0 .8em 4.5em;
}
form {
position: relative;
background: #eee;
margin-bottom: 15px;
border: 1px solid #ccc;
border-width: 1px 0;
}
#s1p {
width: 15em;
margin-right: .1em;
}
form span {
position: absolute;
left: 70%;
top: .8em;
}
form a {
font: 78%/ 1.2em arial;
display: block;
padding-left: .8em;
white-space: nowrap;
background: url(http://l.yimg.com/a/i/s/bullet.gif)
no-repeat left center;
}
form .sep {
display: none;
}
.more {
text-align: center;
}
#ft {
padding-top: 10px;
border-top: 1px solid #999;
}
#ft p {
text-align: center;
font: 78% arial;
}
/* end nn4 hide */
</style>
</head>
<body>
<div id="doc">
<div id="ygma">
<a href="http://www.yahoo.com">
<img src="http://l.yimg.com/a/i/yahoo.gif" width="147"
height="31" border="0" alt="Yahoo!">
</a>
<div>
<a href="http://www.yahoo.com">Yahoo!</a>
- <a href="http://help.yahoo.com">Help</a>
</div>
</div>
<div id="bd">
<h1>HTTP Status 400 - Error:400</h1>
<p>
<b>type</b>
Status report
</p>
<p>
<b>message</b>
<u>Error:400</u>
</p>
<p>
<b>description</b>
<u>The request sent by the client was syntactically incorrect.</u>
</p>
<p>
</p>
</div>
</div>
</body>
</html>
答案 0 :(得分:3)
您的PROPFIND
请求完全无效。 PROPFIND
请求的有效负载(假设有一个)必须具有DAV:propfind
根元素。有关检索calendar-home-set的有效请求,请参阅RFC 4791, section 8.4。
这与谷歌合作的唯一原因是因为他们的服务器似乎相当宽容并且返回某种默认响应(类似于当你不发送任何消息体时它会响应)。