achieve-http-server 3.1.4 → 3.1.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## Achieve 3.1.5 (2026-12-06)
4
+
5
+ - Delegated HTTP/1.x CONNECT to application listeners on the native Node.js
6
+ servers returned by `listen()` and `slisten()`. Achieve no longer sends its
7
+ built-in CONNECT rejection. `registerMethod()` continues to reject CONNECT,
8
+ with a diagnostic that explains the server event. HTTP/2 handling is unchanged.
9
+
3
10
  ## Achieve 3.1.2
4
11
 
5
12
  - Optimized eligible static-file resolution with a descriptor-first path,
package/README.md CHANGED
@@ -168,6 +168,14 @@ exports.servlet = function (session) {
168
168
 
169
169
  <p>See the <a href="https://highlevellogic.github.io/achieve/reference/methods.htm">HTTP Methods Reference</a>.</p>
170
170
 
171
+ ### HTTP/1.x CONNECT
172
+
173
+ The independent [achieve-proxy](https://www.npmjs.com/package/achieve-proxy) module adds HTTP CONNECT tunneling with programmable authentication and authorization to Achieve's ready-to-use HTTP or HTTPS server.
174
+
175
+ Beginning with Achieve 3.1.5, `listen()` and `slisten()` return native Node.js server objects without an installed CONNECT listener, allowing `achieve-proxy` or another application-provided handler to attach directly to the server's `connect` event.
176
+
177
+ CONNECT bypasses ordinary Servlet routing and cannot be registered through `registerMethod()`. Neither package requires the other.
178
+
171
179
  <h2><a id="server-logging-and-diagnostics" name="server-logging-and-diagnostics"></a>Server logging and diagnostics</h2>
172
180
 
173
181
  <p>Achieve displays startup and configuration information on the console. In development mode, it also provides diagnostic information when managed requests encounter errors. Production mode suppresses these developer-oriented request diagnostics.</p>
package/achieve.js CHANGED
@@ -533,12 +533,19 @@ exports.setPathMap = function (configured) {
533
533
  if (pathMap === undefined) pathMap=new Map();
534
534
  for (let [publicPath,targetPath] of validated) pathMap.set(publicPath,targetPath);
535
535
  };
536
- const achieveOwnedMethods = new Set(["GET","HEAD","POST","OPTIONS","CONNECT"]);
536
+ const achieveOwnedMethods = new Set(["GET","HEAD","POST","OPTIONS"]);
537
537
  const advertisedBuiltInMethods = ["GET","HEAD","POST","OPTIONS"];
538
538
  const httpTokenPattern = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
539
539
  exports.registerMethod = function (method,servletPath) {
540
540
  if (typeof method !== "string" || method.length === 0) throw new TypeError("registerMethod() requires a nonempty method string.");
541
541
  if (!httpTokenPattern.test(method)) throw new TypeError("registerMethod() requires a valid HTTP method token.");
542
+ if (method.toUpperCase() === "CONNECT") {
543
+ throw new RangeError(
544
+ "CONNECT cannot be registered as a servlet method. " +
545
+ "Node.js handles CONNECT through a separate server event. " +
546
+ "Consider using achieve-proxy instead."
547
+ );
548
+ }
542
549
  if (achieveOwnedMethods.has(method.toUpperCase())) throw new RangeError(method + " is implemented by Achieve and cannot be registered.");
543
550
  if (registeredMethods.has(method)) throw new RangeError(method + " is already registered.");
544
551
  if (typeof servletPath !== "string" || servletPath.length === 0) throw new TypeError("registerMethod() requires a nonempty servlet path string.");
@@ -1549,7 +1556,7 @@ exports.slisten = function (ioptions) {
1549
1556
  if (!initializeLogging()) return;
1550
1557
 
1551
1558
  server = https.createServer(ioptions, achieveApp);
1552
- handleConnectRequests(server);
1559
+ // Since 3.1.5, application-provided Node.js connect listeners handle HTTP/1.x CONNECT.
1553
1560
  attachStartupLogging(server,"https",sport);
1554
1561
  server.listen(sport);
1555
1562
  displayMimeTypes();
@@ -1584,7 +1591,7 @@ exports.listen = function (port) {
1584
1591
  if (!initializeLogging()) return;
1585
1592
 
1586
1593
  server = http.createServer(achieveApp);
1587
- handleConnectRequests(server);
1594
+ // Since 3.1.5, application-provided Node.js connect listeners handle HTTP/1.x CONNECT.
1588
1595
  attachStartupLogging(server,"http",port);
1589
1596
  server.listen(port);
1590
1597
  displayMimeTypes();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "achieve-http-server",
3
- "version": "3.1.4",
3
+ "version": "3.1.5",
4
4
  "description": "A ready-to-use Node.js HTTP server for static and dynamic content, a.k.a. achieve.",
5
5
  "main": "./achieve.js",
6
6
  "exports": "./achieve.js",