correct space check

head-request
Zlatin Balevsky 2021-05-24 11:52:15 +01:00
parent a584f16ce4
commit 4cff64133e
No known key found for this signature in database
GPG Key ID: A72832072D525E41
1 changed files with 3 additions and 3 deletions

View File

@ -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")