on master help sign in
Draft of solution

It still needs to get the appropriate upgrade string. Plaease advice if we are going to hardcode it or build according to servers capacilities.

commitd5b5d346090ecb4ed4e0b82fc5fe757138620797 authorMarcin Tolysz <tolysz@gmail.com> dateWed 16 Dec 2015, 17:08 (11 years ago) parent55a20f4
1 file changed+5−1
warp-tls/Network/Wai/Handler/WarpTLS.hs+5−1
warp-tls/Network/Wai/Handler/WarpTLS.hs+5−1
@@ -462,7 +462,11 @@ plainHTTP TLSSettings{..} s bs0 = case onInsecure of
462462 }
463463 return (conn'', TCP)
464464 DenyInsecure lbs -> do
465− sendAll s "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\n"
465+ -- http://tools.ietf.org/html/rfc2817#section-4.2
466+ sendAll s "HTTP/1.1 426 Upgrade Required\
467+ \r\nUpgrade: TLS/1.0, HTTP/1.1\
468+ \r\nConnection: Upgrade\
469+ \r\nContent-Type: text/plain\r\n\r\n"
466470 mapM_ (sendAll s) $ L.toChunks lbs
467471 sClose s
468472 throwIO InsecureConnectionDenied