Skip to content

Commit

Permalink
refactor: change URL max length to 8000
Browse files Browse the repository at this point in the history
The previous limit of 2000 characters was a bit too low in certain cases.

From https://www.rfc-editor.org/rfc/rfc9110#section-4.1-5

> It is RECOMMENDED that all senders and recipients support, at a minimum, URIs with lengths of 8000 octets in protocol elements.

Related: #715

See also: 707597d
  • Loading branch information
darrachequesne committed Apr 23, 2024
1 parent b11763b commit 62cbed7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/contrib/parseuri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const parts = [
];

export function parse(str: string) {
if (str.length > 2000) {
if (str.length > 8000) {
throw "URI too long";
}

Expand Down
2 changes: 1 addition & 1 deletion test/parseuri.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ describe("parseuri", function () {
expect(relativeWithQuery.path).to.be("/foo");
expect(relativeWithQuery.query).to.be("bar=@example.com");

expect(() => parseuri(repeat("a", 2001))).to.throwError("URI too long");
expect(() => parseuri(repeat("a", 8001))).to.throwError("URI too long");
});
});

0 comments on commit 62cbed7

Please sign in to comment.