Hi,
the decision for base64 is now hardcoded: https://github.com/BaseXdb/basex/commit/b48318abaf3a406d6e34253694c8e33e6628...
Browser for example just send files in raw binary, so most other software (including jetty) does not know how to handle form-data with base64 encoding.
Regards, Max
2017-01-30 19:16 GMT+01:00 Christian Grün christian.gruen@gmail.com:
Hi Max,
Do you have an MCVE for us?
Thanks in advance, Christian
Am 30.01.2017 4:24 nachm. schrieb "Maximilian Gärber" mgaerber@arcor.de:
Hi,
this seems related to https://github.com/BaseXdb/basex/issues/1203
Problem 1: When setting Content-Transfer-Encoding manually (via http:header), it will appear twice in the request that is sent
Problem 2: I cannot override base64 because it happens automatically based on the content I am sending and for some reason the web server that receives this request does not recognize the base64 encoding correctly
Regards,
Max
2017-01-30 15:35 GMT+01:00 Maximilian Gärber mgaerber@arcor.de:
Hi,
I can't figure out how to send a file in binary (not base64) when using multipart [1]
On the body, I've tried method="basex" because the docs says this would write raw bytes to the request
Regards, Max
[1]
declare function _:send-multipart($url, $file-name, $path) as item()* {
let $uri := file:path-to-uri($path || $file-name) let $type := fetch:content-type($uri)
let $binary := file:read-binary($path || $file-name) let $boundary_id := concat("batch_", random:uuid())
let $req := <http:request method="post" send-authorization="false" override-media-type="text/plain">
<http:header name="Accept" value="application/json"/> <http:header name="Accept-Encoding" value="gzip, deflate"/> <http:multipart media-type="multipart/form-data"
boundary="{$boundary_id}">
<http:header name="Content-Transfer-Encoding" value="binary"/> <http:header name="Content-Disposition" value="form-data;
name='FILE'; filename='{$file-name}'"/> <http:header name="Content-Type" value="{$type}"/>
<!-- method="basex" method="adaptive" ? --> <http:body media-type="application/octet-stream" method="binary"> {$binary} </http:body> </http:multipart> </http:request>
let $resp := http:send-request($req, $url) return json:parse($resp[2])
};