improve HTTP upgrade compatibility