Vbscript ASP经典解析来自curl POST-F的数据
我有以下指向我的服务的CURL请求:Vbscript ASP经典解析来自curl POST-F的数据,vbscript,asp-classic,Vbscript,Asp Classic,我有以下指向我的服务的CURL请求: curl -X POST \ http://go.example.com/ \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -H 'Postman-Token: cf0c1ab5-08ff-1aa2-428e-24b855e1a61c' \ -H 'content-type: multipart/form-dat
curl -X POST \
http://go.example.com/ \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Postman-Token: cf0c1ab5-08ff-1aa2-428e-24b855e1a61c' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
-F fff=vvvvv \
-F rrrr=ddddd \
-F xx=something
我试图在经典的ASP代码中捕获xx参数。
我试过“Request”(“xx”)和“Request.Form”(“xx”)”
你知道吗?这是从
-F、 --形式
(HTTP SMTP IMAP)对于HTTP协议系列,这允许curl模拟用户按下提交按钮的填充表单这会导致curl根据RFC 2388使用内容类型multipart/form data发布数据
当使用内容类型为multipart/form data
的表单提交给Classic ASP时,唯一可用的方法是Request.BinaryRead()
asRequest.form
用于application/x-www-form-urlencoded
数据
下面是一个快速调用Request.BinaryRead()
开始的示例:
<%
'Should be less than configured request limit in IIS.
Const maxRequestSizeLimit = ...
Dim dataSize: dataSize = Request.TotalBytes
Dim formData
If dataSize < maxRequestSizeLimit Then
'Read bytes into a SafeArray
formData = Request.BinaryRead(dataSize)
'Once you have a SafeArray its up to you to process it.
...
Else
Response.Status = "413 PAYLOAD TOO LARGE"
Response.End
End If
%>
然后,您将使用以下命令在经典ASP中检索xx
参数:
<%
Dim xx: xx = Request.Form("xx")
%>
有用的链接
- (特别是
方法,它接受一个安全数组并解析二进制文件)BuildUpload()
-d
而不是-F
来避免这种情况,使用应用程序/x-www-form-urlencoded
而不是多部分/表单数据
来发布数据,这将允许您使用请求.form
来检索值。事实上,我并不总是发送方。无论如何,似乎发送方已经改变了POST格式,现在它可以正常工作了。