comparison src/goodjava/webserver/Connection.java @ 1801:32e77b071e09

webserver logging
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 12 Mar 2024 09:28:39 -0600
parents 6c01d54edcac
children
comparison
equal deleted inserted replaced
1800:a045f30fa67d 1801:32e77b071e09
67 RequestParser parser = new RequestParser(request); 67 RequestParser parser = new RequestParser(request);
68 parser.parseHead(); 68 parser.parseHead();
69 69
70 String lenStr = (String)request.headers.get("content-length"); 70 String lenStr = (String)request.headers.get("content-length");
71 if( lenStr != null ) { 71 if( lenStr != null ) {
72 int len = Integer.parseInt(lenStr); 72 int len;
73 try {
74 len = Integer.parseInt(lenStr);
75 } catch(NumberFormatException e) {
76 throw new WrappedRuntimeException(e);
77 }
73 byte[] body = new byte[len]; 78 byte[] body = new byte[len];
74 size -= endOfHeader; 79 size -= endOfHeader;
75 try { 80 try {
76 System.arraycopy(a,endOfHeader,body,0,size); 81 System.arraycopy(a,endOfHeader,body,0,size);
77 } catch(ArrayIndexOutOfBoundsException e) { 82 } catch(ArrayIndexOutOfBoundsException e) {