diff src/luan/webserver/Connection.java @ 1147:30d87b7d1d62

webserver - support multipart/form-data
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 01 Feb 2018 22:06:37 -0700
parents 2dda3c92a473
children 49fb4e83484f
line wrap: on
line diff
--- a/src/luan/webserver/Connection.java	Thu Feb 01 03:08:21 2018 -0700
+++ b/src/luan/webserver/Connection.java	Thu Feb 01 22:06:37 2018 -0700
@@ -76,8 +76,8 @@
 						}
 						size += n;
 					}
-					request.body = new String(body);
-//System.out.println(request.body);
+					request.body = body;
+//System.out.println(new String(request.body));
 				}
 
 				String contentType = (String)request.headers.get("Content-Type");
@@ -87,8 +87,10 @@
 					} else {
 						if( "application/x-www-form-urlencoded".equals(contentType) ) {
 							parser.parseUrlencoded();
+						} else if( contentType.startsWith("multipart/form-data;") ) {
+							parser.parseMultipart();
 						} else {
-							logger.warn("unknown content type: "+contentType);
+							logger.error("unknown content type: "+contentType);
 						}
 					}
 				}