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.
This commit is contained in:
Haowei Wen 2020-08-25 23:28:50 +08:00
parent 3d3dd29f33
commit d72035a066
No known key found for this signature in database
GPG Key ID: 5BC167F73EA558E4

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 Haowei Wen <yushijinhun@gmail.com> and contributors
* Copyright (C) 2020 Haowei Wen <yushijinhun@gmail.com> 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;