Memory should not be allocated based on Content length header for HEAD request.
responseContents = new byte[0];
should be used for HEAD requests to avoid using device memory.
It is possible to test the issue with HEAD method against huge PDF file (~100-150 Mb). Such request usually end up with OOM exception. With this fix it will get back with reponse very fast and without using extra memory.
Memory should not be allocated based on Content length header for HEAD request. responseContents = new byte[0]; should be used for HEAD requests to avoid using device memory.
It is possible to test the issue with HEAD method against huge PDF file (~100-150 Mb). Such request usually end up with OOM exception. With this fix it will get back with reponse very fast and without using extra memory.