Commit b6b681c9 authored by Bas Lijnse's avatar Bas Lijnse

Implemented http keep-alive support (no timeouts yet)

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@2395 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 1f4081f9
......@@ -28,7 +28,7 @@ startEngine publishable world
# world = show (infoline app) world
//Check options
# port = fromMaybe DEFAULT_PORT (intOpt "-port" opts)
# debug = boolOpt "-debug" opts
# debug = fromMaybe 0 (intOpt "-debug" opts)
# help = boolOpt "-help" opts
# sdkOpt = stringOpt "-sdk" opts
//If -help option is given show help and stop
......
......@@ -11,6 +11,7 @@ from TaskState import :: TaskListEntry
from JSON import :: JSONNode
from StdFile import class FileSystem
from SharedDataSource import class registerSDSDependency, class registerSDSChangeDetection, class reportSDSChange, :: CheckRes(..), :: BasicShareId, :: Hash
from HttpServer import class HttpEnv
:: *IWorld = { application :: !String // The name of the application
, build :: !String // The date/time identifier of the application's build
......@@ -51,6 +52,8 @@ getResponseExpiry :: !InstanceNo !*IWorld -> (!Maybe Int, !*IWorld)
instance FileSystem IWorld
instance HttpEnv IWorld
instance registerSDSDependency InstanceNo IWorld
instance registerSDSChangeDetection IWorld
instance reportSDSChange InstanceNo IWorld
......
......@@ -4,12 +4,14 @@ from FilePath import :: FilePath
from Map import :: Map
from Maybe import :: Maybe
from SystemTypes import :: DateTime, :: User, :: Config, :: InstanceNo, :: TaskNo, :: TaskId, :: TaskListItem, :: ParallelTaskType, :: TaskTime
from Time import :: Timestamp
from Time import :: Timestamp, time
from TaskState import :: TaskListEntry
from JSON import :: JSONNode
from StdFile import class FileSystem(..)
from StdFile import instance FileSystem World
from HttpServer import class HttpEnv(..)
from List import splitWith
from SharedDataSource import class registerSDSDependency, class registerSDSChangeDetection, class reportSDSChange, :: CheckRes(..), :: BasicShareId, :: Hash
import TaskStore, Time, Util, StdList, Base64, _SystemArray, StdBool, StdTuple
......@@ -114,6 +116,12 @@ where
# (ok,file,world) = sfopen filename mode world
= (ok,file,{IWorld|iworld & world = world})
instance HttpEnv IWorld
where
httpServerTimestamp iworld=:{IWorld|world}
# (ts,world) = time world
= (ts,{IWorld|iworld & world = world})
instance registerSDSDependency InstanceNo IWorld
where
registerSDSDependency sdsId instanceNo iworld
......
......@@ -14,7 +14,7 @@ from TCPChannelClass import :: Timeout
:: HTTPServerOption st = HTTPServerOptPort Int // The port on which the server listens (default is 80)
| HTTPServerOptStaticFallback Bool // If all request handlers fail, should the static file handler be tried (default False)
| HTTPServerOptParseArguments Bool // Should the query and body of the request be parsed (default True)
| HTTPServerOptDebug Bool // Should the server write debug info to the stdout
| HTTPServerOptDebug Int // Debug level: 0 -> none, 1 -> short messages, 2 -> full output
| HTTPServerOptBackgroundProcess !(st -> *(!Maybe Timeout, !st))
// Start the HTTP server
......@@ -22,4 +22,10 @@ from TCPChannelClass import :: Timeout
// The second argument is a list of pairs of predicates and request handlers
// The predicate inspects the requested path (eg. /foo), if the predicate is true the corresponding request handler is invoked
http_startServer :: ![HTTPServerOption *st] [(!(String -> Bool),!(HTTPRequest *st-> (!HTTPResponse,!*st)))] !*st -> *st | ChannelEnv st & FileSystem st
\ No newline at end of file
http_startServer :: ![HTTPServerOption *st] [(!(String -> Bool),!(HTTPRequest *st-> (!HTTPResponse,!*st)))] !*st -> *st | ChannelEnv st & FileSystem st & HttpEnv st
class HttpEnv st
where
httpServerTimestamp :: *st -> (!Timestamp,!*st)
instance HttpEnv World
This diff is collapsed.
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