Added a parameter for sending content-length

Fix for issue #2227.