Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
clean-and-itasks
iTasks-SDK
Commits
acdab857
Commit
acdab857
authored
Apr 12, 2019
by
Bas Lijnse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added an engine option to limit webserver connections to localhost (on by default)
parent
6362be43
Pipeline
#21057
passed with stage
in 4 minutes and 46 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
2 deletions
+9
-2
Libraries/iTasks/Engine.dcl
Libraries/iTasks/Engine.dcl
+1
-0
Libraries/iTasks/Engine.icl
Libraries/iTasks/Engine.icl
+1
-0
Libraries/iTasks/Internal/Client/RunOnClient.icl
Libraries/iTasks/Internal/Client/RunOnClient.icl
+1
-0
Libraries/iTasks/Internal/WebService.icl
Libraries/iTasks/Internal/WebService.icl
+6
-2
No files found.
Libraries/iTasks/Engine.dcl
View file @
acdab857
...
...
@@ -63,6 +63,7 @@ instance Startable (a,b) | Startable a & Startable b
,
appVersion
::
String
,
serverPort
::
Int
,
serverUrl
::
String
,
localhostOnly
::
Bool
// Only allow connections from localhost. (default to true)
,
keepaliveTime
::
Timespec
,
sessionTime
::
Timespec
,
persistTasks
::
Bool
...
...
Libraries/iTasks/Engine.icl
View file @
acdab857
...
...
@@ -203,6 +203,7 @@ defaultEngineOptions world
,
appVersion
=
appVersion
,
serverPort
=
IF_POSIX_OR_WINDOWS
8080
80
,
serverUrl
=
"http://localhost/"
,
localhostOnly
=
True
,
keepaliveTime
=
{
tv_sec
=
300
,
tv_nsec
=
0
}
// 5 minutes
,
sessionTime
=
{
tv_sec
=
60
,
tv_nsec
=
0
}
// 1 minute, (the client pings every 10 seconds by default)
,
persistTasks
=
False
...
...
Libraries/iTasks/Internal/Client/RunOnClient.icl
View file @
acdab857
...
...
@@ -126,6 +126,7 @@ createClientIWorld serverURL currentInstance
,
appVersion
=
locundef
"appVersion"
,
serverPort
=
80
,
serverUrl
=
locundef
"serverUrl"
,
localhostOnly
=
False
,
keepaliveTime
=
locundef
"keepaliveTime"
,
sessionTime
=
locundef
"sessionTime"
,
persistTasks
=
False
...
...
Libraries/iTasks/Internal/WebService.icl
View file @
acdab857
...
...
@@ -129,12 +129,16 @@ where
wsockTextMsg
::
String
->
[
String
]
wsockTextMsg
payload
=
[
wsockMsgFrame
WS_OP_TEXT
True
payload
]
import
StdDebug
httpServer
::
!
Int
!
Timespec
![
WebService
r
w
]
(
sds
()
r
w
)
->
ConnectionTask
|
TC
r
&
TC
w
&
RWShared
sds
httpServer
port
keepAliveTime
requestProcessHandlers
sds
=
wrapIWorldConnectionTask
{
ConnectionHandlersIWorld
|
onConnect
=
onConnect
,
onData
=
onData
,
onShareChange
=
onShareChange
,
onTick
=
onTick
,
onDisconnect
=
onDisconnect
,
onDestroy
=
onDestroy
}
sds
where
onConnect
connId
host
r
iworld
=:{
IWorld
|
world
,
clock
}
=
(
Ok
(
NTIdle
host
clock
),
Nothing
,[],
False
,{
IWorld
|
iworld
&
world
=
world
})
onConnect
connId
host
r
iworld
=:{
IWorld
|
world
,
clock
,
options
}
|
options
.
localhostOnly
&&
host
<>
"127.0.0.1"
=
(
Ok
(
NTIdle
host
clock
),
Nothing
,[],
True
,{
IWorld
|
iworld
&
world
=
world
})
|
otherwise
=
(
Ok
(
NTIdle
host
clock
),
Nothing
,[],
False
,{
IWorld
|
iworld
&
world
=
world
})
onData
data
connState
=:(
NTProcessingRequest
request
localState
)
r
env
//Select handler based on request path
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment