From 45ca1e0f8483f67513be9c4e783322977199f07c Mon Sep 17 00:00:00 2001 From: Haowei Wen Date: Mon, 2 May 2022 22:30:37 +0800 Subject: [PATCH] optimize url matching --- .../java/moe/yushi/authlibinjector/httpd/URLProcessor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/moe/yushi/authlibinjector/httpd/URLProcessor.java b/src/main/java/moe/yushi/authlibinjector/httpd/URLProcessor.java index cbe0538..9de18f3 100644 --- a/src/main/java/moe/yushi/authlibinjector/httpd/URLProcessor.java +++ b/src/main/java/moe/yushi/authlibinjector/httpd/URLProcessor.java @@ -68,6 +68,10 @@ public class URLProcessor { * @return the transformed URL, or empty if it doesn't need to be transformed */ public Optional transformURL(String inputUrl) { + if (!inputUrl.startsWith("http")) { + // fast path + return Optional.empty(); + } Matcher matcher = URL_REGEX.matcher(inputUrl); if (!matcher.find()) { return Optional.empty();