Richard Hansen
f86df5322e
CachingMiddleware: Asyncify
2021-02-27 14:03:09 +01:00
Richard Hansen
0284d49522
CachingMiddleware: Switch to ES6 class syntax
2021-02-27 14:03:09 +01:00
Richard Hansen
80af66543a
lint: Move up respond()
in caching_middleware.js
2021-02-27 14:03:09 +01:00
Richard Hansen
7ab3ee2121
lint: src/node/utils/caching_middleware.js
2021-02-27 14:03:09 +01:00
Richard Hansen
f868788417
Remove unnecessary path.normalize()
calls
...
`path.join()` already normalizes.
2021-02-18 19:18:59 +00:00
John McLear
f664f84da5
lint: src/node/utils/caching_middleware.js
2021-01-25 22:53:11 -05:00
Richard Hansen
8e5fd19db2
lint: Run eslint --fix
on src/
2020-11-24 20:06:12 +00:00
webzwo0i
f2febcfc7e
minify: Fix gzip not triggered for packages ( #4491 )
...
* caching_middleware: fix gzip compression not triggered
* packages: If a client sets `Accept-Encoding: gzip`, the responseCache will
include `Content-Encoding: gzip` in all future responses, even
if a subsequent request does not set `Accept-Encoding` or another client
requests the file without setting `Accept-Encoding`.
Fix that.
* caching_middleware: use `test` instead of `match`
* add tests
* make code easier to understand
* make the regex more clear
2020-11-22 09:23:33 +00:00
John McLear
564e8fee07
forcing back to last known stable before parent merge
2020-06-07 18:44:01 +00:00
John McLear
009e1d01f7
staleCode: Async update
2020-06-07 14:56:45 +01:00
muxator
4ee5ddb496
caching_midleware: also run when nodejs does not have crypto module
...
According to the nodejs docs [0] the `crypto` module might be unavailable on
some platforms:
> It is possible for Node.js to be built without including support for the
> crypto module. In such cases, calling require('crypto') will result in an
> error being thrown
A description of such scenarios can be found here [1].
> * running non-standard node in a resource- or security-constrained
> environment
> * running in emulated environment (browserify, webpack etc.)
> * building node from source and omitting openssl/crypto for random reason
TypeScript guys dealt with this same issue and they resolved it in an elegant
way in [2].
We copy that approach here: if importing crypto fails at runtime, we replace
sha256 with djb2 [3], which is weaker, but works for our case.
The djb2 story is fun: see this Stack Overflow post [4], and the original
mailing list post from 1991 [5] by Daniel J. Bernstein [6].
He was 20 at the time!
[0] https://nodejs.org/docs/latest-v10.x/api/crypto.html#crypto_determining_if_crypto_support_is_unavailable
[1] https://github.com/microsoft/TypeScript/issues/19100#issuecomment-335871998
[2] 9677b0641c
[3] http://www.cse.yorku.ca/~oz/hash.html#djb2
[4] https://stackoverflow.com/questions/1579721/why-are-5381-and-33-so-important-in-the-djb2-algorithm
[5] https://groups.google.com/forum/#!msg/comp.lang.c/lSKWXiuNOAk/zstZ3SRhCjgJ
[6] https://en.wikipedia.org/wiki/Daniel_J._Bernstein
2020-03-31 04:09:49 +02:00
Tom Hudson
fc754c9a1d
Switches cacheKey from base64 of path to sha256 of path; fixes #3502
2020-03-31 02:42:58 +02:00
muxator
9d815c58b8
deprecations: get rid of DEP0005 about Buffer()
...
Similar code still lives in some dependent libraries.
It will be updated when upgrading the dependencies.
Fixes #3446
2018-08-14 19:45:03 +02:00
muxator
6d5a6cf795
caching_middleware: removed unnecessary escape in regex
...
Found by eslint with "no-useless-escape"
2018-08-14 19:33:10 +02:00
Stefan
6b9711cb70
Fixed path check
2016-06-20 00:22:29 +02:00
Stefan
835bca7967
Use fs.statSync instead of fs.existsSync (deprecated)
2016-05-16 16:51:12 +02:00
webzwo0i
b204aa2085
remove more dead requires.
2014-12-16 19:10:01 +01:00
Marcel Klehr
04a53c4402
Merge branch 'feature/support-node-0.10' into develop
...
Conflicts:
src/package.json
2013-04-01 13:29:07 +02:00
Manuel Knitza
358b07390e
fix "util.pump() is deprecated. Use readableStream.pipe()"
...
fix error introduced by b3988e3
2013-03-30 15:42:10 +01:00
disy-mk
c78aad16ea
adds missing semicolons in src/node/utils folder
2013-03-24 01:18:44 +01:00
John McLear
b3988e30d5
pump isdeprecated
2013-03-23 17:55:34 +00:00
Chad Weider
9d1274abaf
Drop method deprecated in Express 3.x.
2012-10-09 01:32:21 -07:00
Marcel Klehr
c01aaeefc1
Allow node v0.6.x and 0.8.x
2012-07-05 17:34:23 +02:00
Marcel Klehr
9d35b51500
Replace path.exists with fs.exists
2012-06-30 18:57:59 +02:00
Edy
e8639d87ce
fixes issue #707
...
Don't set cached cookies
2012-05-17 12:08:19 +02:00
Egil Moeller
dbdc53307e
Bugfix to not have server required anywhere as it causes problems for command line script usage of modules
2012-03-14 18:50:13 +01:00
Egil Moeller
381e64a801
Merge remote-tracking branch 'remotes/pita/develop' into pita-plugins
...
Conflicts:
src/node/utils/caching_middleware.js
2012-03-13 17:08:38 +01:00
Chad Weider
0944670fb7
Merge remote-tracking branch 'main/master' into develop
2012-03-11 15:58:36 -07:00
Chad Weider
c1a903e32e
Correct ca91c0c403
.
2012-03-10 15:57:46 -08:00
Chad Weider
c0fc7f9b0c
Avoid orphaned cache files from breaking the caching layer.
...
(cherry picked from commit 57d0a2e803
)
2012-03-10 15:27:17 -08:00
Chad Weider
ca91c0c403
Correct cache location and guard against bad directories.
2012-03-10 15:27:09 -08:00
Egil Moeller
384d768610
One more bug in cache dir setting
2012-03-08 21:47:18 +01:00
Egil Moeller
72571e5ef0
Bugfixing cache
2012-03-08 21:03:22 +01:00
Peter 'Pita' Martischka
7b518eeb2d
Fixing client side require, the minify code is completly unused now, very ugly solution
2012-03-04 23:45:33 +01:00