refactored http_request function and fixed a bug. 
added non yet finished http_get_file function.