- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我按照官方 Vimeo 上传文档的步骤进行操作:Resumable HTTP PUT Uploads
但在最后一步,删除上传链接,我总是收到 HTTP 500“无效状态”响应,使所有过程无效。
我什么都试过了都没有成功!
Related questions:
为了上传视频,我改编了vimeo-networking-java API。
以上主要变化:
在 VimeoService.java 中
@Multipart
@Headers("Content-Type: video/mp4")
@PUT
Call<Object> UPLOAD(@Header("Authorization") String authHeader,
@Url String uri,
@Header("Content-Length") String contentLenght,
@Part("file") RequestBody body);
@PUT
Call<Object> CHECK_UPLOAD(@Header("Authorization") String authHeader,
@Url String uri,
@Header("Content-Length") String contentLenght,
@Header("Content-Range") String contentRange);
在 VimeoClient.java 中
@Nullable
public Call<Object> upload(String uri, long contentLenght, byte[] body, VimeoCallback<Object> callback) {
if (callback == null) {
throw new AssertionError("Callback cannot be null");
}
if (uri == null) {
callback.failure(new VimeoError("uri cannot be empty!"));
return null;
}
MediaType MEDIA_TYPE = MediaType.parse("video/mp4");
RequestBody requestBody = RequestBody.create(MEDIA_TYPE, body);
Call<Object> call = this.vimeoService.UPLOAD(
getAuthHeader(),
uri,
Long.toString(contentLenght),
requestBody);
callback.setCall(call);
call.enqueue(callback);
return call;
}
@Nullable
public Call<Object> checkUpload(String uri, VimeoCallback<Object> callback) {
if (callback == null) {
throw new AssertionError("Callback cannot be null");
}
if (uri == null) {
callback.failure(new VimeoError("uri cannot be empty!"));
return null;
}
Call<Object> call = this.vimeoService.CHECK_UPLOAD(getAuthHeader(), uri, Long.toString(0), "bytes */*");
callback.setCall(call);
call.enqueue(callback);
return call;
}
完整的流程日志(请求和响应)
1) 获取上传票
--------- REQUEST ---------
METHOD: POST
ENDPOINT: https://api.vimeo.com/me/videos
--------- REQUEST HEADERS ---------
AUTHORIZATION: Bearer b750c6967df2a9ac068d5277f0985b5a
--------- REQUEST HEADERS END ---------
QUERY: null
--------- REQUEST BODY ---------
{
"type": "streaming"
}
--------- REQUEST BODY END ---------
--------- REQUEST END ---------
--------- RESPONSE ---------
ENDPOINT: https://api.vimeo.com/me/videos
STATUS CODE: 201
REQUEST TIME: 11307,4ms
--------- RESPONSE HEADERS ---------
ACCEPT-RANGES: bytes
CACHE-CONTROL: public
CONNECTION: keep-alive
CONTENT-TYPE: application/vnd.vimeo.uploadticket+json
DATE: Fri, 05 Aug 2016 02:12:20 GMT
EXPIRES: Mon, 03 Aug 2026 02:12:08 GMT
FASTLY-DEBUG-DIGEST: 671da88c3ec81bbd101a0bb851a90184165c1f4f3599229b0eb782c555e41ae7
OKHTTP-RECEIVED-MILLIS: 1470363157021
OKHTTP-SENT-MILLIS: 1470363145728
SERVER: nginx
STRICT-TRANSPORT-SECURITY: max-age=15120000; includeSubDomains; preload
VARY: Accept,Vimeo-Client-Id,Accept-Encoding
VIA: 1.1 varnish
X-CACHE: MISS, MISS
X-CACHE-HITS: 0, 0
X-RATELIMIT-LIMIT: 100
X-RATELIMIT-REMAINING: 98
X-RATELIMIT-RESET: 2016-08-05T02:27:09+00:00
X-SERVED-BY: cache-iad2125-IAD, cache-gru7124-GRU
X-TIMER: S1470363128.926327,VS0,VE11196
--------- RESPONSE HEADERS END ---------
--------- RESPONSE BODY ---------
{
"uri": "/users/user54333244/tickets/6d81c45bef8c85b20ab4ffe268c871f7",
"ticket_id": "6d81c45bef8c85b20ab4ffe268c871f7",
"user": {...},
"upload_link": "http://1511923119.cloud.vimeo.com/upload?ticket_id\u003d6d81c45bef8c85b20ab4ffe268c871f7\u0026video_file_id\u003d577958619\u0026signature\u003d662f6286a14464c6347648e0ce642523\u0026v6\u003d1",
"upload_link_secure": "https://1511923119.cloud.vimeo.com/upload?ticket_id\u003d6d81c45bef8c85b20ab4ffe268c871f7\u0026video_file_id\u003d577958619\u0026signature\u003d662f6286a14464c6347648e0ce642523\u0026v6\u003d1",
"complete_uri": "/users/54333244/tickets/6d81c45bef8c85b20ab4ffe268c871f7?video_file_id\u003d577958619\u0026upgrade\u003dtrue\u0026signature\u003d662f6286a14464c6347648e0ce642523"
}
--------- RESPONSE BODY END ---------
--------- RESPONSE END ---------
2) 发出上传请求
--------- REQUEST ---------
METHOD: PUT
ENDPOINT: https://1511923119.cloud.vimeo.com/upload?ticket_id=6d81c45bef8c85b20ab4ffe268c871f7&video_file_id=577958619&signature=662f6286a14464c6347648e0ce642523&v6=1
--------- REQUEST HEADERS ---------
AUTHORIZATION: Bearer b750c6967df2a9ac068d5277f0985b5a
CONTENT-LENGTH: 2061435
--------- REQUEST HEADERS END ---------
QUERY: ticket_id=6d81c45bef8c85b20ab4ffe268c871f7&video_file_id=577958619&signature=662f6286a14464c6347648e0ce642523&v6=1
--------- REQUEST BODY ---------
Request body is to large to print
--------- REQUEST BODY END ---------
--------- REQUEST END ---------
3) 验证上传 - 第一次 - 不完整 (1202177/2061435)
--------- REQUEST ---------
METHOD: PUT
ENDPOINT: https://1511923119.cloud.vimeo.com/upload?ticket_id=6d81c45bef8c85b20ab4ffe268c871f7&video_file_id=577958619&signature=662f6286a14464c6347648e0ce642523&v6=1
--------- REQUEST HEADERS ---------
AUTHORIZATION: Bearer b750c6967df2a9ac068d5277f0985b5a
CONTENT-LENGTH: 0
CONTENT-RANGE: bytes */*
--------- REQUEST HEADERS END ---------
QUERY: ticket_id=6d81c45bef8c85b20ab4ffe268c871f7&video_file_id=577958619&signature=662f6286a14464c6347648e0ce642523&v6=1
--------- REQUEST BODY ---------
--------- REQUEST BODY END ---------
--------- REQUEST END ---------
--------- RESPONSE ---------
ENDPOINT: https://1511923119.cloud.vimeo.com/upload?ticket_id=6d81c45bef8c85b20ab4ffe268c871f7&video_file_id=577958619&signature=662f6286a14464c6347648e0ce642523&v6=1
STATUS CODE: 308
REQUEST TIME: 2292,3ms
--------- RESPONSE HEADERS ---------
ACCESS-CONTROL-ALLOW-HEADERS: Content-Type, Content-Range, X-Requested-With
ACCESS-CONTROL-ALLOW-METHODS: POST, PUT, GET, OPTIONS
ACCESS-CONTROL-ALLOW-ORIGIN: *
ACCESS-CONTROL-EXPOSE-HEADERS: Range
CACHE-CONTROL: public
CONNECTION: close
CONTENT-LENGTH: 0
CONTENT-TYPE: text/plain
DATE: Fri, 05 Aug 2016 02:10:45 GMT
OKHTTP-RECEIVED-MILLIS: 1470363169855
OKHTTP-SENT-MILLIS: 1470363168232
RANGE: bytes=0-1202177 <<========================================
SERVER: Vimeo/1.0
TIMING-ALLOW-ORIGIN: *
X-BACKEND-SERVER: kopiluwak
X-REQUESTED-WITH: XMLHttpRequest
--------- RESPONSE HEADERS END ---------
--------- RESPONSE BODY ---------
--------- RESPONSE BODY END ---------
--------- RESPONSE END ---------
4) 收到上传响应(成功)
--------- RESPONSE ---------
ENDPOINT: https://1511923119.cloud.vimeo.com/upload?ticket_id=6d81c45bef8c85b20ab4ffe268c871f7&video_file_id=577958619&signature=662f6286a14464c6347648e0ce642523&v6=1
STATUS CODE: 200
REQUEST TIME: 5550,2ms
--------- RESPONSE HEADERS ---------
ACCESS-CONTROL-ALLOW-HEADERS: Content-Type, Content-Range, X-Requested-With
ACCESS-CONTROL-ALLOW-METHODS: POST, PUT, GET, OPTIONS
ACCESS-CONTROL-ALLOW-ORIGIN: *
ACCESS-CONTROL-EXPOSE-HEADERS: Range
CACHE-CONTROL: public
CONNECTION: close
CONTENT-LENGTH: 0
CONTENT-TYPE: text/plain
DATE: Fri, 05 Aug 2016 02:10:47 GMT
OKHTTP-RECEIVED-MILLIS: 1470363171089
OKHTTP-SENT-MILLIS: 1470363166094
SERVER: Vimeo/1.0
TIMING-ALLOW-ORIGIN: *
X-BACKEND-SERVER: kopiluwak
X-REQUESTED-WITH: XMLHttpRequest
--------- RESPONSE HEADERS END ---------
--------- RESPONSE BODY ---------
--------- RESPONSE BODY END ---------
--------- RESPONSE END ---------
5) 验证上传 - 第二次 - 已完成 (2061651/2061651)
--------- REQUEST ---------
METHOD: PUT
ENDPOINT: https://1511923119.cloud.vimeo.com/upload?ticket_id=6d81c45bef8c85b20ab4ffe268c871f7&video_file_id=577958619&signature=662f6286a14464c6347648e0ce642523&v6=1
--------- REQUEST HEADERS ---------
AUTHORIZATION: Bearer b750c6967df2a9ac068d5277f0985b5a
CONTENT-LENGTH: 0
CONTENT-RANGE: bytes */*
--------- REQUEST HEADERS END ---------
QUERY: ticket_id=6d81c45bef8c85b20ab4ffe268c871f7&video_file_id=577958619&signature=662f6286a14464c6347648e0ce642523&v6=1
--------- REQUEST BODY ---------
--------- REQUEST BODY END ---------
--------- REQUEST END ---------
--------- RESPONSE ---------
ENDPOINT: https://1511923119.cloud.vimeo.com/upload?ticket_id=6d81c45bef8c85b20ab4ffe268c871f7&video_file_id=577958619&signature=662f6286a14464c6347648e0ce642523&v6=1
STATUS CODE: 308
REQUEST TIME: 185,4ms
--------- RESPONSE HEADERS ---------
ACCESS-CONTROL-ALLOW-HEADERS: Content-Type, Content-Range, X-Requested-With
ACCESS-CONTROL-ALLOW-METHODS: POST, PUT, GET, OPTIONS
ACCESS-CONTROL-ALLOW-ORIGIN: *
ACCESS-CONTROL-EXPOSE-HEADERS: Range
CACHE-CONTROL: public
CONNECTION: close
CONTENT-LENGTH: 0
CONTENT-TYPE: text/plain
DATE: Fri, 05 Aug 2016 02:10:48 GMT
OKHTTP-RECEIVED-MILLIS: 1470363172083
OKHTTP-SENT-MILLIS: 1470363171995
RANGE: bytes=0-2061651 <<========================================
SERVER: Vimeo/1.0
TIMING-ALLOW-ORIGIN: *
X-BACKEND-SERVER: kopiluwak
X-REQUESTED-WITH: XMLHttpRequest
--------- RESPONSE HEADERS END ---------
--------- RESPONSE BODY ---------
--------- RESPONSE BODY END ---------
--------- RESPONSE END ---------
6) 尝试调用 de DELETE - 发生“无效状态”错误。
--------- REQUEST ---------
METHOD: DELETE
ENDPOINT: https://api.vimeo.com/users/54333244/tickets/6d81c45bef8c85b20ab4ffe268c871f7?video_file_id=577958619&upgrade=true&signature=662f6286a14464c6347648e0ce642523
--------- REQUEST HEADERS ---------
AUTHORIZATION: Bearer b750c6967df2a9ac068d5277f0985b5a
--------- REQUEST HEADERS END ---------
--------- REQUEST END ---------
--------- RESPONSE ---------
ENDPOINT: https://api.vimeo.com/users/54333244/tickets/6d81c45bef8c85b20ab4ffe268c871f7?video_file_id=577958619&upgrade=true&signature=662f6286a14464c6347648e0ce642523
STATUS CODE: 500
REQUEST TIME: 4959,4ms
--------- RESPONSE HEADERS ---------
ACCEPT-RANGES: bytes
CACHE-CONTROL: public
CONNECTION: keep-alive
CONTENT-TYPE: application/vnd.vimeo.error+json
DATE: Fri, 05 Aug 2016 02:12:40 GMT
EXPIRES: Mon, 03 Aug 2026 02:12:35 GMT
FASTLY-DEBUG-DIGEST: 8ed132ece40c90a7e97e1901d8ab96bbe5eef838cc09da5736ea3b2f25dda430
OKHTTP-RECEIVED-MILLIS: 1470363177088
OKHTTP-SENT-MILLIS: 1470363172147
SERVER: nginx
STRICT-TRANSPORT-SECURITY: max-age=15120000; includeSubDomains; preload
VARY: Accept,Vimeo-Client-Id,Accept-Encoding
VIA: 1.1 varnish
X-CACHE: MISS, MISS
X-CACHE-HITS: 0, 0
X-RATELIMIT-LIMIT: 250
X-RATELIMIT-REMAINING: 244
X-RATELIMIT-RESET: 2016-08-05T02:27:35+00:00
X-SERVED-BY: cache-iad2134-IAD, cache-gru7124-GRU
X-TIMER: S1470363155.338298,VS0,VE4824
--------- RESPONSE HEADERS END ---------
--------- RESPONSE BODY ---------
{
"error": "Invalid state" <<========================================
}
--------- RESPONSE BODY END ---------
--------- RESPONSE END ---------
最佳答案
基于 this comment ,我解决了将上传 Retrofit 方法更改为不使用 Multipart 的问题!
至此Vimeo上传完成,最后删除上传票成功!
旧的:
@Multipart
@Headers("Content-Type: video/mp4")
@PUT
Call<Object> UPLOAD(@Header("Authorization") String authHeader,
@Url String uri,
@Header("Content-Length") String contentLenght,
@Part("file") RequestBody body);
新的:
@Headers("Content-Type: video/mp4")
@PUT
Call<Object> UPLOAD(@Header("Authorization") String authHeader,
@Url String uri,
@Header("Content-Length") String contentLenght,
@Body RequestBody body);
关于android - Vimeo 上传 API - 尝试删除票证时出现 "Invalid state"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38780268/
我正在尝试向 iOS 应用商店提交更新。我要从 Buzztouch 应用程序转到 Sprite Kit 应用程序。我能够存档 Xcode 项目并提交它。该应用程序的状态为“上传已收到”,但大约一分钟后
我收到了这个奇怪的警告。我不确定是什么原因造成的。 .dia文件扩展名应该表示核心有向图图形文件。我没有添加,应用程序几乎没有用户界面。 最佳答案 我对这个答案并不满意,但我认为它可以帮助人们,直到找
下面用作 Uri 参数的程序集限定字符串在 XAML 中工作,但在代码中使用时会出现错误。 我尝试了各种 UriKind,结果都相同。我该如何解决这个问题? [Test] public void La
我正在开发一个 Angular 应用程序,目的是将其部署到移动设备和 Web 浏览器上。设置表单样式以显示无效输入时,我应该定位 Angular“ng-invalid”类还是 HTML5“:inval
我有一个在 Google App Engine 上运行的应用程序,它是 Android 应用程序的后端。它基本上是 Android 应用程序和在我自己的服务器上运行的 MySQL 数据库之间的桥梁。
我的代码是这样的: func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle,
I need to encrypt using Python with the A256GCM algorithm, and getting back a JWT that I need to
无法成功编译webpack并生成bundle.js文件。据我了解,我的 src_dir 和 dist_dir 变量能够指向正确的路径,但在尝试编译时我仍然始终收到两个错误之一。 配置对象无效。 Web
因此,当我在 postgres 上运行 regexp_matches 时收到一条错误消息,并且无法弄清楚如何通过它。它似乎在 regex101 等 reg_exp 测试站点上运行良好,但不幸的是在实际
这些是我正在使用的导入: import com.novell.ldap.*; import java.io.UnsupportedEncodingException; 我正在尝试进行一个非常简单的密码
在记录器函数的简写情况下,Pylint 提示 Invalid constant name "myprint"(invalid-name)。 # import from utils import get
我试图创建一个HTML输入标签,该标签仅接受以2种格式之一输入的数字,并拒绝所有其他输入。 我只想接受以下格式的数字,包括破折号: 1234-12 和 1234-12-12 注意:不是日期,而是合法的
我一直在尝试使用 Bootstrap 的表单样式处理 AngularJS 的电子邮件验证,并遇到了这个 CSS block 。 input:focus:required:invalid, textar
我正在编写一个程序,以确保我了解如何在 C 中正确实现单向链表。我目前正在哈佛的 CS50 类(class)中学习,并且使用本教程,因为 CS50 人员不解释链接详细列出数据结构:https://ww
此问题与询问同一消息的另一个问题不重复,但在另一个上下文中。这个问题的上下文只是关于上传截图图像和获取消息。 今天,我在将图片上传到 App Store Connect 时收到一条新消息: Inval
我的代码似乎运行良好,但当我滑动以删除 UITableView 中的一行时,应用程序崩溃并显示以下内容: 错误 LittleToDoApp[70390:4116002] *** Terminating
当我尝试发送语音消息时,总是收到无效的url错误。我正在使用Whisper将音频转换为文本,但由于某种原因,我似乎无法将文件传递给Whisper。当我在Java脚本中使用它而不是在TypeScrip中
我正在尝试在 flutter 上对 http 客户端进行单元测试。在模拟 http 和我的存储库类之后: void main() { MockHttpCLient mockHttpCLient;
我正在使用 pandoc 作为一个库,相关的代码片段是: module Lib ( latexDirToTex, latexToTxt ) where import qualified
我正在开发一个(相对简单的)Rails应用程序。我正在使用Devise gem处理用户 session 。每当我导航到localhost:3000/users/sign_in时,我都会看到Devise
我是一名优秀的程序员,十分优秀!