Git Product home page Git Product logo

tiny-routes's People

Contributors

jeko2000 avatar kilianmh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tiny-routes's Issues

Why the times inthe test don't match

:expires (encode-universal-time 6 22 19 25 1 2002)

(is (string= "name3=value3; Expires=Sat, 26 Jan 2002 00:22:06 GMT; Path=/; Domain=example.com; Secure"

*cookie3* and *cookie4* are set to expire on "25 Jan 2002 19:22:06", but the test looks for the string "26 Jan 2002 00:22:06".
Why the 5 hours gap?
Looks like a mismatch between Eastern Time Zone and GMT.
encode-universal-time and decode-universal-time take extra &optional argument timezone time-zone, maybe you eed to use this.

Add a path-template matcher implementation to emulate Sinatra's splat parameters

Sinatra allows matching against splat or wildcard parameters.

Per their docs:

get '/say/*/to/*' do
  # matches /say/hello/to/world
  params['splat'] # => ["hello", "world"]
end

get '/download/*.*' do
  # matches /download/path/to/file.xml
  params['splat'] # => ["path/to/file", "xml"]
end

It may be useful to write a path-template matcher implementation to emulate this behavior.

Allow client to pass a stream to string function for the wrap-request-body middleware

Description

The current implementation of wrap-request-body (shown below) leverages an internal read-stream-to-string function to slurp an input stream to a string.

(defun wrap-request-body (handler)
  "Wrap HANDLER such that the request body is read to a string and made
available to the request via `:request-body'."
  (lambda (request)
    (let* ((stream (raw-body request))
           (body (read-stream-to-string stream)))
      (funcall handler (request-append request :request-body body)))))

Task

Please consider allowing the client to pass their own stream->string slurping function to this middleware via an optional parameter. For example,

(defun wrap-request-body (handler &optional (stream-string-reader #'read-stream-to-string))
  ...)

Sample usage

(wrap-request-body handler #'uiop:slurp-stream-string)

Accept a max-size parameter for the wrap-request-body middleware function

The current implementation of wrap-request-body will attempt to read the request stream regardless of its size. As such, this function is susceptible to some DoS attacks where requests contains large bodies.

Consider adding an optional max-bytes parameter representing the maximum number of bytes that wrap-request-body will read before returning a failed response.

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.