()
| 585 | |
| 586 | |
| 587 | final boolean receivedEndOfHeaders() throws StreamException { |
| 588 | boolean missingHeader = false; |
| 589 | |
| 590 | if (coyoteRequest.getMethod() == null) { |
| 591 | missingHeader = true; |
| 592 | } else if (Method.CONNECT.equals(coyoteRequest.getMethod())) { |
| 593 | // CONNECT only |
| 594 | if (!coyoteRequest.scheme().isNull() || !coyoteRequest.requestURI().isNull()) { |
| 595 | throw new StreamException( |
| 596 | sm.getString("stream.header.invalidConnect", getConnectionId(), getIdAsString()), |
| 597 | Http2Error.PROTOCOL_ERROR, getIdAsInt()); |
| 598 | } |
| 599 | if (coyoteRequest.serverName().isNull()) { |
| 600 | missingHeader = true; |
| 601 | } |
| 602 | } else { |
| 603 | // All other methods |
| 604 | if (coyoteRequest.scheme().isNull() || coyoteRequest.requestURI().isNull()) { |
| 605 | missingHeader = true; |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | if (missingHeader) { |
| 610 | throw new StreamException(sm.getString("stream.header.required", getConnectionId(), getIdAsString()), |
| 611 | Http2Error.PROTOCOL_ERROR, getIdAsInt()); |
| 612 | } |
| 613 | |
| 614 | // Cookie headers need to be concatenated into a single header |
| 615 | // See RFC 7540 8.1.2.5 |
| 616 | // Can only do this once the headers are fully received |
| 617 | if (cookieHeader != null) { |
| 618 | coyoteRequest.getMimeHeaders().addValue("cookie").setString(cookieHeader.toString()); |
| 619 | } |
| 620 | return headerState == HEADER_STATE_REGULAR || headerState == HEADER_STATE_PSEUDO; |
| 621 | } |
| 622 | |
| 623 | |
| 624 | final void writeHeaders() throws IOException { |
no test coverage detected