So I am trying to send large http request to ARI (that is still under 4096 bits) to originate a call. Http request contain large body with lots of SIP headers and SIP body that needs to be set.
When I send such a request from chrome using ARI swagger there is no issues, call originated as expected. But when I try to do it from my java app using ari4java library or even appache http client it fails with:
“WARNING: http.c:923 http_body_read_contents: Short HTTP request body (Wanted 2890)”
After some wiresharking and looking in http.c source code I believe the issue here is in the way asterisk http server process incoming http requests.
For example if I send request from chrome, http client in chrome manage to break requests in TCP segments the way that http headers are delivered in separate segment and body of the message in subsequent segments. And it looks like that is exactly what asterisk http server is expecting to get.
But in case of java client http request is broken the way that http headers and part of body are delivered together in same first TCP segment. In this case asterisk http server doesn’t bother to look in buffer for rest of the message and treat that first segment as entire message and fail because length in “Content-Length” http header doesn’t match the length of part of http body in that first segment.