diff --git a/core-server/server/server.js b/core-server/server/server.js index 8b4e9765d..3af2734f4 100644 --- a/core-server/server/server.js +++ b/core-server/server/server.js @@ -9,15 +9,14 @@ Serve tiddlers over http "use strict"; -let fs, url, path, querystring, crypto, zlib; +let fs, path, crypto, zlib, URL; if($tw.node) { fs = require("fs"), - url = require("url"), path = require("path"), - querystring = require("querystring"), crypto = require("crypto"), zlib = require("zlib"); + URL = require("url").URL; } /* @@ -260,8 +259,8 @@ Server.prototype.requestHandler = function(request,response,options) { state.wiki = options.wiki || self.wiki; state.boot = options.boot || self.boot; state.server = self; - state.urlInfo = url.parse(request.url); - state.queryParameters = querystring.parse(state.urlInfo.query); + state.urlInfo = new URL(request.url, "http://localhost"); + state.queryParameters = Object.fromEntries(state.urlInfo.searchParams); state.pathPrefix = options.pathPrefix || this.get("path-prefix") || ""; // Enable CORS if(this.corsEnable) { diff --git a/editions/tw5.com/tiddlers/releasenotes/5.5.0/#9742-node-dep0169-warning.tid b/editions/tw5.com/tiddlers/releasenotes/5.5.0/#9742-node-dep0169-warning.tid new file mode 100644 index 000000000..3b3315010 --- /dev/null +++ b/editions/tw5.com/tiddlers/releasenotes/5.5.0/#9742-node-dep0169-warning.tid @@ -0,0 +1,12 @@ +change-category: nodejs +change-type: bugfix +created: 20260711020057000 +description: The Node.js server no longer emits the DEP0169 url.parse() deprecation warning +github-contributors: pmario +github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9742 +release: 5.5.0 +tags: $:/tags/ChangeNote +title: $:/changenotes/5.5.0/#9742 +type: text/vnd.tiddlywiki + +* The server module parses request URLs with the WHATWG `URL` API instead of the deprecated `url.parse()`, so recent Node.js versions no longer print the DEP0169 deprecation warning on startup (fixes [[Issue #9628|https://github.com/TiddlyWiki/TiddlyWiki5/issues/9628]])