HTTP多部分(POST)请求中的边界参数是什么? [英] What is the boundary parameter in an HTTP multi-part (POST) Request?

查看:734
本文介绍了HTTP多部分(POST)请求中的边界参数是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发一个侧边栏小工具,可以自动检查网页以确定转移配额的演变过程。我差不多了,但还有最后一步我需要让它工作:将带有正确POST数据的HttpRequest发送到php页面。使用firefox插件,这里是标题的Content-Type:

I am trying to develop a sidebar gadget that automates the process of checking a web page for the evolution of my transfer quota. I am almost at it but there is one last step I need to get it working: Sending an HttpRequest with the correct POST data to a php page. Using a firefox plugin, here is what the "Content-Type" of the header looks like:

Content-Type=multipart/form-data; boundary=---------------------------99614912995

参数boundary似乎是随机的,POSTDATA是这样的:

with the parameter "boundary" seeming to be random, and the POSTDATA is this:

POSTDATA =-----------------------------99614912995
Content-Disposition: form-data; name="SOMENAME"

Formulaire de Quota
-----------------------------99614912995
Content-Disposition: form-data; name="OTHERNAME"

SOMEDATA
-----------------------------99614912995--

我不明白如何使用神秘的边界参数正确模拟POSTDATA。

I do not understand how to correctly emulate the POSTDATA with the mystery "boundary" parameter coming back.

有人知道如何解决这个问题吗?

Would someone know how I can solve this?

推荐答案

边界参数设置为多个连字符加上最后的随机字符串,但您可以将其设置为任何值一点都不问题是,如果边界字符串显示在请求数据中,它将被视为边界。

The boundary parameter is set to a number of hyphens plus a random string at the end, but you can set it to anything at all. The problem is, if the boundary string shows up in the request data, it will be treated as a boundary.

对于一些提示,以及发送multipart /的示例函数form-data参见我对这个问题的回答。修改该函数以便为要发送的每个部分使用循环不会太困难。

For some tips, and an example function for sending multipart/form-data see my answer to this question. It wouldn't be too difficult to modify that function to use a loop for each part you would like to send.

这篇关于HTTP多部分(POST)请求中的边界参数是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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