Reputation: 2596
Here is the curl command I'm executing
curl -F "context=<http://example.com>" \
-F "Content-Type=text/plain" \
-F "source=file" \
-F "[email protected];type=text/plain" \
http://localhost:8080/openrdf-workbench/repositories/XXX/add
I'm trying to load openrdf repository. It gives me an error because there is a "<" character at in the value of "context" parameter. How to escape this "<" so curl does not think that I'm trying to load file content into "context" parameter
The error from curl is:
curl: (26) couldn't open file "http://example.com>"
I've tried to escape it with \ and using < and %3C but no luck because as soon as I try to do this then the other end is complaining that it did not get exactly http://example.com
This is what is sent from the browser form
------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--
Any suggestions ?
Upvotes: 3
Views: 2749
Reputation: 7571
You can use curl's --form-string
which is like -F
but doesn't interpret leading @
and <
:
--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.
Upvotes: 7