redo http logic for cross-platform compatibility