Mercurial Hosting > luan
diff src/goodjava/webserver/Response.java @ 1607:fa066aaa068c
nginx caching
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 30 Apr 2021 20:23:28 -0600 |
parents | ef9d96aeb541 |
children |
line wrap: on
line diff
--- a/src/goodjava/webserver/Response.java Tue Apr 20 18:06:50 2021 -0600 +++ b/src/goodjava/webserver/Response.java Fri Apr 30 20:23:28 2021 -0600 @@ -6,14 +6,15 @@ import java.util.LinkedHashMap; import java.util.Collections; import java.util.List; +import goodjava.util.CaseInsensitiveMap; public class Response { public final String protocol = "HTTP/1.1"; public volatile Status status = Status.OK; - public final Map<String,Object> headers = Collections.synchronizedMap(new LinkedHashMap<String,Object>()); + public final Map<String,Object> headers = Collections.synchronizedMap(new CaseInsensitiveMap<Object>(new LinkedHashMap<String,CaseInsensitiveMap.Value<Object>>())); { - headers.put("server","goodjava"); + headers.put("Server","goodjava"); } private static final Body empty = new Body(0,new InputStream(){ public int read() { return -1; } @@ -76,7 +77,7 @@ public static Response errorResponse(Status status,String text) { Response response = new Response(); response.status = status; - response.headers.put( "content-type", "text/plain; charset=utf-8" ); + response.headers.put( "Content-Type", "text/plain; charset=utf-8" ); PrintWriter writer = new PrintWriter( new ResponseOutputStream(response) ); writer.write( text ); writer.close();