Fixed getContentLentgh so that connections are not closed after each request