PUT请求中的100-continue是什么意思? [英] what does 100-continue mean in the PUT request?

查看:222
本文介绍了PUT请求中的100-continue是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了Expect:在某些PUT请求(上传文件)中继续执行100次,这是什么意思?

I saw Expect: 100-continue in some PUT request(uploading a file), what does it mean?

推荐答案

应该发生的事情是,您应该发送带有以下内容的请求标头:

What is supposed to happen, is you're supposed to send the request headers with an:

Expect: 100-continue

标题.然后,在发送标头之后,但在发送有效负载之前,应检查是否收到100响应或417响应.如果收到100响应,则可以继续发送有效负载.如果不这样做,就应该停止.

header. Then, after you have sent the headers, but before you send the payload, you should check to see if you get the 100 response, or a 417 response. If you get the 100 response, you can continue sending the payload. If you don't, you should stop.

前提是,当您准备发送10GB文件时,这使服务器有机会说"Hold on,cowboy",然后您可以比服务器简单地关闭套接字关闭更优雅地处理该过程.在你身上.

The premise is that when you're getting ready to send that 10GB file, this gives the server an opportunity to say "Hold on, cowboy" and then you can handle the process more elegantly than the server simply slamming the socket shut on you.

您得到了100的回报,而您并不期望这一事实,这说明您可能同时获得了100和200(或其他)的响应.发送标头后,将发送100给您,然后是请求完成时的最终响应.

The fact that you got a 100 back, and you weren't expecting it, says you probably got both the 100 and the 200 (or whatever) response. The 100 was sent to you after the headers were sent, then the final response when the request was finished.

您没有注意它确实是一个细节.

That you weren't paying attention to it is really a detail.

但是,理想情况下,将来您的处理可以考虑适当的中间请求响应.

But, ideally, in the future your processing can consider the proper mid-request response.

如果您没有发送Expect头,则服务器不应该向您发送100,因为您没有告诉它要处理它.如果您DID发送了Expect标头,那么100应该就不足为奇了.

If you did NOT send the Expect header, the server should not have sent you the 100, since you weren't telling it that you were going to process it. If you DID send the Expect header, then the 100 should not have come as a surprise.

这篇关于PUT请求中的100-continue是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆