Php 谷歌文档列表API 308简历不完整

Php 谷歌文档列表API 308简历不完整,php,rest,google-api,Php,Rest,Google Api,我正在使用Google文档列表API上传一个文件和元数据 只要文件小于512KB,我就可以让它正常工作。512KB之后,我必须以512KB的块发送它。在每个区块之后,我都会收到一个返回的HTTP状态码308,这是正确的 然而,在我发送了最后一个请求之后,我仍然得到308响应,而不是我期望的201响应。下面是发送和接收的HTTP头。也许其他人能看到我错过了什么 POST /feeds/upload/create-session/default/private/full HTTP/1.1 Host:

我正在使用Google文档列表API上传一个文件和元数据

只要文件小于512KB,我就可以让它正常工作。512KB之后,我必须以512KB的块发送它。在每个区块之后,我都会收到一个返回的HTTP状态码308,这是正确的

然而,在我发送了最后一个请求之后,我仍然得到308响应,而不是我期望的201响应。下面是发送和接收的HTTP头。也许其他人能看到我错过了什么

POST /feeds/upload/create-session/default/private/full HTTP/1.1
Host: docs.google.com
Accept: */*
Content-Type: application/atom+xml
Authorization: Bearer <CODE>
GData-Version: 3.0
Content-Type: application/atom+xml
X-Upload-Content-Length: 1436480
X-Upload-Content-Type: text/csv
Content-Length: 302

HTTP/1.1 200 OK
Server: HTTP Upload Server Built on Sep 5 2012 17:14:59 (1346890499)
Location: https://docs.google.com/feeds/upload/create-session/default/private/full?upload_id=<ID>
Date: Fri, 14 Sep 2012 17:34:50 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 0
Content-Type: text/html; charset=UTF-8

PUT /feeds/upload/create-session/default/private/full?upload_id=<ID> HTTP/1.1
Host: docs.google.com
Accept: */*
Authorization: Bearer <CODE>
GData-Version: 3.0
Content-Type: text/csv
Content-Range: bytes 0-524288/1436480
Content-Length: 524288
Expect: 100-continue

HTTP/1.1 308 Resume Incomplete
Server: HTTP Upload Server Built on Sep 5 2012 17:14:59 (1346890499)
Range: bytes=0-524287
X-Range-MD5: 8f470cff00adda7c22b8b34287d2cc1b
Date: Fri, 14 Sep 2012 17:34:52 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 0
Content-Type: text/html; charset=UTF-8

PUT /feeds/upload/create-session/default/private/full?upload_id=<ID> HTTP/1.1
Host: docs.google.com
Accept: */*
Authorization: Bearer <CODE>
GData-Version: 3.0
Content-Type: text/csv
Content-Range: bytes 524288-1048576/1436480
Content-Length: 524288
Expect: 100-continue

HTTP/1.1 308 Resume Incomplete
Server: HTTP Upload Server Built on Sep 5 2012 17:14:59 (1346890499)
Range: bytes=0-1048575
X-Range-MD5: 4af215a3ff92258bb1c8d05dc52cf77d
Date: Fri, 14 Sep 2012 17:34:54 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 0
Content-Type: text/html; charset=UTF-8

PUT /feeds/upload/create-session/default/private/full?upload_id=<ID> HTTP/1.1
Host: docs.google.com
Accept: */*
Authorization: Bearer <CODE>
GData-Version: 3.0
Content-Type: text/csv
Content-Length: 387904
Expect: 100-continue

HTTP/1.1 308 Resume Incomplete
Server: HTTP Upload Server Built on Sep 5 2012 17:14:59 (1346890499)
Range: bytes=0-1048575
X-Range-MD5: 4af215a3ff92258bb1c8d05dc52cf77d
Date: Fri, 14 Sep 2012 17:34:55 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 0
Content-Type: text/html; charset=UTF-8
编辑

如果我在最后一次PUT请求中发送内容范围,下面是最后的标题

PUT /feeds/upload/create-session/default/private/full?upload_id=<ID< HTTP/1.1
Host: docs.google.com
Accept: */*
Authorization: Bearer <CODE>
GData-Version: 3.0
Content-Type: text/csv
Content-Range: bytes 1048576-1436480/1436480
Content-Length: 387904
Expect: 100-continue

Got
HTTP/1.1 400 Bad Request
Server: HTTP Upload Server Built on Sep 5 2012 17:14:59 (1346890499)
Content-Type: text/html; charset=UTF-8
Date: Fri, 14 Sep 2012 19:12:06 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 15
Connection: close

您的上一个请求似乎没有发送
内容范围
。我认为这就是问题所在,但我不确定,因为我以前从未使用过这个API。我刚刚偏离了我在HTTP规范中知道的内容。

我在上一个请求中添加了内容范围,它导致了一个400错误。关于内容范围,您是正确的。400个错误与一个红色共享。