是否有任何http标题或某些东西阻止页面保存在浏览器历史记录中?
事实:我不打算用:
谢谢.
如何检查请求中是否存在Accept-Language标头?
我试过这个,但它产生了一个错误
<cfset requestData = GetHttpRequestData() >
<cfif IsDefined("requestData.Headers['Accept-Language']")>
...
Run Code Online (Sandbox Code Playgroud)
对不起,可能是蹩脚的问题.那是我的ColdFusion编码的第一天.
我只是阅读Paypal的API文档,例如Adaptive Accounts API
我的问题:使用(自定义?)HTTP请求标头进行身份验证而不是"普通"POST/GET(甚至是COOKIE)变量的原因/优势是什么?
在上面提到的示例中,PayPal使用以下HTTP请求标头:
X-PAYPAL-SECURITY-USERID
X-PAYPAL-SECURITY-PASSWORD
X-PAYPAL-SECURITY-SIGNATURE
X-PAYPAL-APPLICATION-ID
X-PAYPAL-DEVICE-IPADDRESS
X-PAYPAL-REQUEST-DATA-FORMAT
Run Code Online (Sandbox Code Playgroud) 我们在ASP.NET服务器上提供文件时遇到了一个奇怪的问题.
如果用户单击链接,我们希望有一个文件下载对话框.没有针对WMV的WMP开放,没有针对PDF的Adobe开放,等等.
为了强制这个,我们使用以下HTTP处理程序来跳转WMV,PDF等.
public void ProcessRequest(HttpContext context)
{
// don't allow caching
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
context.Response.Cache.SetNoStore();
context.Response.Cache.SetExpires(DateTime.MinValue);
string contentDisposition = string.Format("attachment; filename=\"{0}\"", Path.GetFileName(context.Request.PhysicalPath));
string contentLength;
using (FileStream fileStream = File.OpenRead(context.Request.PhysicalPath))
{
contentLength = fileStream.Length.ToString(CultureInfo.InvariantCulture);
}
context.Response.ContentType = "application/octet-stream";
context.Response.AddHeader("Content-Disposition", contentDisposition);
context.Response.AddHeader("Content-Length", contentLength);
context.Response.AddHeader("Content-Description", "File Transfer");
context.Response.AddHeader("Content-Transfer-Encoding", "binary");
context.Response.TransmitFile(context.Request.PhysicalPath);
}
Run Code Online (Sandbox Code Playgroud)
用小提琴嗅闻,这些是发送的实际标题:
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Pragma: no-cache
Content-Length: 8661299
Content-Type: application/octet-stream
Expires: -1
Server: Microsoft-IIS/7.5
Content-Disposition: attachment; filename="foo.wmv"
Content-Description: File Transfer
Content-Transfer-Encoding: binary
X-Powered-By: ASP.NET
Date: Wed, 04 Apr 2012 09:38:14 …Run Code Online (Sandbox Code Playgroud) 有没有一种直接的方法来使用Mechanize 2.3设置自定义标头?
我试过以前的解决方案,但得到:
$agent = Mechanize.new
$agent.pre_connect_hooks << lambda { |p|
p[:request]['Referer'] = 'https://wwws.mysite.com/cgi-bin/apps/Main'
}
# ./mech.rb:30:in `<main>': undefined method `pre_connect_hooks' for nil:NilClass (NoMethodError)
Run Code Online (Sandbox Code Playgroud) 我正在尝试构建一个手动滚动的HTTP请求,以便从我认为是一个相当简单的SOAP Web服务调用返回响应.但是,我无法正确构建请求,并且没有得到我期望的响应.
wsdl声明:wsdl目标命名空间:
targetNamespace="http://tempuri.org/"
Run Code Online (Sandbox Code Playgroud)
wsdl服务
<wsdl:service name="TrackerService">
<wsdl:port name="BasicHttpBinding_ITrackerService" binding="tns:BasicHttpBinding_ITrackerService">
<soap:address location="http://mydomain.com/TrackerServiceSite/wctest2.TrackerService.svc"/>
</wsdl:port>
</wsdl:service>
Run Code Online (Sandbox Code Playgroud)
wsdl消息
<wsdl:message name="ITrackerService_GetStub_InputMessage">
<wsdl:part name="parameters" element="tns:GetStub" />
</wsdl:message>
<wsdl:message name="ITrackerService_GetStub_OutputMessage">
<wsdl:part name="parameters" element="tns:GetStubResponse" />
</wsdl:message>
Run Code Online (Sandbox Code Playgroud)
wsdl绑定和SOAP操作
<wsdl:binding name="BasicHttpBinding_ITrackerService" type="tns:ITrackerService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
.
. <!—- Omitted for brevity -->
.
<wsdl:operation name="GetStub">
<soap:operation soapAction="http://tempuri.org/ITrackerService/GetStub" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
Run Code Online (Sandbox Code Playgroud)
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header />
<s:Body>
<GetStubResponse xmlns="http://tempuri.org/">
<GetStubResult xmlns:a=http://schemas.datacontract.org/2004/07/wctest2 xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:Password>SOMEPASS</a:Password>
<a:Username>SOMEUSER</a:Username>
</GetStubResult>
</GetStubResponse>
</s:Body>
</s:Envelope>
Run Code Online (Sandbox Code Playgroud)
POST …Run Code Online (Sandbox Code Playgroud) 为了解决SSL终止负载均衡器的问题(它不会将客户端证书转发给应用服务器),我们的ISP已经配置了我们的环境,使得客户端证书在HTTP报头中转发到真实服务器(如X- CLIENT-CERT).
我将使用映射到他们已经签发的证书的序列号的PIN来验证客户端.但是如何从自定义标头获取证书?
例如:
<iframe src="http://otherdomainidontcontrol.com/blah.csv"></iframe>
Run Code Online (Sandbox Code Playgroud)
并且blah.csv有这个标题:
Content-Disposition: attachment; filename=blah.csv;
Run Code Online (Sandbox Code Playgroud)
是否可以强制blah.csv在iframe中呈现而不是下载?
对于不是由HTML表单发送的请求,HTTP是否将请求的Content-Type限制为application/x-www-form-urlencoded以用于非文件上载,或者是MIME类型"right"/标准/语义在任何其他方面有意义办法?
例如,PHP会自动将内容解析为$ _POST,这似乎表明服务器需要x-www-form-urlencoded.另一方面,我可以使用Ajax在HTTP请求内容中发送JSON对象,并将Content-Type设置为application/json.至少一些服务器技术(例如WSGI)不会尝试解析它,而是以原始形式向脚本提供它.
我应该在RESTful API中的POST和PUT请求中使用什么MIME类型来确保符合HTTP的所有服务器实现?我忽略了SOAP和JSON-RPC等技术,因为它们通过HTTP隧道传输协议而不是按预期使用HTTP.
http-headers ×10
http ×3
amazon-s3 ×1
asp.net ×1
browser ×1
c# ×1
coldfusion ×1
coldfusion-7 ×1
header ×1
http-referer ×1
http-request ×1
mechanize ×1
paypal ×1
post ×1
put ×1
ruby ×1
security ×1
soap ×1
wsdl ×1