/** * Parse one HTTP request or response * @param rawHTTP Raw HTTP to parse * @return Any unparsed data in the rawHTTP (eg pipelined requests) * @throws IOException */ public String parse(String rawHTTP) throws IOException { _charset = _defaultCharset; ByteArrayBuffer buf = new ByteArrayBuffer(getByteArray(rawHTTP)); View view = new View(buf); HttpParser parser = new HttpParser(view,new PH()); parser.parse(); return getString(view.asArray()); }
/** * Parse one HTTP request or response * @param rawHTTP Raw HTTP to parse * @return Any unparsed data in the rawHTTP (eg pipelined requests) * @throws IOException */ public byte[] parse(byte[] rawHTTP, boolean isHeadResponse) throws IOException { _charset = _defaultCharset; ByteArrayBuffer buf = new ByteArrayBuffer(rawHTTP); View view = new View(buf); PH ph = new PH(); HttpParser parser = new HttpParser(view,ph); parser.setHeadResponse(isHeadResponse); parser.parse(); if (ph.isEarlyEOF()) throw new EofException(); return view.asArray(); }
/** * Parse one HTTP request or response * @param rawHTTP Raw HTTP to parse * @return Any unparsed data in the rawHTTP (eg pipelined requests) * @throws IOException */ public String parse(String rawHTTP, boolean isHeadResponse) throws IOException { _charset = _defaultCharset; ByteArrayBuffer buf = new ByteArrayBuffer(getByteArray(rawHTTP)); View view = new View(buf); PH ph = new PH(); HttpParser parser = new HttpParser(view,ph); parser.setHeadResponse(isHeadResponse); parser.parse(); if (ph.isEarlyEOF()) throw new EofException(); return getString(view.asArray()); }