2828import static com .predic8 .membrane .core .http .Header .*;
2929import static com .predic8 .membrane .core .http .MimeType .*;
3030import static java .nio .charset .StandardCharsets .*;
31-
3231public class Request extends Message {
3332
3433 private static final Pattern pattern = Pattern .compile ("(.+?) (.+?) HTTP/(.+?)$" );
@@ -46,17 +45,6 @@ public class Request extends Message {
4645 public static final String METHOD_OPTIONS = "OPTIONS" ;
4746
4847 private static final HashSet <String > methodsWithoutBody = Sets .newHashSet (METHOD_GET , METHOD_HEAD , METHOD_CONNECT );
49- private static final HashSet <String > methodsWithOptionalBody = Sets .newHashSet (
50- METHOD_DELETE ,
51- /* some WebDAV methods, see http://www.ietf.org/rfc/rfc2518.txt */
52- METHOD_OPTIONS ,
53- "PROPFIND" ,
54- "MKCOL" ,
55- "COPY" ,
56- "MOVE" ,
57- "LOCK" ,
58- "UNLOCK" );
59-
6048
6149 String method ;
6250 String uri ;
@@ -154,15 +142,13 @@ public String getName() {
154142
155143 @ Override
156144 public boolean shouldNotContainBody () {
157- if (methodsWithoutBody .contains (method ))
145+ if (methodsWithoutBody .contains (method )) // GET, HEAD, CONNECT
158146 return true ;
159- if (methodsWithOptionalBody .contains (method )) {
160- if (header .hasContentLength ())
161- return header .getContentLength () == 0 ;
162- return header .getFirstValue (TRANSFER_ENCODING ) == null ;
163- }
164-
165- return false ;
147+ if (isHTTP10 ())
148+ return false ;
149+ if (header .hasContentLength ())
150+ return header .getContentLength () == 0 ;
151+ return header .getFirstValue (TRANSFER_ENCODING ) == null ;
166152 }
167153
168154 /**
0 commit comments