我正在尝试构建一个 curl 命令,它将我的 xpi 上传到Mozilla Add-on Validator 进行验证。
我已经用 fiddler 捕获了流量,以查看站点在做什么,并尝试从 curl 中模仿它的行为。
我已经看到了什么是帖子网址,并尝试过curl https://addons.mozilla.org/en-US/developers/standalone-upload --form 'upload=@path-to-xpi.xpi'
,也使用csrfmiddlewaretoken=@path-to-xpi.xpi
. 并且还尝试添加Content-Type
.
这是来自第一个请求的原始数据:
POST https://addons.mozilla.org/en-US/developers/standalone-upload HTTP/1.1
Host: addons.mozilla.org
Connection: keep-alive
Content-Length: 41021
Origin: https://addons.mozilla.org
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryI0LeCjkeJnsfGipU
Accept: */*
Referer: https://addons.mozilla.org/en-US/developers/addon/validate
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8,he;q=0.6
Cookie: _ga=GA1.2.710702590.1450107779; sessionid=".eJyrVkouLkqLL8nPTs1TslLKznAOTYzI8czOTEzxCTe0SCzKichONjMO8PUO9Q5wcVfSUYpPLC3JiC8tTi2Kz0xRsjI0MrCwNDE3QZFISkwGmgeUVQJxi_Wg_GI9x9z8UKCIE1QeqKk4tbg4Mz8vPrWiILOoEmyepZmBQS0Aqsk0IA:1aLYVj:cbZQtNCkFRasDdFtJKI9b_WB6GA"
------WebKitFormBoundaryI0LeCjkeJnsfGipU
Content-Disposition: form-data; name="csrfmiddlewaretoken"
khCUaXlIkiadLW18arlXkc63PMKUKPDG
------WebKitFormBoundaryI0LeCjkeJnsfGipU
Content-Disposition: form-data; name="upload"; filename="extension.xpi"
Content-Type: application/octet-stream
目前我收到一个不允许的 html 页面。
我错过了什么?我还应该在请求中添加什么以获得良好的响应?
谢谢