Issue #752 SETTINGS_MAX_HEADER_LIST_SIZE

Defined missing status codes (removed old/wrong javadoc)
Changed use of 413 to 431
Received SETTINGS_MAX_HEADER_LIST_SIZE is set on hpack encoded and warning generated only for large responses.
This commit is contained in:
Greg Wilkins 2016-07-23 12:15:56 +10:00
parent d8c8ad31c9
commit e53ea55f48
13 changed files with 82 additions and 729 deletions

View File

@ -601,7 +601,7 @@ public class HttpParser
if (_state==State.URI)
{
LOG.warn("URI is too large >"+_maxHeaderBytes);
throw new BadMessageException(HttpStatus.REQUEST_URI_TOO_LONG_414);
throw new BadMessageException(HttpStatus.URI_TOO_LONG_414);
}
else
{
@ -609,7 +609,7 @@ public class HttpParser
LOG.warn("request is too large >"+_maxHeaderBytes);
else
LOG.warn("response is too large >"+_maxHeaderBytes);
throw new BadMessageException(HttpStatus.REQUEST_ENTITY_TOO_LARGE_413);
throw new BadMessageException(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE_431);
}
}
@ -983,7 +983,7 @@ public class HttpParser
if (_maxHeaderBytes>0 && ++_headerBytes>_maxHeaderBytes)
{
LOG.warn("Header is too large >"+_maxHeaderBytes);
throw new BadMessageException(HttpStatus.REQUEST_ENTITY_TOO_LARGE_413);
throw new BadMessageException(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE_431);
}
switch (_state)

View File

@ -20,608 +20,9 @@ package org.eclipse.jetty.http;
/**
* <p>
* HttpStatusCode enum class, for status codes based on various HTTP RFCs. (see
* table below)
* Http Status Codes
* </p>
*
* <table border="1" cellpadding="5">
* <caption>HTTP Status Codes Table</caption>
* <tr>
* <th>Enum</th>
* <th>Code</th>
* <th>Message</th>
* <th>
* <a href="http://tools.ietf.org/html/rfc1945">RFC 1945 - HTTP/1.0</a></th>
* <th>
* <a href="http://tools.ietf.org/html/rfc7231">RFC 7231 - HTTP/1.1 Semantics and Content</a></th>
* <th>
* <a href="http://tools.ietf.org/html/rfc7238">RFC 7238 - HTTP/1.1 Permanent Redirect</a></th>
* <th>
* <a href="http://tools.ietf.org/html/rfc2518">RFC 2518 - WEBDAV</a></th>
* </tr>
*
* <tr>
* <td><strong><code>Informational - 1xx</code></strong></td>
* <td colspan="5">{@link #isInformational(int)}</td>
* </tr>
*
* <tr>
* <td>{@link #CONTINUE_100}</td>
* <td>100</td>
* <td>Continue</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.2.1">Sec. 6.2.1</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #SWITCHING_PROTOCOLS_101}</td>
* <td>101</td>
* <td>Switching Protocols</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.2.2">Sec. 6.2.2</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #PROCESSING_102}</td>
* <td>102</td>
* <td>Processing</td>
* <td>&nbsp;</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc2518#section-10.1">Sec. 10.1</a></td>
* </tr>
*
* <tr>
* <td><strong><code>Success - 2xx</code></strong></td>
* <td colspan="5">{@link #isSuccess(int)}</td>
* </tr>
*
* <tr>
* <td>{@link #OK_200}</td>
* <td>200</td>
* <td>OK</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.2">Sec. 9.2</a></td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.3.1">Sec. 6.3.1</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #CREATED_201}</td>
* <td>201</td>
* <td>Created</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.2">Sec. 9.2</a></td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.3.2">Sec. 6.3.2</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #ACCEPTED_202}</td>
* <td>202</td>
* <td>Accepted</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.2">Sec. 9.2</a></td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.3.3">Sec. 6.3.3</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #NON_AUTHORITATIVE_INFORMATION_203}</td>
* <td>203</td>
* <td>Non Authoritative Information</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.3.4">Sec. 6.3.4</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #NO_CONTENT_204}</td>
* <td>204</td>
* <td>No Content</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.2">Sec. 9.2</a></td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.3.5">Sec. 6.3.5</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #RESET_CONTENT_205}</td>
* <td>205</td>
* <td>Reset Content</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.3.6">Sec. 6.3.6</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #PARTIAL_CONTENT_206}</td>
* <td>206</td>
* <td>Partial Content</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.3.7">Sec. 6.3.7</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #MULTI_STATUS_207}</td>
* <td>207</td>
* <td>Multi-Status</td>
* <td>&nbsp;</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc2518#section-10.2">Sec. 10.2</a></td>
* </tr>
* <tr>
* <td>&nbsp;</td>
* <td style="text-decoration: line-through;">207</td>
* <td style="text-decoration: line-through;">Partial Update OK</td>
* <td>&nbsp;</td>
* <td>
* <a href=
* "http://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-rev-01.txt"
* >draft/01</a></td>
* <td>&nbsp;</td>
* </tr>
*
* <tr>
* <td><strong><code>Redirection - 3xx</code></strong></td>
* <td colspan="5">{@link #isRedirection(int)}</td>
* </tr>
*
* <tr>
* <td>{@link #MULTIPLE_CHOICES_300}</td>
* <td>300</td>
* <td>Multiple Choices</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.3">Sec. 9.3</a></td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.4.1">Sec. 6.4.1</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #MOVED_PERMANENTLY_301}</td>
* <td>301</td>
* <td>Moved Permanently</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.3">Sec. 9.3</a></td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.4.2">Sec. 6.4.2</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #MOVED_TEMPORARILY_302}</td>
* <td>302</td>
* <td>Moved Temporarily</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.3">Sec. 9.3</a></td>
* <td>(now "<code>302 Found</code>")</td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #FOUND_302}</td>
* <td>302</td>
* <td>Found</td>
* <td>(was "<code>302 Moved Temporarily</code>")</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.4.3">Sec. 6.4.3</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #SEE_OTHER_303}</td>
* <td>303</td>
* <td>See Other</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.4.4">Sec. 6.4.4</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #NOT_MODIFIED_304}</td>
* <td>304</td>
* <td>Not Modified</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.3">Sec. 9.3</a></td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.4.5">Sec. 6.4.5</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #USE_PROXY_305}</td>
* <td>305</td>
* <td>Use Proxy</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.4.6">Sec. 6.4.6</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>&nbsp;</td>
* <td>306</td>
* <td><em>(Unused)</em></td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.4.7">Sec. 6.4.7</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #TEMPORARY_REDIRECT_307}</td>
* <td>307</td>
* <td>Temporary Redirect</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.4.8">Sec. 6.4.8</a></td>
* <td>&nbsp;</td>
* </tr>
*
* <tr>
* <td>{@link #PERMANENT_REDIRECT_308}</td>
* <td>307</td>
* <td>Permanent Redirect</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7238">RFC7238</a></td>
* <td>&nbsp;</td>
* </tr>
*
* <tr>
* <td><strong><code>Client Error - 4xx</code></strong></td>
* <td colspan="5">{@link #isClientError(int)}</td>
* </tr>
*
* <tr>
* <td>{@link #BAD_REQUEST_400}</td>
* <td>400</td>
* <td>Bad Request</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.4">Sec. 9.4</a></td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.5.1">Sec. 6.5.1</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #UNAUTHORIZED_401}</td>
* <td>401</td>
* <td>Unauthorized</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.4">Sec. 9.4</a></td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.5.2">Sec. 6.5.2</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #PAYMENT_REQUIRED_402}</td>
* <td>402</td>
* <td>Payment Required</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.4">Sec. 9.4</a></td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.5.3">Sec. 6.5.3</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #FORBIDDEN_403}</td>
* <td>403</td>
* <td>Forbidden</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.4">Sec. 9.4</a></td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.5.4">Sec. 6.5.4</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #NOT_FOUND_404}</td>
* <td>404</td>
* <td>Not Found</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.4">Sec. 9.4</a></td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.5.5">Sec. 6.5.5</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #METHOD_NOT_ALLOWED_405}</td>
* <td>405</td>
* <td>Method Not Allowed</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.5.6">Sec. 6.5.6</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #NOT_ACCEPTABLE_406}</td>
* <td>406</td>
* <td>Not Acceptable</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.5.7">Sec. 6.5.7</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #PROXY_AUTHENTICATION_REQUIRED_407}</td>
* <td>407</td>
* <td>Proxy Authentication Required</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.5.8">Sec. 6.5.8</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #REQUEST_TIMEOUT_408}</td>
* <td>408</td>
* <td>Request Timeout</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.5.9">Sec. 6.5.9</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #CONFLICT_409}</td>
* <td>409</td>
* <td>Conflict</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-10.4.10">Sec. 10.4.10</a>
* </td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #GONE_410}</td>
* <td>410</td>
* <td>Gone</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-10.4.11">Sec. 10.4.11</a>
* </td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #LENGTH_REQUIRED_411}</td>
* <td>411</td>
* <td>Length Required</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-10.4.12">Sec. 10.4.12</a>
* </td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #PRECONDITION_FAILED_412}</td>
* <td>412</td>
* <td>Precondition Failed</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-10.4.13">Sec. 10.4.13</a>
* </td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #REQUEST_ENTITY_TOO_LARGE_413}</td>
* <td>413</td>
* <td>Request Entity Too Large</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-10.4.14">Sec. 10.4.14</a>
* </td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #REQUEST_URI_TOO_LONG_414}</td>
* <td>414</td>
* <td>Request-URI Too Long</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-10.4.15">Sec. 10.4.15</a>
* </td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #UNSUPPORTED_MEDIA_TYPE_415}</td>
* <td>415</td>
* <td>Unsupported Media Type</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-10.4.16">Sec. 10.4.16</a>
* </td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #REQUESTED_RANGE_NOT_SATISFIABLE_416}</td>
* <td>416</td>
* <td>Requested Range Not Satisfiable</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-10.4.17">Sec. 10.4.17</a>
* </td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #EXPECTATION_FAILED_417}</td>
* <td>417</td>
* <td>Expectation Failed</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-10.4.18">Sec. 10.4.18</a>
* </td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>&nbsp;</td>
* <td style="text-decoration: line-through;">418</td>
* <td style="text-decoration: line-through;">Reauthentication Required</td>
* <td>&nbsp;</td>
* <td>
* <a href=
* "http://tools.ietf.org/html/draft-ietf-http-v11-spec-rev-01#section-10.4.19"
* >draft/01</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>&nbsp;</td>
* <td style="text-decoration: line-through;">418</td>
* <td style="text-decoration: line-through;">Unprocessable Entity</td>
* <td>&nbsp;</td>
* <td>&nbsp;</td>
* <td>
* <a href=
* "http://tools.ietf.org/html/draft-ietf-webdav-protocol-05#section-10.3"
* >draft/05</a></td>
* </tr>
* <tr>
* <td>&nbsp;</td>
* <td style="text-decoration: line-through;">419</td>
* <td style="text-decoration: line-through;">Proxy Reauthentication Required</td>
* <td>&nbsp;</td>
* <td>
* <a href=
* "http://tools.ietf.org/html/draft-ietf-http-v11-spec-rev-01#section-10.4.20"
* >draft/01</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>&nbsp;</td>
* <td style="text-decoration: line-through;">419</td>
* <td style="text-decoration: line-through;">Insufficient Space on Resource</td>
* <td>&nbsp;</td>
* <td>&nbsp;</td>
* <td>
* <a href=
* "http://tools.ietf.org/html/draft-ietf-webdav-protocol-05#section-10.4"
* >draft/05</a></td>
* </tr>
* <tr>
* <td>&nbsp;</td>
* <td style="text-decoration: line-through;">420</td>
* <td style="text-decoration: line-through;">Method Failure</td>
* <td>&nbsp;</td>
* <td>&nbsp;</td>
* <td>
* <a href=
* "http://tools.ietf.org/html/draft-ietf-webdav-protocol-05#section-10.5"
* >draft/05</a></td>
* </tr>
* <tr>
* <td>&nbsp;</td>
* <td>421</td>
* <td><em>(Unused)</em></td>
* <td>&nbsp;</td>
* <td>&nbsp;</td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #UNPROCESSABLE_ENTITY_422}</td>
* <td>422</td>
* <td>Unprocessable Entity</td>
* <td>&nbsp;</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc2518#section-10.3">Sec. 10.3</a></td>
* </tr>
* <tr>
* <td>{@link #LOCKED_423}</td>
* <td>423</td>
* <td>Locked</td>
* <td>&nbsp;</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc2518#section-10.4">Sec. 10.4</a></td>
* </tr>
* <tr>
* <td>{@link #FAILED_DEPENDENCY_424}</td>
* <td>424</td>
* <td>Failed Dependency</td>
* <td>&nbsp;</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc2518#section-10.5">Sec. 10.5</a></td>
* </tr>
*
* <tr>
* <td><strong><code>Server Error - 5xx</code></strong></td>
* <td colspan="5">{@link #isServerError(int)}</td>
* </tr>
*
* <tr>
* <td>{@link #INTERNAL_SERVER_ERROR_500}</td>
* <td>500</td>
* <td>Internal Server Error</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.5">Sec. 9.5</a></td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.6.1">Sec. 6.6.1</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #NOT_IMPLEMENTED_501}</td>
* <td>501</td>
* <td>Not Implemented</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.5">Sec. 9.5</a></td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.6.2">Sec. 6.6.2</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #BAD_GATEWAY_502}</td>
* <td>502</td>
* <td>Bad Gateway</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.5">Sec. 9.5</a></td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.6.3">Sec. 6.6.3</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #SERVICE_UNAVAILABLE_503}</td>
* <td>503</td>
* <td>Service Unavailable</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc1945#section-9.5">Sec. 9.5</a></td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.6.4">Sec. 6.6.4</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #GATEWAY_TIMEOUT_504}</td>
* <td>504</td>
* <td>Gateway Timeout</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.6.5">Sec. 6.6.5</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #HTTP_VERSION_NOT_SUPPORTED_505}</td>
* <td>505</td>
* <td>HTTP Version Not Supported</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc7231#section-6.6.6">Sec. 6.6.6</a></td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>&nbsp;</td>
* <td>506</td>
* <td><em>(Unused)</em></td>
* <td>&nbsp;</td>
* <td>&nbsp;</td>
* <td>&nbsp;</td>
* </tr>
* <tr>
* <td>{@link #INSUFFICIENT_STORAGE_507}</td>
* <td>507</td>
* <td>Insufficient Storage</td>
* <td>&nbsp;</td>
* <td>&nbsp;</td>
* <td>
* <a href="http://tools.ietf.org/html/rfc2518#section-10.6">Sec. 10.6</a></td>
* </tr>
*
* </table>
*
* @version $Id$
* @see <a href="http://www.iana.org/assignments/http-status-codes/">IANA HTTP Status Code Registry</a>
*/
public class HttpStatus
{
@ -661,16 +62,28 @@ public class HttpStatus
public final static int GONE_410 = 410;
public final static int LENGTH_REQUIRED_411 = 411;
public final static int PRECONDITION_FAILED_412 = 412;
@Deprecated
public final static int REQUEST_ENTITY_TOO_LARGE_413 = 413;
public final static int PAYLOAD_TOO_LARGE_413 = 413;
@Deprecated
public final static int REQUEST_URI_TOO_LONG_414 = 414;
public final static int URI_TOO_LONG_414 = 414;
public final static int UNSUPPORTED_MEDIA_TYPE_415 = 415;
@Deprecated
public final static int REQUESTED_RANGE_NOT_SATISFIABLE_416 = 416;
public final static int RANGE_NOT_SATISFIABLE_416 = 416;
public final static int EXPECTATION_FAILED_417 = 417;
public final static int IM_A_TEAPOT_418 = 417;
public final static int ENHANCE_YOUR_CALM_420 = 420;
public final static int MISDIRECTED_REQUEST_421 = 421;
public final static int UNPROCESSABLE_ENTITY_422 = 422;
public final static int LOCKED_423 = 423;
public final static int FAILED_DEPENDENCY_424 = 424;
public final static int UPGRADE_REQUIRED_426 = 426;
public final static int PRECONDITION_REQUIRED_428 = 428;
public final static int TOO_MANY_REQUESTS_429 = 429;
public final static int REQUEST_HEADER_FIELDS_TOO_LARGE_431 = 431;
public final static int UNAVAILABLE_FOR_LEGAL_REASONS_451 = 451;
public final static int INTERNAL_SERVER_ERROR_500 = 500;
public final static int NOT_IMPLEMENTED_501 = 501;
@ -679,11 +92,8 @@ public class HttpStatus
public final static int GATEWAY_TIMEOUT_504 = 504;
public final static int HTTP_VERSION_NOT_SUPPORTED_505 = 505;
public final static int INSUFFICIENT_STORAGE_507 = 507;
// RFC 6585
public final static int PRECONDITION_REQUIRED_428 = 428;
public final static int TOO_MANY_REQUESTS_429 = 429;
public final static int REQUEST_HEADER_FIELDS_TOO_LARGE_431 = 431;
public final static int LOOP_DETECTED_508 = 508;
public final static int NOT_EXTENDED_510 = 510;
public final static int NETWORK_AUTHENTICATION_REQUIRED_511 = 511;
public static final int MAX_CODE = 511;
@ -701,150 +111,69 @@ public class HttpStatus
public enum Code
{
/*
* --------------------------------------------------------------------
* Informational messages in 1xx series. As defined by ... RFC 1945 -
* HTTP/1.0 RFC 7231 - HTTP/1.1 RFC 2518 - WebDAV
*/
/** <code>100 Continue</code> */
CONTINUE(CONTINUE_100, "Continue"),
/** <code>101 Switching Protocols</code> */
SWITCHING_PROTOCOLS(SWITCHING_PROTOCOLS_101, "Switching Protocols"),
/** <code>102 Processing</code> */
PROCESSING(PROCESSING_102, "Processing"),
/*
* --------------------------------------------------------------------
* Success messages in 2xx series. As defined by ... RFC 1945 - HTTP/1.0
* RFC 7231 - HTTP/1.1 RFC 2518 - WebDAV
*/
/** <code>200 OK</code> */
OK(OK_200, "OK"),
/** <code>201 Created</code> */
CREATED(CREATED_201, "Created"),
/** <code>202 Accepted</code> */
ACCEPTED(ACCEPTED_202, "Accepted"),
/** <code>203 Non Authoritative Information</code> */
NON_AUTHORITATIVE_INFORMATION(NON_AUTHORITATIVE_INFORMATION_203, "Non Authoritative Information"),
/** <code>204 No Content</code> */
NO_CONTENT(NO_CONTENT_204, "No Content"),
/** <code>205 Reset Content</code> */
RESET_CONTENT(RESET_CONTENT_205, "Reset Content"),
/** <code>206 Partial Content</code> */
PARTIAL_CONTENT(PARTIAL_CONTENT_206, "Partial Content"),
/** <code>207 Multi-Status</code> */
MULTI_STATUS(MULTI_STATUS_207, "Multi-Status"),
/*
* --------------------------------------------------------------------
* Redirection messages in 3xx series. As defined by ... RFC 1945 -
* HTTP/1.0 RFC 7231 - HTTP/1.1
*/
/** <code>300 Mutliple Choices</code> */
MULTIPLE_CHOICES(MULTIPLE_CHOICES_300, "Multiple Choices"),
/** <code>301 Moved Permanently</code> */
MOVED_PERMANENTLY(MOVED_PERMANENTLY_301, "Moved Permanently"),
/** <code>302 Moved Temporarily</code> */
MOVED_TEMPORARILY(MOVED_TEMPORARILY_302, "Moved Temporarily"),
/** <code>302 Found</code> */
FOUND(FOUND_302, "Found"),
/** <code>303 See Other</code> */
SEE_OTHER(SEE_OTHER_303, "See Other"),
/** <code>304 Not Modified</code> */
NOT_MODIFIED(NOT_MODIFIED_304, "Not Modified"),
/** <code>305 Use Proxy</code> */
USE_PROXY(USE_PROXY_305, "Use Proxy"),
/** <code>307 Temporary Redirect</code> */
TEMPORARY_REDIRECT(TEMPORARY_REDIRECT_307, "Temporary Redirect"),
/** <code>308 Permanent Redirect</code> */
PERMANET_REDIRECT(PERMANENT_REDIRECT_308, "Permanent Redirect"),
/*
* --------------------------------------------------------------------
* Client Error messages in 4xx series. As defined by ... RFC 1945 -
* HTTP/1.0 RFC 7231 - HTTP/1.1 RFC 2518 - WebDAV
*/
/** <code>400 Bad Request</code> */
BAD_REQUEST(BAD_REQUEST_400, "Bad Request"),
/** <code>401 Unauthorized</code> */
UNAUTHORIZED(UNAUTHORIZED_401, "Unauthorized"),
/** <code>402 Payment Required</code> */
PAYMENT_REQUIRED(PAYMENT_REQUIRED_402, "Payment Required"),
/** <code>403 Forbidden</code> */
FORBIDDEN(FORBIDDEN_403, "Forbidden"),
/** <code>404 Not Found</code> */
NOT_FOUND(NOT_FOUND_404, "Not Found"),
/** <code>405 Method Not Allowed</code> */
METHOD_NOT_ALLOWED(METHOD_NOT_ALLOWED_405, "Method Not Allowed"),
/** <code>406 Not Acceptable</code> */
NOT_ACCEPTABLE(NOT_ACCEPTABLE_406, "Not Acceptable"),
/** <code>407 Proxy Authentication Required</code> */
PROXY_AUTHENTICATION_REQUIRED(PROXY_AUTHENTICATION_REQUIRED_407, "Proxy Authentication Required"),
/** <code>408 Request Timeout</code> */
REQUEST_TIMEOUT(REQUEST_TIMEOUT_408, "Request Timeout"),
/** <code>409 Conflict</code> */
CONFLICT(CONFLICT_409, "Conflict"),
/** <code>410 Gone</code> */
GONE(GONE_410, "Gone"),
/** <code>411 Length Required</code> */
LENGTH_REQUIRED(LENGTH_REQUIRED_411, "Length Required"),
/** <code>412 Precondition Failed</code> */
PRECONDITION_FAILED(PRECONDITION_FAILED_412, "Precondition Failed"),
/** <code>413 Request Entity Too Large</code> */
REQUEST_ENTITY_TOO_LARGE(REQUEST_ENTITY_TOO_LARGE_413, "Request Entity Too Large"),
/** <code>414 Request-URI Too Long</code> */
REQUEST_URI_TOO_LONG(REQUEST_URI_TOO_LONG_414, "Request-URI Too Long"),
/** <code>415 Unsupported Media Type</code> */
PAYLOAD_TOO_LARGE(PAYLOAD_TOO_LARGE_413, "Payload Too Large"),
URI_TOO_LONG(URI_TOO_LONG_414, "URI Too Long"),
UNSUPPORTED_MEDIA_TYPE(UNSUPPORTED_MEDIA_TYPE_415, "Unsupported Media Type"),
/** <code>416 Requested Range Not Satisfiable</code> */
REQUESTED_RANGE_NOT_SATISFIABLE(REQUESTED_RANGE_NOT_SATISFIABLE_416, "Requested Range Not Satisfiable"),
/** <code>417 Expectation Failed</code> */
RANGE_NOT_SATISFIABLE(RANGE_NOT_SATISFIABLE_416, "Range Not Satisfiable"),
EXPECTATION_FAILED(EXPECTATION_FAILED_417, "Expectation Failed"),
/** <code>421 Misdirected Request(RFC7234)y</code> */
IM_A_TEAPOT(IM_A_TEAPOT_418, "Im a Teapot"),
ENHANCE_YOUR_CALM(ENHANCE_YOUR_CALM_420, "Enhance your Calm"),
MISDIRECTED_REQUEST(MISDIRECTED_REQUEST_421, "Misdirected Request"),
/** <code>422 Unprocessable Entity</code> */
UNPROCESSABLE_ENTITY(UNPROCESSABLE_ENTITY_422, "Unprocessable Entity"),
/** <code>423 Locked</code> */
LOCKED(LOCKED_423, "Locked"),
/** <code>424 Failed Dependency</code> */
FAILED_DEPENDENCY(FAILED_DEPENDENCY_424, "Failed Dependency"),
/** <code>426 Upgrade Required (RFC7231)</code> */
UPGRADE_REQUIRED(UPGRADE_REQUIRED_426, "Upgrade Required"),
/** <code>428 Precondition Required (RFC6585)</code> */
PRECONDITION_REQUIRED(PRECONDITION_REQUIRED_428, "Precondition Required"),
/** <code>429 Too Many Requests (RFC6585)</code> */
TOO_MANY_REQUESTS(TOO_MANY_REQUESTS_429, "Too Many Requests"),
/** <code>431 Request Header Fields Too Large (RFC6585)</code> */
REQUEST_HEADER_FIELDS_TOO_LARGE(REQUEST_HEADER_FIELDS_TOO_LARGE_431, "Request Header Fields Too Large"),
/*
* --------------------------------------------------------------------
* Server Error messages in 5xx series. As defined by ... RFC 1945 -
* HTTP/1.0 RFC 7231 - HTTP/1.1 RFC 2518 - WebDAV
*/
UNAVAILABLE_FOR_LEGAL_REASONS(UNAVAILABLE_FOR_LEGAL_REASONS_451, "Unavailable for Legal Reason"),
/** <code>500 Server Error</code> */
INTERNAL_SERVER_ERROR(INTERNAL_SERVER_ERROR_500, "Server Error"),
/** <code>501 Not Implemented</code> */
NOT_IMPLEMENTED(NOT_IMPLEMENTED_501, "Not Implemented"),
/** <code>502 Bad Gateway</code> */
BAD_GATEWAY(BAD_GATEWAY_502, "Bad Gateway"),
/** <code>503 Service Unavailable</code> */
SERVICE_UNAVAILABLE(SERVICE_UNAVAILABLE_503, "Service Unavailable"),
/** <code>504 Gateway Timeout</code> */
GATEWAY_TIMEOUT(GATEWAY_TIMEOUT_504, "Gateway Timeout"),
/** <code>505 HTTP Version Not Supported</code> */
HTTP_VERSION_NOT_SUPPORTED(HTTP_VERSION_NOT_SUPPORTED_505, "HTTP Version Not Supported"),
/** <code>507 Insufficient Storage</code> */
INSUFFICIENT_STORAGE(INSUFFICIENT_STORAGE_507, "Insufficient Storage"),
/** <code>511 Network Authentication Required (RFC6585)</code> */
LOOP_DETECTED(LOOP_DETECTED_508, "Loop Detected"),
NOT_EXTENDED(NOT_EXTENDED_510, "Not Extended"),
NETWORK_AUTHENTICATION_REQUIRED(NETWORK_AUTHENTICATION_REQUIRED_511, "Network Authentication Required"),
;

View File

@ -320,7 +320,9 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
}
case SettingsFrame.MAX_HEADER_LIST_SIZE:
{
// Handled by HTTP2ServerConnectionFactory.HTTPServerSessionListener.
if (LOG.isDebugEnabled())
LOG.debug("Update max header list size to {}", value);
generator.setMaxHeaderListSize(value);
break;
}
default:

View File

@ -84,4 +84,9 @@ public class Generator
{
dataGenerator.generate(lease, frame, maxLength);
}
public void setMaxHeaderListSize(int value)
{
hpackEncoder.setMaxHeaderListSize(value);
}
}

View File

@ -47,7 +47,7 @@ public class HpackDecoder
/**
* @param localMaxDynamicTableSize The maximum allowed size of the local dynamic header field table.
* @param maxHeaderSize The maximum allowed size of a headers block, expressed as total of all name and value characters.
* @param maxHeaderSize The maximum allowed size of a headers block, expressed as total of all name and value characters, plus 32 per field
*/
public HpackDecoder(int localMaxDynamicTableSize, int maxHeaderSize)
{
@ -73,8 +73,7 @@ public class HpackDecoder
// If the buffer is big, don't even think about decoding it
if (buffer.remaining()>_builder.getMaxSize())
throw new BadMessageException(HttpStatus.REQUEST_ENTITY_TOO_LARGE_413,"Header frame size "+buffer.remaining()+">"+_builder.getMaxSize());
throw new BadMessageException(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE_431,"Header frame size "+buffer.remaining()+">"+_builder.getMaxSize());
while(buffer.hasRemaining())
{
@ -144,7 +143,6 @@ public class HpackDecoder
name_index=NBitInteger.decode(buffer,4);
break;
case 4: // 7.2.1
case 5: // 7.2.1
case 6: // 7.2.1
@ -157,7 +155,6 @@ public class HpackDecoder
throw new IllegalStateException();
}
boolean huffmanName=false;
// decode the name

View File

@ -87,25 +87,43 @@ public class HpackEncoder
private final boolean _debug;
private int _remoteMaxDynamicTableSize;
private int _localMaxDynamicTableSize;
private int _maxHeaderListSize;
private int _size;
public HpackEncoder()
{
this(4096,4096);
this(4096,4096,-1);
}
public HpackEncoder(int localMaxDynamicTableSize)
{
this(localMaxDynamicTableSize,4096);
this(localMaxDynamicTableSize,4096,-1);
}
public HpackEncoder(int localMaxDynamicTableSize,int remoteMaxDynamicTableSize)
{
this(localMaxDynamicTableSize,remoteMaxDynamicTableSize,-1);
}
public HpackEncoder(int localMaxDynamicTableSize,int remoteMaxDynamicTableSize, int maxHeaderListSize)
{
_context=new HpackContext(remoteMaxDynamicTableSize);
_remoteMaxDynamicTableSize=remoteMaxDynamicTableSize;
_localMaxDynamicTableSize=localMaxDynamicTableSize;
_maxHeaderListSize=maxHeaderListSize;
_debug=LOG.isDebugEnabled();
}
public int getMaxHeaderListSize()
{
return _maxHeaderListSize;
}
public void setMaxHeaderListSize(int maxHeaderListSize)
{
_maxHeaderListSize = maxHeaderListSize;
}
public HpackContext getHpackContext()
{
return _context;
@ -126,6 +144,7 @@ public class HpackEncoder
if (LOG.isDebugEnabled())
LOG.debug(String.format("CtxTbl[%x] encoding",_context.hashCode()));
_size=0;
int pos = buffer.position();
// Check the dynamic table sizes!
@ -144,7 +163,6 @@ public class HpackEncoder
encode(buffer,new HttpField(HttpHeader.C_METHOD,request.getMethod()));
encode(buffer,new HttpField(HttpHeader.C_AUTHORITY,request.getURI().getAuthority()));
encode(buffer,new HttpField(HttpHeader.C_PATH,request.getURI().getPathQuery()));
}
else if (metadata.isResponse())
{
@ -160,6 +178,14 @@ public class HpackEncoder
for (HttpField field : metadata)
encode(buffer,field);
// Check size
if (_maxHeaderListSize>0 && _size>_maxHeaderListSize)
{
LOG.warn("Header list size too large {} > {} for {}",_size,_maxHeaderListSize);
if (LOG.isDebugEnabled())
LOG.debug("metadata={}",metadata);
}
if (LOG.isDebugEnabled())
LOG.debug(String.format("CtxTbl[%x] encoded %d octets",_context.hashCode(), buffer.position() - pos));
}
@ -178,6 +204,9 @@ public class HpackEncoder
if (field.getValue()==null)
field = new HttpField(field.getHeader(),field.getName(),"");
int field_size = field.getName().length() + field.getValue().length();
_size+=field_size+32;
final int p=_debug?buffer.position():-1;
String encoding=null;

View File

@ -72,9 +72,9 @@ public class MetaDataBuilder
String name = field.getName();
String value = field.getValue();
int field_size = name.length() + (value == null ? 0 : value.length());
_size+=field_size;
_size+=field_size+32;
if (_size>_maxSize)
throw new BadMessageException(HttpStatus.REQUEST_ENTITY_TOO_LARGE_413,"Header size "+_size+">"+_maxSize);
throw new BadMessageException(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE_431,"Header size "+_size+">"+_maxSize);
if (field instanceof StaticTableHttpField)
{
@ -191,6 +191,6 @@ public class MetaDataBuilder
if (huffman)
length=(length*4)/3;
if ((_size+length)>_maxSize)
throw new BadMessageException(HttpStatus.REQUEST_ENTITY_TOO_LARGE_413,"Header size "+(_size+length)+">"+_maxSize);
throw new BadMessageException(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE_431,"Header size "+(_size+length)+">"+_maxSize);
}
}

View File

@ -101,7 +101,7 @@ public class HpackTest
public void encodeDecodeTooLargeTest()
{
HpackEncoder encoder = new HpackEncoder();
HpackDecoder decoder = new HpackDecoder(4096,101);
HpackDecoder decoder = new HpackDecoder(4096,164);
ByteBuffer buffer = BufferUtil.allocate(16*1024);
HttpFields fields0 = new HttpFields();
@ -132,7 +132,7 @@ public class HpackTest
}
catch(BadMessageException e)
{
assertEquals(HttpStatus.REQUEST_ENTITY_TOO_LARGE_413,e.getCode());
assertEquals(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE_431,e.getCode());
}
}

View File

@ -101,15 +101,6 @@ public class HTTP2ServerConnectionFactory extends AbstractHTTP2ServerConnectionF
return settings;
}
@Override
public void onSettings(Session session, SettingsFrame frame)
{
HttpConfiguration httpConfig = getHttpConfiguration();
Integer mhls = frame.getSettings().get(SettingsFrame.MAX_HEADER_LIST_SIZE);
if (mhls != null && mhls < httpConfig.getResponseHeaderSize())
LOG.warn("MAX_HEADER_LIST_SIZE<{} for {}",getHttpConfiguration().getResponseHeaderSize(),session);
}
@Override
public Stream.Listener onNewStream(Stream stream, HeadersFrame frame)
{

View File

@ -762,7 +762,7 @@ public class HttpConnectionTest
"Cookie: "+cookie+"\r\n"+
"\r\n"
);
checkContains(response, offset, "HTTP/1.1 413");
checkContains(response, offset, "HTTP/1.1 431");
}
catch(Exception e)
{
@ -791,8 +791,8 @@ public class HttpConnectionTest
request.append("\r\n");
String response = connector.getResponses(request.toString());
offset = checkContains(response, offset, "HTTP/1.1 413");
checkContains(response, offset, "<h1>Bad Message 413</h1><pre>reason: Request Entity Too Large</pre>");
offset = checkContains(response, offset, "HTTP/1.1 431");
checkContains(response, offset, "<h1>Bad Message 431</h1>");
}
@Test

View File

@ -201,7 +201,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
// Read the response.
String response = readResponse(client);
Assert.assertThat(response, Matchers.containsString("HTTP/1.1 413 "));
Assert.assertThat(response, Matchers.containsString("HTTP/1.1 431 "));
}
}
@ -356,7 +356,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
// Read the response.
String response = readResponse(client);
Assert.assertThat(response, Matchers.containsString("HTTP/1.1 413 "));
Assert.assertThat(response, Matchers.containsString("HTTP/1.1 431 "));
}
}

View File

@ -177,7 +177,7 @@ public class RequestLogTest
_connector.getResponses("METHOD /foo HTTP/1.0\name: f+"+ooo+"\n\n");
String log = _log.exchange(null,5,TimeUnit.SECONDS);
assertThat(log,containsString("\"METHOD /foo HTTP/1.0\""));
assertThat(log,containsString(" 413 0 "));
assertThat(log,containsString(" 431 0 "));
}
@Test

View File

@ -208,7 +208,7 @@ public class DefaultServletRangesTest
"Connection: close\r\n"+
"Range: bytes=100-110\r\n" +
"\r\n");
assertResponseContains("416 Requested Range Not Satisfiable", response);
assertResponseContains("416 Range Not Satisfiable", response);
}