the-carlisle-group / rumba Goto Github PK
View Code? Open in Web Editor NEWA Web Server for Dyalog APL
License: MIT License
A Web Server for Dyalog APL
License: MIT License
Core.LogHTTPToSession
contains this line:
ts←#.CarlisleGroup.Rumba.Core.GetCurrentUTCHttpDate''
Look at X-RateLimit-Remaining, Retry-After, etc. Look at maximum requests per some time period. For example, on each request, have we seen this IP before? If so, increment request count by 1, then check against max, elapsed time, reset, etc.
The help states that NewClient.Host will be set automatically if not set and the value will be derived from Request.URI
I cannot reproduce it but I see in my log files (very rarely) a VALUE ERROR on line 7 of DefaultResponseHeaders
h,←(~ce)/⊂'Content-Length'(⍕⍵.ContentLength)
This function has a problem:
PercentDecode←{
dec←{⎕ML ⎕IO←0
⍉16⊥16|'0123456789ABCDEF0123456789abcdef'⍳⍉↑⍵
}
v←'%20',⍵
p←(v≠'%')⊂v
p2←dec 2↑¨p
p3←2↓¨p
b←1↓∊0,¨'+'=p3 ⍝ For backwards compatability we attempt to decode + as ' '
r←'UTF-8'⎕UCS 1↓⊃,/p2,¨⎕UCS¨p3
0=+/b:r ⍝ No blanks: done
(b/r)←' '
r
}
I got this as data:
content +%E2%8D%B3%0D%0A
content
should be just ⍳
: a space followed by an iota. This causes a LENGTH ERROR.
Generally speaking, when the data carries both a space and a multi-byte character it goes wrong.
... so that the folder may be provided as an argument, and that the left arg to Start can be elided, making it a static method that creates and returns its own server. This allows (along with issue #34 and issue #35):
S←Start 'c:\MyStaticWebsiteFolder'
To be all that is needed to start up a static site that can be accessed by pointing to localhost.
When the IsFile and Path property are used in a Response object to specify the content of the response, a HEAD request returns the content when it should not.
This should point to the Core
space.
And one could also argue that Method
is wrong
...even though the actual value is in fact UTC.
Function relies on the Windows shell. I will rewrote it to use []MKDIR
and clean up tests.
Not sure if this is cause by an Acre bug, but the folder should go.
GetCurrentUTCHttpDate←{
...
_net←⎕NS''
_net.⎕USING←,⊂'System'
_net.DateTime.UtcNow.ToString(,⊂'r')
This causes a DOMAIN ERROR.
_net.DateTime.UtcNow.ToString(⊂,'r')
fixes the problem
from event number to callbacks.
URL such as https://test.expression-builder.com/#/r0/expression-builder/LOANID/if do not drop the trailing / on the result of the function.
Authority expression-builder.com
Fragment /r0/expression-builder/LOANID/if
Host expression-builder.com
Path /index.html/
Port
Query
Scheme https
URI https://expression-builder.com/index.html/#/r0/expression-builder/LOANID/if
UserInfo m
⎕OFF
should use a right "argument" that is not 0, indicating an error to the calling process if there is any.
It should attempt to log the ⎕OFF
under strict error trapping and maybe also ⎕DMX.EM
.
The function should check whether a Ride session is currently connected and if so not execute ⎕OFF
, allowing the user to investigate. If somebody has connected with Ride there is a reason, possibly an interest in finding out what is causing the ⎕OFF
.
Something like this:
:If 3501⌶0
TRAP←⎕TRAP ⍝ Remember setting for inspection
⎕TRAP←0 'S'
∘∘∘ ⍝ Check it out, dear ⎕AN
:EndIf
The log file gets created with the name
\Rumba\Log\log.txt
in the parent folder instead of placed in the folder
\Rumba\Log\
I'm in CST at 10:08 am
⎕ts
2018 4 11 10 9 10 747
QTSToHTTPDate ⎕ts
Wed, 11 Apr 2018 10:09:12 GMT
Maybe update the function comments to state that inputs needs to be in GMT?
When requesting the Guardian home page from https://guardian.co.uk/ Rumba crashed because the response from the server has only a length of 2, so the line
⍵.ReasonPhrase←↑{⍺,' ',⍵}/2↓m
crashes.
Instead of crashing it seems to be better to check before that line is executed:
2=≢m:⍵ ⍝ Host response is invalid, and there is nothing we can do about it
.... so the project apce with default to #.Rumba
back to 80 and 0.
The CreateDirectory code for the log file is hardcoded to c:/ windows file system. We should rewrite this to work on an OS independent structure.
.... on both client and server, to accurately reflect what is provided in the message HTTP startline.
RequestTargt
rather than RequestTarget
5:VALUE ERROR
GetFormValue[4] c←⍺.ProcessedContent
∧
⍺.ProcessedContent does not exist in the namespace.
The NewTableRowLink codein NewTable should probably look for a zilde and if found, make that row regular non-link text. Right now it makes the link self referencing to the current page. This can be a time consuming round trip with larger data sets.
.... to something that will serve up a static site.
Ability for GetQueryParameter to return a default value if parameter does not exist.
Rumba does not know 422
OpenLogFile creates a log if the Folder property is defined. This poses an issue when pointing to a folder in a read-only or runtime environment. There should me an option to enable or disable, depending on what default is preferred.
... nobody is ever sending a 346?!
... to take a URI and retrieve the page/resource.
When one attempts to start the test server this crashes:
FILE NAME ERROR: C:/.../Rumba/Assets/Runtime/TestCertificates/server/localhost-cert.pem: Unable to open file ("The system can
not find the path specified.")
After copying over the required TestCertificates\
folder from an installation directory TestGetFileRequest
crashes.
The Rumba log file is opened pretty late, in particular after the OnStart
handler was already executed.
I suggest to open the log as early as possible. I want to log stuff early.
and its inverse ComposeURI, and a self-inverse function URI that covers both.
I'm creating links that have invalid URL characters. I'm torn if I should preprocess them or have the final NewLink method in Rumba properly encode the segments?
I.e.
/v1/directory/APLSource
/v1/directory/TestData
/v1/directory/\Rumba
/v1/directory/\Rumba\Log
The backslashes should be encoded..
Right now it looks like Rumba will replace '' of an HTMLElement with a href to a '/' without encoding it. This breaks the resource.
In case an attempt to establish a connections fails because, say, the server does not respond, then an attempt to clean up the battle field causes a VALUE ERROR in Close[6]
:
Close←{
⍝ Public Instance Method
⍝ ⍺ ←→ Client
⍝ ⍵ ←→ 0
⍝ ← ←→ 0
_←DRC.Close ⍺.Name
_⎕TKILL ⍺.Tid ⍝ <==
⍺.State←0
⍺.Name←''
⍺.Messages←⍬
0
}
I suggest instead:
Close←{
⍝ Public Instance Method
⍝ ⍺ ←→ Client
⍝ ⍵ ←→ 0
⍝ ← ←→ 0
_←DRC.Close ⍺.Name
⍺.State←0
⍺.Name←''
⍺.Messages←⍬
0=⍺.⎕NC'Tid':0 ⍝ When an attempt to open a connection failed then "Tid" might not exist
_←⎕TKILL ⍺.Tid
0
}
Currently the code is swallod by the Connect
function.
Although CongaError
tries hard to produce something useful as text, in my case that was just "OS Error".
I propose to change CongaError
:
CongaError←{
⍝ ⍵ ← Conga return code.
⍝ ← 1. If rc can be found in DRC.ErrorTable[;0]:
⍝ * If not empty the long error message is returned.
⍝ * Otherwise the error abbreviation is returned.
⍝ 2. If ⍵ cannot be found in DRC.ErrorTable (345 'Unknown Conga error') is returned.
⍝ The result can be used by:
⍝ ⎕SIGNAL CongaError <errNo>
rc←⍵
(abbr long)←(##.DRC.Error rc)[1 2]
0<≢long:⊂('EN' 345)('ENX'rc)('Message'long)
⊂('EN' 345)('ENX'rc)('Message'abbr)
}
The only difference is that the original return code is available on ⎕ENX
.
As a consequence Connect
needs to change when calling ConaError
:
Connect←{
...
rc≠0:⎕SIGNAL CongaError rc
...
}
To reproduce the bug run this function@
∇ ns←test;stop;ns;R;client;request;response
stop←{⍺←200 ⋄ ⍺=⍵: ⋄ ⎕←⍵ ⋄ ∘∘∘}
ns←⎕NS''
R←#.CarlisleGroup.Rumba
{}R.Core.InitConga''
R.Conga.X509Cert.LDRC←R.DRC
client←R.Core.NewClient 0
client.Port←443
client.Secure←1
client.X509←⎕NEW R.Conga.X509Cert
client.Host←'api.github.com'
request←R.Core.NewRequest 0
request.URI←'https://api.github.com/repos/aplteam/Meddy/releases/latest'
{}client R.Core.Send request
response←client R.Core.Receive 0
{}client R.Core.Close 0
stop response.StatusCode
∇ ⍝Done
Executing this results in
INDEX ERROR
GatherResponseMessage[13] n←(1+c.Messages⍳⍵)⊃c.Messages
"rootname" allows to use Conga in the same workspace for two different applications, for example one acting as a web server and one acting as a Tatin client. Different "rootnames" make sure that both applications see only their own Conga "objects".
For the Tatin client this is so important that I had to introduce it, so in my Rumba fork InitConga
not only accepts a path pointing to a folder that holds compatible Conga DLLs, it also allows specifying a "rootname", both as optional parameters.
I also removed any calls to InitConga
from any of the Rumba functions because my changes require Rumba to be initialized before she can actually use it.
With different "rootnames" one has also to use different versions of the Rumba namespace because internally the result is always assigned to DRC
. For Tatin that is not posing a problem since it lives in ⎕SE
, but there could be a better solution.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.