Commit 844e6c44 authored by Haye Böhm's avatar Haye Böhm

Remove http from client

parent ec465c46
......@@ -22,18 +22,14 @@ import qualified Data.Map as DM
derive JSONEncode SDSNotifyRequest, RemoteNotifyOptions
createRequestString req host port
# data = serializeToBase64 req
# headers = 'DM'.fromList [("Connection", "Close"), ("Content-Length", toString (size data))]
= toString {newHTTPRequest & req_method = HTTP_POST, server_name = host, server_port = port, req_path = "/sds/", req_version = "HTTP/1.1", req_data = data, req_headers = headers}
createRequestString req = serializeToBase64 req
onConnect reqq host port _ _ = (Ok (Left []), Nothing, [createRequestString reqq host port], False)
onConnect reqq _ _ = (Ok (Left []), Nothing, [createRequestString reqq], False)
onData data (Left acc) _ = (Ok (Left (acc ++ [data])), Nothing, [], False)
onShareChange acc _ = (Ok acc, Nothing, [], False)
import StdDebug
queueSDSRequest :: !(SDSRequest p r w) !String !Int !TaskId !{#Symbol} !*IWorld -> (!MaybeError TaskException ConnectionId, !*IWorld) | TC r
queueSDSRequest req host port taskId symbols env = case addConnection taskId host port connectionTask env of
(Error e, env) = (Error e, env)
......@@ -42,13 +38,12 @@ where
connectionTask = wrapConnectionTask (handlers req) unitShare
handlers :: (SDSRequest p r w) -> ConnectionHandlers (Either [String] r) () () | TC r
handlers _ = {ConnectionHandlers| onConnect = onConnect req host port,
handlers _ = {ConnectionHandlers| onConnect = onConnect req,
onData = onData,
onShareChange = onShareChange,
onDisconnect = onDisconnect}
onDisconnect (Left acc) _
| not (trace_tn ("Got response: " +++ concat acc)) = undef
# rawResponse = concat acc
= case parseResponse rawResponse of
Nothing = (Error ("Unable to parse HTTP response, got: " +++ rawResponse), Nothing)
......@@ -64,7 +59,7 @@ where
connectionTask = wrapConnectionTask (handlers req) unitShare
handlers :: (SDSRequest p r w) -> ConnectionHandlers (Either [String] (r, w)) () () | TC r
handlers _ = {ConnectionHandlers| onConnect = onConnect req host port,
handlers _ = {ConnectionHandlers| onConnect = onConnect req,
onData = onData,
onShareChange = onShareChange,
onDisconnect = onDisconnect}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment