summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/request-parser.js (renamed from lib/parser.js)9
-rw-r--r--lib/util.js14
2 files changed, 17 insertions, 6 deletions
diff --git a/lib/parser.js b/lib/request-parser.js
index a66a323..04c5cd6 100644
--- a/lib/parser.js
+++ b/lib/request-parser.js
@@ -12,7 +12,7 @@ const {MESSAGES} = require('./statuses')
const CRLF = '\r\n'
const MAX_HEADER_SIZE = 1024 + CRLF.length
-const createParser = () => {
+const createRequestParser = () => {
let headerParsed = false
let peek = Buffer.alloc(0)
@@ -63,7 +63,7 @@ const createParser = () => {
return out
}
-// const p = createParser()
+// const p = createRequestParser()
// p.on('error', console.error)
// p.on('header', h => console.log('header', h))
// p.on('data', d => console.log('data', d.toString('utf8')))
@@ -72,7 +72,4 @@ const createParser = () => {
// p.write(b('le.org/foo?bar#baz\r\nhel'))
// p.end(b('lo server!'))
-module.exports = {
- MESSAGES,
- createParser,
-}
+module.exports = createRequestParser
diff --git a/lib/util.js b/lib/util.js
new file mode 100644
index 0000000..3d46bfb
--- /dev/null
+++ b/lib/util.js
@@ -0,0 +1,14 @@
+'use strict'
+
+// todo: clarify if ALPN is wanted & if this ID is correct
+const ALPN_ID = 'gemini'
+
+// https://gemini.circumlunar.space/docs/spec-spec.txt, 1.
+// > When Gemini is served over TCP/IP, servers should listen on port 1965
+// > (the first manned Gemini mission, Gemini 3, flew in March '65).
+const DEFAULT_PORT = 1965
+
+module.exports = {
+ ALPN_ID,
+ DEFAULT_PORT,
+}