Git Product home page Git Product logo

rumba's People

Contributors

aplteam avatar e9gille avatar norberturkiewicz avatar paulmansour avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rumba's Issues

Implement Rate-Limiting

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.

VALUE ERROR on `ContentLength`

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)

Problem with PercentEncode

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.

Enhance NewServer and Start methods

... 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.

HEAD request for file does not work

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.

Bug in GetCurrentUTCHttpDate

 GetCurrentUTCHttpDate←{
...
     _net←⎕NS''
     _net.⎕USING←,⊂'System'
     _net.DateTime.UtcNow.ToString(,⊂'r')

This causes a DOMAIN ERROR.

     _net.DateTime.UtcNow.ToString(⊂,'r')

fixes the problem

Suggestions regarding ErrorInRumba

  1. ⎕OFF should use a right "argument" that is not 0, indicating an error to the calling process if there is any.

  2. It should attempt to log the ⎕OFF under strict error trapping and maybe also ⎕DMX.EM.

  3. 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

ProcessResponseLine crashes on invalid host responses

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

TestServer.Start fails on Linux

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.

In version 0.1.9 the tests don't pass

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.

Log file should be opened earlier

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.

Should #.CarlisleGroup.Rumba.HTML.NewLink automatically encode url segments?

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.

Under some circumstances ⎕TKILL ⍺.Tid in "Close" can cause a VALUE ERROR

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
 }

Preserve TCP return (or error) codes

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
...
 }

INDEX ERROR in GatherResponseMessage on "Messages"

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

Rumba offers no way to specify Conga's "rootname" property

"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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.