Mercurial Hosting > luan
comparison src/goodjava/webserver/Connection.java @ 1607:fa066aaa068c
nginx caching
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 30 Apr 2021 20:23:28 -0600 |
parents | a0a74f5f490a |
children | a02a75e3daa8 |
comparison
equal
deleted
inserted
replaced
1606:7c7f28c724e8 | 1607:fa066aaa068c |
---|---|
112 String msg = e.toString(); | 112 String msg = e.toString(); |
113 if( contentType != null ) | 113 if( contentType != null ) |
114 msg = "invalid content for content-type " + contentType + "\n" + msg; | 114 msg = "invalid content for content-type " + contentType + "\n" + msg; |
115 response = Response.errorResponse(Status.BAD_REQUEST,msg); | 115 response = Response.errorResponse(Status.BAD_REQUEST,msg); |
116 } | 116 } |
117 response.headers.put("connection","close"); | 117 response.headers.put("Connection","close"); |
118 response.headers.put("content-length",Long.toString(response.body.length)); | 118 response.headers.put("Content-Length",Long.toString(response.body.length)); |
119 byte[] header = response.toHeaderString().getBytes(); | 119 byte[] header = response.toHeaderString().getBytes(); |
120 | 120 |
121 OutputStream out = socket.getOutputStream(); | 121 OutputStream out = socket.getOutputStream(); |
122 out.write(header); | 122 out.write(header); |
123 IoUtils.copyAll(response.body.content,out); | 123 IoUtils.copyAll(response.body.content,out); |