public HttpMessage parse() throws IOException, HttpException { HttpMessage message = null; try { message = parseHead(this.sessionBuffer); } catch (ParseException px) { throw new ProtocolException(px.getMessage(), px); } Header[] headers = AbstractMessageParser.parseHeaders( this.sessionBuffer, this.maxHeaderCount, this.maxLineLen, this.lineParser); message.setHeaders(headers); return message; }
/** * Reads and stores the Trailer headers. * @throws IOException If an IO problem occurs */ private void parseTrailerHeaders() throws IOException { try { this.footers = AbstractMessageParser.parseHeaders (in, -1, -1, null); } catch (HttpException e) { IOException ioe = new MalformedChunkCodingException("Invalid footer: " + e.getMessage()); ExceptionUtils.initCause(ioe, e); throw ioe; } }
/** * Reads and stores the Trailer headers. * @throws IOException in case of an I/O error */ private void parseTrailerHeaders() throws IOException { try { this.footers = AbstractMessageParser.parseHeaders(in, constraints.getMaxHeaderCount(), constraints.getMaxLineLength(), null); } catch (final HttpException ex) { final IOException ioe = new MalformedChunkCodingException("Invalid footer: " + ex.getMessage()); ioe.initCause(ex); throw ioe; } }
public HttpMessage parse() throws IOException, HttpException { HttpMessage message = null; try { message = parseHead(this.sessionBuffer); } catch (ParseException px) { throw new ProtocolException(px.getMessage(), px); } Header[] headers = AbstractMessageParser.parseHeaders( this.sessionBuffer, this.maxHeaderCount, this.maxLineLen, this.lineParser); message.setHeaders(headers); return message; }
/** * Parses HTTP headers from the data receiver stream according to the generic * format as given in Section 3.1 of RFC 822, RFC-2616 Section 4 and 19.3. * * @param inbuffer Session input buffer * @param maxHeaderCount maximum number of headers allowed. If the number * of headers received from the data stream exceeds maxCount value, an * IOException will be thrown. Setting this parameter to a negative value * or zero will disable the check. * @param maxLineLen maximum number of characters for a header line, * including the continuation lines. Setting this parameter to a negative * value or zero will disable the check. * @return array of HTTP headers * @param parser line parser to use. Can be {@code null}, in which case * the default implementation of this interface will be used. * * @throws IOException in case of an I/O error * @throws HttpException in case of HTTP protocol violation */ public static Header[] parseHeaders( final SessionInputBuffer inbuffer, final int maxHeaderCount, final int maxLineLen, final LineParser parser) throws HttpException, IOException { final List<CharArrayBuffer> headerLines = new ArrayList<CharArrayBuffer>(); return parseHeaders(inbuffer, maxHeaderCount, maxLineLen, parser != null ? parser : BasicLineParser.INSTANCE, headerLines); }
public HttpMessage parse() throws IOException, HttpException { HttpMessage message = null; try { message = parseHead(this.sessionBuffer); } catch (ParseException px) { throw new ProtocolException(px.getMessage(), px); } Header[] headers = AbstractMessageParser.parseHeaders( this.sessionBuffer, this.maxHeaderCount, this.maxLineLen, this.lineParser); message.setHeaders(headers); return message; }
/** * Parses HTTP headers from the data receiver stream according to the generic * format as given in Section 3.1 of RFC 822, RFC-2616 Section 4 and 19.3. * * @param inbuffer Session input buffer * @param maxHeaderCount maximum number of headers allowed. If the number * of headers received from the data stream exceeds maxCount value, an * IOException will be thrown. Setting this parameter to a negative value * or zero will disable the check. * @param maxLineLen maximum number of characters for a header line, * including the continuation lines. Setting this parameter to a negative * value or zero will disable the check. * @return array of HTTP headers * @param parser line parser to use. Can be {@code null}, in which case * the default implementation of this interface will be used. * * @throws IOException in case of an I/O error * @throws HttpException in case of HTTP protocol violation */ public static Header[] parseHeaders( final SessionInputBuffer inbuffer, final int maxHeaderCount, final int maxLineLen, final LineParser parser) throws HttpException, IOException { final List<CharArrayBuffer> headerLines = new ArrayList<CharArrayBuffer>(); return parseHeaders(inbuffer, maxHeaderCount, maxLineLen, parser != null ? parser : BasicLineParser.INSTANCE, headerLines); }
public HttpMessage parse() throws IOException, HttpException { HttpMessage message = null; try { message = parseHead(this.sessionBuffer); } catch (ParseException px) { throw new ProtocolException(px.getMessage(), px); } Header[] headers = AbstractMessageParser.parseHeaders( this.sessionBuffer, this.maxHeaderCount, this.maxLineLen, this.lineParser); message.setHeaders(headers); return message; }
/** * Parses HTTP headers from the data receiver stream according to the generic * format as given in Section 3.1 of RFC 822, RFC-2616 Section 4 and 19.3. * * @param inbuffer Session input buffer * @param maxHeaderCount maximum number of headers allowed. If the number * of headers received from the data stream exceeds maxCount value, an * IOException will be thrown. Setting this parameter to a negative value * or zero will disable the check. * @param maxLineLen maximum number of characters for a header line, * including the continuation lines. Setting this parameter to a negative * value or zero will disable the check. * @return array of HTTP headers * @param parser line parser to use. Can be <code>null</code>, in which case * the default implementation of this interface will be used. * * @throws IOException in case of an I/O error * @throws HttpException in case of HTTP protocol violation */ public static Header[] parseHeaders( final SessionInputBuffer inbuffer, final int maxHeaderCount, final int maxLineLen, final LineParser parser) throws HttpException, IOException { final List<CharArrayBuffer> headerLines = new ArrayList<CharArrayBuffer>(); return parseHeaders(inbuffer, maxHeaderCount, maxLineLen, parser != null ? parser : BasicLineParser.INSTANCE, headerLines); }
public HttpMessage parse() throws IOException, HttpException { HttpMessage message = null; try { message = parseHead(this.sessionBuffer); } catch (ParseException px) { throw new ProtocolException(px.getMessage(), px); } Header[] headers = AbstractMessageParser.parseHeaders( this.sessionBuffer, this.maxHeaderCount, this.maxLineLen, this.lineParser); message.setHeaders(headers); return message; }
/** * Parses HTTP headers from the data receiver stream according to the generic * format as given in Section 3.1 of RFC 822, RFC-2616 Section 4 and 19.3. * * @param inbuffer Session input buffer * @param maxHeaderCount maximum number of headers allowed. If the number * of headers received from the data stream exceeds maxCount value, an * IOException will be thrown. Setting this parameter to a negative value * or zero will disable the check. * @param maxLineLen maximum number of characters for a header line, * including the continuation lines. Setting this parameter to a negative * value or zero will disable the check. * @return array of HTTP headers * @param parser line parser to use. Can be {@code null}, in which case * the default implementation of this interface will be used. * * @throws IOException in case of an I/O error * @throws HttpException in case of HTTP protocol violation */ public static Header[] parseHeaders( final SessionInputBuffer inbuffer, final int maxHeaderCount, final int maxLineLen, final LineParser parser) throws HttpException, IOException { final List<CharArrayBuffer> headerLines = new ArrayList<CharArrayBuffer>(); return parseHeaders(inbuffer, maxHeaderCount, maxLineLen, parser != null ? parser : BasicLineParser.INSTANCE, headerLines); }
@Override public T parse() throws IOException, HttpException { final int st = this.state; switch (st) { case HEAD_LINE: try { this.message = parseHead(this.sessionBuffer); } catch (final ParseException px) { throw new ProtocolException(px.getMessage(), px); } this.state = HEADERS; //$FALL-THROUGH$ case HEADERS: final Header[] headers = AbstractMessageParser.parseHeaders( this.sessionBuffer, this.messageConstraints.getMaxHeaderCount(), this.messageConstraints.getMaxLineLength(), this.lineParser, this.headerLines); this.message.setHeaders(headers); final T result = this.message; this.message = null; this.headerLines.clear(); this.state = HEAD_LINE; return result; default: throw new IllegalStateException("Inconsistent parser state"); } }
/** * Parses HTTP headers from the data receiver stream according to the generic * format as given in Section 3.1 of RFC 822, RFC-2616 Section 4 and 19.3. * * @param inbuffer Session input buffer * @param maxHeaderCount maximum number of headers allowed. If the number * of headers received from the data stream exceeds maxCount value, an * IOException will be thrown. Setting this parameter to a negative value * or zero will disable the check. * @param maxLineLen maximum number of characters for a header line, * including the continuation lines. Setting this parameter to a negative * value or zero will disable the check. * @return array of HTTP headers * @param parser line parser to use. Can be {@code null}, in which case * the default implementation of this interface will be used. * * @throws IOException in case of an I/O error * @throws HttpException in case of HTTP protocol violation */ public static Header[] parseHeaders( final SessionInputBuffer inbuffer, final int maxHeaderCount, final int maxLineLen, final LineParser parser) throws HttpException, IOException { final List<CharArrayBuffer> headerLines = new ArrayList<CharArrayBuffer>(); return parseHeaders(inbuffer, maxHeaderCount, maxLineLen, parser != null ? parser : BasicLineParser.INSTANCE, headerLines); }
@Override public T parse() throws IOException, HttpException { final int st = this.state; switch (st) { case HEAD_LINE: try { this.message = parseHead(this.sessionBuffer); } catch (final ParseException px) { throw new ProtocolException(px.getMessage(), px); } this.state = HEADERS; //$FALL-THROUGH$ case HEADERS: final Header[] headers = AbstractMessageParser.parseHeaders( this.sessionBuffer, this.messageConstraints.getMaxHeaderCount(), this.messageConstraints.getMaxLineLength(), this.lineParser, this.headerLines); this.message.setHeaders(headers); final T result = this.message; this.message = null; this.headerLines.clear(); this.state = HEAD_LINE; return result; default: throw new IllegalStateException("Inconsistent parser state"); } }
/** * Reads and stores the Trailer headers. * @throws IOException in case of an I/O error */ private void parseTrailerHeaders() throws IOException { try { this.footers = AbstractMessageParser.parseHeaders (in, -1, -1, null); } catch (final HttpException ex) { final IOException ioe = new MalformedChunkCodingException("Invalid footer: " + ex.getMessage()); ioe.initCause(ex); throw ioe; } }
public T parse() throws IOException, HttpException { final int st = this.state; switch (st) { case HEAD_LINE: try { this.message = parseHead(this.sessionBuffer); } catch (final ParseException px) { throw new ProtocolException(px.getMessage(), px); } this.state = HEADERS; //$FALL-THROUGH$ case HEADERS: final Header[] headers = AbstractMessageParser.parseHeaders( this.sessionBuffer, this.messageConstraints.getMaxHeaderCount(), this.messageConstraints.getMaxLineLength(), this.lineParser, this.headerLines); this.message.setHeaders(headers); final T result = this.message; this.message = null; this.headerLines.clear(); this.state = HEAD_LINE; return result; default: throw new IllegalStateException("Inconsistent parser state"); } }
/** * Reads and stores the Trailer headers. * @throws IOException If an IO problem occurs */ private void parseTrailerHeaders() throws IOException { try { this.footers = AbstractMessageParser.parseHeaders (in, -1, -1, null); } catch (HttpException e) { IOException ioe = new MalformedChunkCodingException("Invalid footer: " + e.getMessage()); ExceptionUtils.initCause(ioe, e); throw ioe; } }
@Override public T parse() throws IOException, HttpException { final int st = this.state; switch (st) { case HEAD_LINE: try { this.message = parseHead(this.sessionBuffer); } catch (final ParseException px) { throw new ProtocolException(px.getMessage(), px); } this.state = HEADERS; //$FALL-THROUGH$ case HEADERS: final Header[] headers = AbstractMessageParser.parseHeaders( this.sessionBuffer, this.messageConstraints.getMaxHeaderCount(), this.messageConstraints.getMaxLineLength(), this.lineParser, this.headerLines); this.message.setHeaders(headers); final T result = this.message; this.message = null; this.headerLines.clear(); this.state = HEAD_LINE; return result; default: throw new IllegalStateException("Inconsistent parser state"); } }
/** * Reads and stores the Trailer headers. * @throws IOException If an IO problem occurs */ private void parseTrailerHeaders() throws IOException { try { this.footers = AbstractMessageParser.parseHeaders (in, -1, -1, null); } catch (HttpException e) { IOException ioe = new MalformedChunkCodingException("Invalid footer: " + e.getMessage()); ExceptionUtils.initCause(ioe, e); throw ioe; } }
@Override public T parse() throws IOException, HttpException { final int st = this.state; switch (st) { case HEAD_LINE: try { this.message = parseHead(this.sessionBuffer); } catch (final ParseException px) { throw new ProtocolException(px.getMessage(), px); } this.state = HEADERS; //$FALL-THROUGH$ case HEADERS: final Header[] headers = AbstractMessageParser.parseHeaders( this.sessionBuffer, this.messageConstraints.getMaxHeaderCount(), this.messageConstraints.getMaxLineLength(), this.lineParser, this.headerLines); this.message.setHeaders(headers); final T result = this.message; this.message = null; this.headerLines.clear(); this.state = HEAD_LINE; return result; default: throw new IllegalStateException("Inconsistent parser state"); } }