Commit graph

104 commits

Author SHA1 Message Date
Eitaro Fukamachi
0bb74d0610 Fix the style warnings and an error of generate-env in Lack.Test. 2019-08-29 16:21:08 +09:00
Eitaro Fukamachi
a6d0a11ca3 Fix Lack.Request not to raise an error when there's the request body without Content-Type header. (fixes #39) 2019-08-29 15:57:49 +09:00
Eitaro Fukamachi
8ddb653007 Make generate-env allow to take :COOKIES key argument. 2019-03-18 17:01:41 +09:00
Eitaro Fukamachi
805c0b99c0 Replace 'string=' by 'equal' for preventing from TYPE-ERROR when it's other than a string. 2019-03-18 16:15:17 +09:00
cxxxr
023444ea8f fix csrf token check 2019-03-18 16:09:11 +09:00
Knut Olav Bøhmer
efb03abf2d Responce could also be a pathname 2018-11-09 10:19:58 +01:00
Eitaro Fukamachi
4dae26e752 Fix lack.test's request to work in case when 'content' is not a cons. 2018-10-26 22:50:12 +09:00
Eitaro Fukamachi
2a9fc540cf Set body-parameters only when the parsed data is an alist. 2018-10-26 22:41:54 +09:00
Eitaro Fukamachi
4bd5dca97a Delete lack.test:response. 2018-09-20 06:33:39 +09:00
Eitaro Fukamachi
3365430862 Add 'testing-app' & 'request' for writing easily and support cookie-jar & redirection. 2018-09-20 05:59:13 +09:00
Eitaro Fukamachi
a6962b1fb6 Make downcased strings in headers. 2018-09-19 23:29:08 +09:00
Eitaro Fukamachi
7bae407558 Decode URI in generate-env. 2018-09-19 23:16:38 +09:00
Eitaro Fukamachi
4fac568329 Allow 'content' of types other than alist in lack.test:generate-env. 2018-09-19 22:53:39 +09:00
Eitaro Fukamachi
17756b63fd
Merge pull request #27 from mtstickney/delayed_session_control
Delayed-response session expiration
2018-09-05 10:56:11 +09:00
Eitaro Fukamachi
74dfb10bfe
Merge pull request #30 from TurtleWarePL/fix-unclosed-db
Bugfix with session.store.dbi: make it possible to close the DB connection
2018-09-05 10:53:49 +09:00
Eitaro Fukamachi
d0e8add464
Merge pull request #35 from fukamachi/fix/request-raw-body
Replace ENV's raw-body by a circular-stream in case when parsing more than twice.
2018-09-03 18:01:27 +09:00
Eitaro Fukamachi
96d08811e3 Replace ENV's raw-body by a circular-stream in lack.request:make-request in case when parsing more than twice. 2018-09-03 17:56:56 +09:00
Matthew Stickney
84472bc475 Finalize session state after running delayed responses.
We want to allow delayed-response code to run before we decide whether to
do things like expiring the session cookie. If session finalization is run
before then, any session settings made by delayed code will be ignored.

The previous implementation (a specialization on FINALIZE-STATE for
function responses) is insufficient, because while the expiration itself is
deferred, the decision whether to expire the session is still performed
befored delayed-response code has run.
2018-08-01 14:24:12 -04:00
Cyrus Harmon
b4ffadaa12 use mimes:mime-lookup instead of mimes:mime
* and set default to application/octet-stream

* otherwise, we run into problems if the "file" command invokation
  fails
2018-07-29 12:58:07 +02:00
Eitaro Fukamachi
b2d8e03065 Merge branch 'master' of github.com:fukamachi/lack 2018-07-24 14:43:14 +09:00
Eitaro Fukamachi
bde4285756 Change the default session key for CSRF token (Lack.Middleware.Csrf).
Keyword cannot be stored in RDBMS and a string would be better.
2018-07-24 14:42:05 +09:00
Eitaro Fukamachi
6809745e7a
Merge pull request #33 from mtstickney/quicklisp_symbol_usage
Fix fiddly build issues caused by references to quicklisp symbols
2018-07-20 15:35:26 +09:00
Matthew Stickney
6e2c315b32 Don't refer directly to symbols in systems we don't depend on.
The reader conditional for using quicklisp code only does half the job. You
will still get unpleasant build errors with the following common scenario:
1. The user loads this library, once, with quicklisp. The reader
   condition selects the quicklisp loader code.
2. ASDF caches a fasl file for this code, which uses the quicklisp
   functions.
3. The user loads this library again, without quicklisp.
4. ASDF loads the cached fasl, which refers to symbols in packages that
   don't exist in the current image, badness ensues.

This change avoids all read-time references to symbols in quicklisp by
looking up the symbols in question at run time. The symbol lookups go out
of their way to give good error messages if a symbol can't be found, since
FUNCALL-ing NIL doesn't tell you anything very helpful. The error type is
checked dynamically by using a HANDLER-BIND that traps every condition --
conditions of other types simply go unhandled, and are propagated normally.

The reader conditional has been replaced by a run-time features check, so
ASDF/quicklisp will be used based on what's present at the time the system
is loaded, and not what was available the first time this library was
loaded.
2018-07-05 14:52:18 -04:00
Eitaro Fukamachi
2c1c0df583 Change the option name of CSRF token to ':session-key'. 2018-04-12 17:23:32 +09:00
Eitaro Fukamachi
9ae2c5df7c Allow to change the key of CSRF token in a session. 2018-04-12 17:21:26 +09:00
Alexander Artemenko
3a4827e62d Now request object has slot uri-scheme, accessible as request-uri-scheme.
This change was made to make possible to write a function which will rebuild an original URI, used for a request.

Also lack.test:generate-env function was modified to work with fully qualified URIs. When you pass it something like https://example.com/foo/bar, it will set host and port of environment to example.com and 433.

This is useful for mocking requests, pretending that request was made to some particular host.
2018-01-06 16:36:28 +03:00
Tomek Kurcz
67f6d4dc9e Bugfix: make it possible to close the DB connection 2017-11-28 14:05:40 +01:00
Eitaro Fukamachi
19b9f1baa3 Do not parse raw-body if there's no Content-Length or Transafer-Encoding isn't chunked. 2017-07-07 11:53:22 +09:00
Eitaro Fukamachi
32358fdad0 Add request-content for getting the whole request body from raw-body. 2016-10-17 20:27:32 +09:00
Eitaro Fukamachi
3940e86e8e Use circular-streams for wrapping raw-body. 2016-10-17 20:27:27 +09:00
Eitaro Fukamachi
4e3dd0b4a8 Add stream-element-type for writer-stream. 2016-09-28 16:45:30 +09:00
Eitaro Fukamachi
8c6ba6f41d Delete a dependency of lack.util on Alexandria. 2016-09-27 12:36:36 +09:00
Eitaro Fukamachi
6159d4a5ff Add lack.util.writer-stream for treating delayed responding writer as a stream. 2016-09-27 12:35:57 +09:00
Eitaro Fukamachi
82dd7c4b24 Change Lack.Response to add 'body' when it exists even if it doesn't at first. 2016-09-24 02:26:47 +09:00
Eitaro Fukamachi
1db8798811 Fix lack.response not to add NIL as the body when only 2 values are given to make-response. 2016-09-23 01:14:55 +09:00
Eitarow Fukamachi
17d15c7102 Add :record-timestamps to dbi-store for recording created_at & updated_at. 2016-08-23 22:01:50 +09:00
Eitarow Fukamachi
618435d8ed Allow to change the cookie key of Lack Session (the default is 'lack.session') 2016-08-16 13:13:34 +09:00
Eitaro Fukamachi
9ff8959571 Stop executing a meaningless UPDATE query when the session isn't changed. 2016-02-11 21:35:17 +09:00
Eitaro Fukamachi
d06ba3737c Add default keys to lack.session.options. 2016-02-11 21:34:56 +09:00
Eitaro Fukamachi
7ab8ac79e6 Add lack.session.store.redis for storing session data in Redis. 2016-02-09 22:05:37 +09:00
Eitaro Fukamachi
0ec31a24a6 Suppress loading messages in find-package-or-load. 2016-02-08 16:18:16 +09:00
Eitaro Fukamachi
1905bfb718 Merge pull request #16 from fukamachi/fix-session-store-dbi
Fix lack-session-store-dbi to allow UTF-8 data
2015-11-19 19:28:02 +09:00
Eitaro Fukamachi
4f07c50b6c Fix an error when storing UTF-8 data to DBI session store. 2015-11-19 18:05:04 +09:00
Eitaro Fukamachi
3a74575651 Show warnings when deserializing a session failed. 2015-11-19 18:02:07 +09:00
Matthew Stickney
760d065e51 Don't leak sessions when changing session id.
Previously COMMIT was generating a new id for the session but not
communicating it to the caller, so when FINALIZE-STATE was called it
resent the old id to the client and the session was lost (the leak).

Instead, generate the (possibly) new id in FINALIZE and pass it to
COMMIT and FINALIZE-STATE, which will send the new id to the client.
2015-10-09 13:32:59 -04:00
Eitaro Fukamachi
13677d3ad2 Fix not to expire sessions permanently (fixes #13). 2015-10-09 14:11:44 +09:00
Eitaro Fukamachi
d4cdb5315d Add :keep-empty option to Lack.Middleware.Session for preventing from sending Set-Cookie header until the session is used. 2015-09-26 15:45:38 +09:00
Eitaro Fukamachi
0d4c0a1ad8 Don't send Set-Cookie header if the cookie already exists. 2015-09-26 14:52:27 +09:00
Eitaro Fukamachi
d49b740a33 Add :new-session t to lack.session.options if no session is stored yet. 2015-09-26 14:25:02 +09:00
Eitaro Fukamachi
0cc7f9fb98 Fix the indentation in lack.middleware.session.state.cookie. 2015-09-26 14:14:36 +09:00