[英]how to set “Date” header for http request
I want to set the header for http request. 我想为http请求设置标题。 The header name is "Date" 标头名称为“日期”
http_request.setRequestHeader("Date", headers.date);
But, when I see the request going out in firebug. 但是,当我看到请求在萤火虫中发出时。 I do not see the request header Date. 我没有看到请求标头日期。
How do I set that? 我该如何设置?
From a XMLHttpRequest, there are a set of headers that cannot be set. 在XMLHttpRequest中,存在一组无法设置的标头。 Take a look at the spec for setRequestHeader() . 看一下setRequestHeader()的规范。 Date
is one of these headers. Date
是这些标题之一。
Also, if you look at the WebKit source code , you can see this in implementation. 另外,如果您查看WebKit源代码 ,则可以在实现中看到这一点。
bool XMLHttpRequest::isAllowedHTTPHeader(const String& name)
{
initializeXMLHttpRequestStaticData();
return !staticData->m_forbiddenRequestHeaders.contains(name)
&& !name.startsWith(staticData->m_proxyHeaderPrefix, false)
&& !name.startsWith(staticData->m_secHeaderPrefix, false);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.