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

查看:30
本文介绍了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

参数边界"似乎是随机的,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天全站免登陆