Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Network/HTTP.hs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ import Network.HTTP.Base
import qualified Network.HTTP.HandleStream as S
-- old implementation: import Network.HTTP.Stream
import Network.TCP
import Network.Stream ( Result )
import Network.Stream ( Result, ConnError(ErrorProxyConnection) )
import Network.URI ( parseURI )

import Data.Maybe ( fromMaybe )
Expand Down
1 change: 1 addition & 0 deletions Network/Stream.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ data ConnError
| ErrorClosed
| ErrorParse String
| ErrorMisc String
| ErrorProxyConnection String -- Added ErrorProxyConnection variant for proxy connection errors
deriving(Show,Eq)

-- in GHC 7.0 the Monad instance for Error no longer
Expand Down
5 changes: 3 additions & 2 deletions Network/StreamSocket.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module Network.StreamSocket
) where

import Network.Stream
( Stream(..), ConnError(ErrorReset, ErrorMisc), Result
( Stream(..), ConnError(ErrorReset, ErrorMisc, ErrorProxyConnection), Result
)
import Network.Socket
( Socket, getSocketOption, shutdown
Expand All @@ -49,6 +49,8 @@ handleSocketError sk e =
case se of
0 -> ioError e
10054 -> return $ Left ErrorReset -- reset
-- Enhanced error handling for proxy connection issues
10061 -> return $ Left $ ErrorProxyConnection "Proxy connection failed"
_ -> return $ Left $ ErrorMisc $ show se

myrecv :: Socket -> Int -> IO String
Expand Down Expand Up @@ -94,4 +96,3 @@ writeBlockSocket sk str = (liftM Right $ fn str) `catchIO` (handleSocketError sk
where
fn [] = return ()
fn x = send sk (toUTF8BS x) >>= \i -> fn (drop i x)