这是我正在执行的curl命令
curl -F "context=<http://example.com>" \
-F "Content-Type=text/plain" \
-F "source=file" \
-F "content=@members.nt;type=text/plain" \
http://localhost:8080/openrdf-workbench/repositories/XXX/add
我正在尝试加载openrdf存储库。它给了我一个错误,因为有一个“&lt;” “context”参数值中的字符。 如何逃避这个“&lt;”所以curl并不认为我正在尝试将文件内容加载到“context”参数
中curl的错误是:
curl: (26) couldn't open file "http://example.com>"
我试图用\来逃避它并使用&lt;和%3C 但没有运气,因为一旦我尝试这样做,那么另一端就是在抱怨它没有完全准确http://example.com
这是从浏览器表单
发送的内容------WebKitFormBoundaryl8CUSIvy5962lwBF
Content-Disposition: form-data; name="baseURI"
------WebKitFormBoundaryl8CUSIvy5962lwBF
Content-Disposition: form-data; name="context"
<http://example.com>
------WebKitFormBoundaryl8CUSIvy5962lwBF
Content-Disposition: form-data; name="Content-Type"
text/plain
------WebKitFormBoundaryl8CUSIvy5962lwBF
Content-Disposition: form-data; name="source"
file
------WebKitFormBoundaryl8CUSIvy5962lwBF
Content-Disposition: form-data; name="content"; filename="members.nt"
Content-Type: application/octet-stream
------WebKitFormBoundaryl8CUSIvy5962lwBF--
有什么建议吗?
答案 0 :(得分:4)
您可以使用curl的--form-string
,类似-F
,但不会解释前导@
和<
:
--form-string <name=string>
(HTTP) Similar to --form except that the value string for the named parameter is used literally. Leading '@' and '<' characters, and the ';type=' string in the value have
no special meaning. Use this in preference to --form if there's any possibility that the string value may accidentally trigger the '@' or '<' features of --form.