Multipart/form-data with chunked data transfer (ICAP protocol)

48 Views Asked by At

I need to send a multipart/form-data request to the ICAP server, and the request should be split into chunks with Preview: 0(server requirements)

Problem: the server sees the request, but does not see the file being sent

Tried: sending the request with different content length, with different chunk size and with different request form

Sending a request using Java on sockets

I calculate content-length on

  • file data length
  • encapsulated headers length(content-disposition, content-type)
  • boundary`s

In this request I send all data in one chunk, so chunk equals content-length

REQMOD icap://127.0.0.1/serviceName ICAP/1.0
Host: 127.0.0.1
Referer: https://sample.ru/
User-Agent: ICAP-Client/1.0
Allow: 204
Preview: 0
X-Client-IP: 127.0.0.1
X-Authenticated-User: user
Encapsulated: req-hdr=0, req-body=159

POST /filename.txt HTTP/1.1
Host: 127.0.0.1:1344
Content-Type: multipart/form-data; boundary=--WebKitBoundary1711698290193
Content-Length: 166

0

a6
----WebKitBoundary1711698290193
Content-Disposition: form-data; name="files"; filename="filename.txt"
Content-Type: text/plain

t
----WebKitBoundary1711698290193--

0

0

There are 0 best solutions below