From 4cff64133e3423c94d38c62d4f336a2c30d5c404 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Mon, 24 May 2021 11:52:15 +0100 Subject: [PATCH] correct space check --- .../main/groovy/com/muwire/core/upload/UploadManager.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/groovy/com/muwire/core/upload/UploadManager.groovy b/core/src/main/groovy/com/muwire/core/upload/UploadManager.groovy index d3b0c17c..b127cae0 100644 --- a/core/src/main/groovy/com/muwire/core/upload/UploadManager.groovy +++ b/core/src/main/groovy/com/muwire/core/upload/UploadManager.groovy @@ -59,10 +59,10 @@ public class UploadManager { byte[] get = new byte[4] dis.readFully(get) if (get != "GET ".getBytes(StandardCharsets.US_ASCII)) { - if (get == "HEAD".getBytes(StandardCharsets.US_ASCII) && dis.readByte() == ' ') { + if (get == "HEAD".getBytes(StandardCharsets.US_ASCII) && dis.readByte() == (byte)32) { head = true } else { - log.warning("received a method other than GET on subsequent call") + log.warning("received a method other than GET or HEAD on subsequent call") e.close() return } @@ -219,7 +219,7 @@ public class UploadManager { dis.readFully(get) boolean head = false if (get != "GET ".getBytes(StandardCharsets.US_ASCII)) { - if (get == "HEAD".getBytes(StandardCharsets.US_ASCII) && dis.readByte() == ' ') { + if (get == "HEAD".getBytes(StandardCharsets.US_ASCII) && dis.readByte() == (byte)32) { head = true } else { log.warning("received a method other than GET or HEAD on subsequent call")