Mercurial Hosting > luan
comparison src/luan/webserver/Connection.java @ 1146:2dda3c92a473
webserver - implement cookies
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 01 Feb 2018 03:08:21 -0700 |
parents | 12ececf30597 |
children | 30d87b7d1d62 |
comparison
equal
deleted
inserted
replaced
1145:12ececf30597 | 1146:2dda3c92a473 |
---|---|
61 //System.out.println(rawHead); | 61 //System.out.println(rawHead); |
62 request.rawHead = rawHead; | 62 request.rawHead = rawHead; |
63 RequestParser parser = new RequestParser(request); | 63 RequestParser parser = new RequestParser(request); |
64 parser.parseHead(); | 64 parser.parseHead(); |
65 | 65 |
66 String lenStr = request.headers.get("Content-Length"); | 66 String lenStr = (String)request.headers.get("Content-Length"); |
67 if( lenStr != null ) { | 67 if( lenStr != null ) { |
68 int len = Integer.parseInt(lenStr); | 68 int len = Integer.parseInt(lenStr); |
69 byte[] body = new byte[len]; | 69 byte[] body = new byte[len]; |
70 size -= endOfHeader; | 70 size -= endOfHeader; |
71 System.arraycopy(a,endOfHeader,body,0,size); | 71 System.arraycopy(a,endOfHeader,body,0,size); |
78 } | 78 } |
79 request.body = new String(body); | 79 request.body = new String(body); |
80 //System.out.println(request.body); | 80 //System.out.println(request.body); |
81 } | 81 } |
82 | 82 |
83 String contentType = request.headers.get("Content-Type"); | 83 String contentType = (String)request.headers.get("Content-Type"); |
84 if( contentType != null ) { | 84 if( contentType != null ) { |
85 if( request.body == null ) { | 85 if( request.body == null ) { |
86 logger.error("body is null"); | 86 logger.error("body is null"); |
87 } else { | 87 } else { |
88 if( "application/x-www-form-urlencoded".equals(contentType) ) { | 88 if( "application/x-www-form-urlencoded".equals(contentType) ) { |