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
529e4192
Commit
529e4192
authored
Apr 12, 2019
by
Bas Lijnse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extended engine option for access restriction to a whitelist instead of a single flag
parent
acdab857
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
8 deletions
+8
-8
Libraries/iTasks/Engine.dcl
Libraries/iTasks/Engine.dcl
+1
-1
Libraries/iTasks/Engine.icl
Libraries/iTasks/Engine.icl
+1
-1
Libraries/iTasks/Internal/Client/RunOnClient.icl
Libraries/iTasks/Internal/Client/RunOnClient.icl
+1
-1
Libraries/iTasks/Internal/WebService.icl
Libraries/iTasks/Internal/WebService.icl
+5
-5
No files found.
Libraries/iTasks/Engine.dcl
View file @
529e4192
...
...
@@ -63,7 +63,7 @@ instance Startable (a,b) | Startable a & Startable b
,
appVersion
::
String
,
serverPort
::
Int
,
serverUrl
::
String
,
localhostOnly
::
Bool
// Only allow connections from
local
host
.
(default
to true
)
,
allowedHosts
::
[
String
]
// Only allow connections from
these
host
s
(default
["127.0.0.1"]
)
,
keepaliveTime
::
Timespec
,
sessionTime
::
Timespec
,
persistTasks
::
Bool
...
...
Libraries/iTasks/Engine.icl
View file @
529e4192
...
...
@@ -203,7 +203,7 @@ defaultEngineOptions world
,
appVersion
=
appVersion
,
serverPort
=
IF_POSIX_OR_WINDOWS
8080
80
,
serverUrl
=
"http://localhost/"
,
localhostOnly
=
True
,
allowedHosts
=
[
"127.0.0.1"
]
,
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 @
529e4192
...
...
@@ -126,7 +126,7 @@ createClientIWorld serverURL currentInstance
,
appVersion
=
locundef
"appVersion"
,
serverPort
=
80
,
serverUrl
=
locundef
"serverUrl"
,
localhostOnly
=
False
,
allowedHosts
=
[]
,
keepaliveTime
=
locundef
"keepaliveTime"
,
sessionTime
=
locundef
"sessionTime"
,
persistTasks
=
False
...
...
Libraries/iTasks/Internal/WebService.icl
View file @
529e4192
...
...
@@ -129,16 +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
,
options
}
|
options
.
localhostOnly
&&
host
<>
"127.0.0.1"
=
(
Ok
(
NTIdle
host
clock
),
Nothing
,[],
True
,{
IWorld
|
iworld
&
world
=
world
})
|
otherwise
onConnect
connId
host
r
iworld
=:{
IWorld
|
world
,
clock
,
options
={
allowedHosts
}}
|
allowedHosts
=:
[]
||
isMember
host
allowedHosts
=
(
Ok
(
NTIdle
host
clock
),
Nothing
,[],
False
,{
IWorld
|
iworld
&
world
=
world
})
|
otherwise
//Close the connection immediately if the remote host is not in the whitelist
=
(
Ok
(
NTIdle
host
clock
),
Nothing
,[],
True
,{
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