From d72035a06625e9d92c6a54e2310d76873ad20303 Mon Sep 17 00:00:00 2001 From: Haowei Wen Date: Tue, 25 Aug 2020 23:28:50 +0800 Subject: [PATCH] nanohttpd: reset parsedInputStream & continueSent between requests fix #83 bug description: if tcp keep-available is on, after processing a POST request, parsedInputStream's value is retained. if the next request is a GET request, HttpSession.getInputStream() will not return null as expected. --- .../authlibinjector/internal/fi/iki/elonen/NanoHTTPD.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/moe/yushi/authlibinjector/internal/fi/iki/elonen/NanoHTTPD.java b/src/main/java/moe/yushi/authlibinjector/internal/fi/iki/elonen/NanoHTTPD.java index 1b72490..f4a4aeb 100644 --- a/src/main/java/moe/yushi/authlibinjector/internal/fi/iki/elonen/NanoHTTPD.java +++ b/src/main/java/moe/yushi/authlibinjector/internal/fi/iki/elonen/NanoHTTPD.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Haowei Wen and contributors + * Copyright (C) 2020 Haowei Wen and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -397,11 +397,13 @@ public abstract class NanoHTTPD { } else /* if both are null */ { // no request payload + parsedInputStream = null; } expect100Continue = "HTTP/1.1".equals(protocolVersion) && "100-continue".equals(this.headers.get("expect")) && parsedInputStream != null; + continueSent = false; // Ok, now do the serve() this.isServing = true;