小编jpk*_*pka的帖子

curl:来自 CLI 的每个文件附加标头(用于多部分 POST、SOAP 等)

我尝试添加Content-ID:只要一些其他自定义标头,仅使用curl和命令行(标头不应来自文件),并且对于同一请求中的每个附件,它们应该不同。但目前我只能指定每个文件的内容类型(已记录)。我没有找到任何适合我的任务的文档示例。

我用类似的东西:

curl -X POST --form "file=@test1.txt" --form "file=@test2.jpg" http://host:port
Run Code Online (Sandbox Code Playgroud)

结果如下(用wireshark重建)。默认情况下没有TEST单词(见下文)。

POST / HTTP/1.1
Host: host:port
User-Agent: curl/7.52.1
Accept: */*
Content-Length: 408
Expect: 100-continue
Content-Type: multipart/form-data; boundary=------------------------d7a9fdc4812ebc3b

 [SERVER REPLY:]  HTTP/1.1 100 Continue

--------------------------d7a9fdc4812ebc3b
Content-Disposition: form-data; name="file"; filename="test1.txt"
Content-Type: text/plain
TEST  <-- This is from _curl_ C code bruteforce. Here should be "Content-ID:from_command_line_for_file_1"

CONTENTS_OF_test1.txt
line2
line3

--------------------------d7a9fdc4812ebc3b
Content-Disposition: form-data; name="file"; filename="test2.jpg"
Content-Type: image/jpeg
TEST  <-- This is from _curl_ C code bruteforce. Here …
Run Code Online (Sandbox Code Playgroud)

linux post curl soap command-line-interface

6
推荐指数
1
解决办法
1414
查看次数

标签 统计

command-line-interface ×1

curl ×1

linux ×1

post ×1

soap ×1