diff src/luan/webserver/Connection.java @ 1145:12ececf30597

webserver - minor
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 31 Jan 2018 01:43:50 -0700
parents ae0a048f3bc7
children 2dda3c92a473
line wrap: on
line diff
--- a/src/luan/webserver/Connection.java	Wed Jan 31 00:29:50 2018 -0700
+++ b/src/luan/webserver/Connection.java	Wed Jan 31 01:43:50 2018 -0700
@@ -79,12 +79,17 @@
 					request.body = new String(body);
 //System.out.println(request.body);
 				}
-	
-				if( request.method.equals("POST") ) {
+
+				String contentType = request.headers.get("Content-Type");
+				if( contentType != null ) {
 					if( request.body == null ) {
-						logger.error("post body is null");
+						logger.error("body is null");
 					} else {
-						parser.parsePost();
+						if( "application/x-www-form-urlencoded".equals(contentType) ) {
+							parser.parseUrlencoded();
+						} else {
+							logger.warn("unknown content type: "+contentType);
+						}
 					}
 				}
 			}