Hello Ron, Thank you very much for your reply – this all makes sense now!
P.S. Thanks to Erik Hennum on different thread too. -- Kind Regards, Arunas Vaitkus From: <general-boun...@developer.marklogic.com> on behalf of Ron Hitchens <r...@ronsoft.com> Reply-To: MarkLogic Developer Discussion <general@developer.marklogic.com> Date: Monday, 17 July 2017 at 18:30 To: MarkLogic Developer Discussion <general@developer.marklogic.com> Subject: Re: [MarkLogic Dev General] Docs REST api: Content Length and Keep Alive headers ommited on bigger files Arunas, That’s the way the HTTP protocol works, you need to be prepared to handle the response with or without a Content-Length header. When the response is small enough for MarkLogic to collect it into a temporary buffer, it adds the Content-Length header and sets the "Connection: Keep-Alive" header because both parties know the size of the response and can “turn around” the connection for another request (within "timeout=500" milliseconds). But when the response size exceeds the internal buffer size, then MarkLogic starts a streaming reply. It sends a "Connection: close" header to tell the client that it should read until the end of the stream, and leaves off the Content-Length header because it doesn’t know how long the response ultimately will be. However, if the content is "multipart/mixed" as in this case, each part will have its own internal headers, which may contain Content-Length or, as indicated by the “boundary” clause, magic strings that will demarcate the parts. I DON’T suggest you try to parse multipart/mixed response bodies. The best solution is to use an HTTP client library to issue your REST requests. The library will know how to handle all this stuff for you and automatically do the right thing depending on MarkLogic’s HTTP respond. Apache libraries are a popular choice (http://hc.apache.org/). The Apache libraries also have classes to parse out the parts of a multipart response. I hope that helps. ---- Ron Hitchens r...@overstory.co.uk, +44 7879 358212 On July 17, 2017 at 6:05:32 PM, Arunas (aruna...@gmail.com) wrote: Dear All, We are using the documents management /v1/documents REST endpoint to retrieve documents in multipart/mixed content type. It works as expected with a retrieval of smaller documents and returns headers with a response like so: HTTP/1.1 200 OK vnd.marklogic.document-format: binary Content-type: multipart/mixed; boundary=ML_BOUNDARY_11510717316849072801 ML-Effective-Timestamp: 15003098405343020 Content-Length: 15684 Server: MarkLogic Connection: Keep-Alive Keep-Alive: timeout=500 However, on a retrieval of bigger size documents Content-Length & Keep-Alive headers are ommited, Connection header is set to "Close" like so: HTTP/1.1 200 OK vnd.marklogic.document-format: binary Content-type: multipart/mixed; boundary=ML_BOUNDARY_4647702192025548700 ML-Effective-Timestamp: 15003103202328660 Server: MarkLogic Connection: close I obviously done the homework and found somewhat helpful KB article here: https://help.marklogic.com/knowledgebase/article/View/465/0/content-length-keepalive-and-connection-close, mentioning that this is situational depending on the response size. However, it does not necessarilly tell me if there is any way to override the 1MB threshold. Is there any way to override this threshold as I fail to find one on admin interface or use a clever request headers to raise it? We are on v8.0-6.3 but I can also reproduce this on v9.0-1.1 MarkLogic Kind reagards, Arunas Vaitkus _______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general