You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-5Lines changed: 11 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,9 @@
2
2
3
3
**NOTE:** This project is in progress.
4
4
5
-
The goal of this project is to build a full-featured HTTP server and client in plain Java without the use of any libraries. The general
6
-
requirements and roadmap are as follows:
5
+
The goal of this project is to build a full-featured HTTP server and client in plain Java without the use of any libraries. The client and server will use non-blocking NIO in order to provide the highest performance possible.
6
+
7
+
The general requirements and roadmap are as follows:
7
8
8
9
### Server tasks
9
10
@@ -18,13 +19,15 @@ requirements and roadmap are as follows:
18
19
*[x] Clean up HTTPRequest
19
20
*[x] Support form data
20
21
*[x] Support multipart form data
22
+
*[x] Support TLS
21
23
*[ ] Support trailers
22
24
*[ ] Support HTTP 2
23
25
24
26
### Client tasks
25
27
26
28
*[ ] Basic HTTP 1.1
27
29
*[ ] Support Keep-Alive
30
+
*[ ] Support TLS
28
31
*[ ] Support HTTP 2
29
32
*[ ] Support Expect-Continue 100
30
33
*[ ] Support chunked request and response
@@ -37,6 +40,7 @@ requirements and roadmap are as follows:
logger.debug("Accepted connection from client [{}]", client.getRemoteAddress().toString());
184
+
} catch (IOExceptione) {
185
+
/// Ignore because we are just debugging
186
+
}
187
+
}
188
+
175
189
if (instrumenter != null) {
176
190
instrumenter.acceptedConnection();
177
191
}
178
192
}
179
193
180
194
privatevoidcancelAndCloseKey(SelectionKeykey) {
181
195
if (key != null) {
182
-
try (varignore = key.channel()) {
196
+
try (varclient = key.channel()) {
197
+
if (logger.isDebuggable() && clientinstanceofSocketChannelsocketChannel) {
198
+
logger.debug("Closing connection to client [{}]", socketChannel.getRemoteAddress().toString());
199
+
}
200
+
183
201
key.cancel();
184
202
} catch (Throwablet) {
185
203
logger.error("An exception was thrown while trying to cancel a SelectionKey and close a channel with a client due to an exception being thrown for that specific client. Enable debug logging to see the error", t);
@@ -197,10 +215,12 @@ private void cleanup() {
197
215
.filter(key -> ((HTTPProcessor) key.attachment()).lastUsed() < now - clientTimeout.toMillis())
198
216
.forEach(key -> {
199
217
varclient = (SocketChannel) key.channel();
200
-
try {
201
-
logger.debug("Closing client connection [{}] due to inactivity", client.getRemoteAddress().toString());
202
-
} catch (IOExceptione) {
203
-
// Ignore because we are just debugging
218
+
if (logger.isDebuggable()) {
219
+
try {
220
+
logger.debug("Closing client connection [{}] due to inactivity", client.getRemoteAddress().toString());
0 commit comments