fixed http content-type and content-length headers
fixed http printf to use cached variable