Refactored parse_http_message()