@rip-lang/server 1.3.11 → 1.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/server.rip +11 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rip-lang/server",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.13",
|
|
4
4
|
"description": "Pure Rip web framework and application server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "api.rip",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"author": "Steve Shreeve <steve.shreeve@gmail.com>",
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"rip-lang": ">=3.13.
|
|
48
|
+
"rip-lang": ">=3.13.29"
|
|
49
49
|
},
|
|
50
50
|
"files": [
|
|
51
51
|
"api.rip",
|
package/server.rip
CHANGED
|
@@ -108,19 +108,24 @@ logAccessJson = (app, req, res, totalSeconds, workerSeconds) ->
|
|
|
108
108
|
type: type
|
|
109
109
|
length: if len then Number(len) else undefined
|
|
110
110
|
|
|
111
|
+
typeAbbrev =
|
|
112
|
+
html: 'html', css: 'css', javascript: 'js', json: 'json', plain: 'text'
|
|
113
|
+
png: 'png', jpeg: 'jpg', gif: 'gif', webp: 'webp', svg: 'svg'
|
|
114
|
+
'svg+xml': 'svg', 'x-icon': 'ico', 'octet-stream': 'bin'
|
|
115
|
+
|
|
111
116
|
logAccessHuman = (app, req, res, totalSeconds, workerSeconds) ->
|
|
112
117
|
{ timestamp, timezone } = formatTimestamp()
|
|
113
|
-
|
|
114
|
-
d2 = scale(workerSeconds, 's')
|
|
118
|
+
dur = scale(totalSeconds, 's')
|
|
115
119
|
method = req.method or 'GET'
|
|
116
120
|
url = new URL(req.url)
|
|
117
121
|
path = url.pathname
|
|
118
122
|
status = res.status
|
|
119
|
-
|
|
120
|
-
|
|
123
|
+
bytes = Number(res.headers.get('content-length') or 0)
|
|
124
|
+
size = scale(bytes, 'B')
|
|
121
125
|
contentType = (res.headers.get('content-type') or '').split(';')[0] or ''
|
|
122
|
-
|
|
123
|
-
|
|
126
|
+
sub = if contentType.includes('/') then contentType.split('/')[1] else contentType
|
|
127
|
+
type = (typeAbbrev[sub] or sub or '-').padEnd(4)
|
|
128
|
+
console.log "[#{timestamp} #{timezone} #{dur}] #{status} #{type} #{size} - #{method} #{path}"
|
|
124
129
|
|
|
125
130
|
INTERNAL_HEADERS = new Set(['rip-worker-busy', 'rip-worker-id', 'rip-no-log'])
|
|
126
131
|
|