确定此 UnityWebRequest 是否将在其传出请求的标头中包含 Expect: 100-Continue
。(默认值:true
)。
如果此属性设置为 true
,则此 UnityWebRequest 将在初始出站请求中包含一个 Expect: 100-Continue
标头。如果设置为 false
,则会发送空的 Expect
标头,这将禁用 100 Continue
响应代码。
As detailed in RFC 2616, Section 8, the 100 Continue
response code is intended to allow a remote server to decide whether or not it will accept a request based on a request's headers, prior to the client transmitting the full request body.
在客户端无需将其整个请求传输到请求/响应链中的每个服务器的情况下(如负载均衡的应用程序中),这很有用。例如,客户端会将其带有 Expect: 100-Continue
标头的请求呈现给负载均衡的服务器。然后,该负载均衡的服务器将以重定向到处理服务器来响应。接下来,客户端将连接到该处理服务器,并传输相同的请求,同样带有 Expect: 100-Continue
标头。处理服务器随后会以 100 Continue
HTTP 状态代码来响应,最后,客户端会以请求整体来响应。
通过使用 100 Continue
状态代码,客户端只需将其请求整体传输到一个服务器。如果未使用 100 Continue
状态代码,客户端则必须将其请求整体传输到与之通信的每个服务器,在客户端和发出重定向的任何服务器上占用不必要的带宽和处理时间。
一般情况下,应将 100 Continue
保持启用状态。例外情况包括,当请求主体极小甚至没有请求主体时,或在应用程序中,客户端知道服务器不会发出重定向。
此属性默认为 true
。
**注意:**在 WebGL 构建目标中,由主机浏览器执行标头协商。因此,此设置的值对 WebGL 构建没有影响。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.