use modern http api; fix temp file naming issue