assert(fd == serverDestinations[0]->fd);
if (entry->isEmpty()) {
- ErrorState *anErr = new ErrorState(ERR_CONNECT_FAIL, Http::scGateway_Timeout, request);
+ ErrorState *anErr = new ErrorState(ERR_CONNECT_FAIL, Http::scGatewayTimeout, request);
anErr->xerrno = ETIMEDOUT;
fail(anErr);
FwdState::makeConnectingError(const err_type type) const
{
return new ErrorState(type, request->flags.needValidation ?
- Http::scGateway_Timeout : Http::scServiceUnavailable, request);
+ Http::scGatewayTimeout : Http::scServiceUnavailable, request);
}
static void
case Http::scBadGateway:
- case Http::scGateway_Timeout:
+ case Http::scGatewayTimeout:
return true;
case Http::scForbidden:
assert (repContext);
conn->quitAfterError(request.getRaw());
repContext->setReplyToError(ERR_TOO_BIG,
- Http::scRequestEntityTooLarge, Http::METHOD_NONE, NULL,
+ Http::scPayloadTooLarge, Http::METHOD_NONE, NULL,
conn->clientConnection->remote, http->request, NULL, NULL);
assert(context->http->out.offset == 0);
context->pullData();
clientReplyContext *repContext = dynamic_cast<clientReplyContext*>(node->data.getRaw());
assert(repContext);
const Http::StatusCode scode = (error == ERR_TOO_BIG) ?
- Http::scRequestEntityTooLarge : HTTP_BAD_REQUEST;
+ Http::scPayloadTooLarge : HTTP_BAD_REQUEST;
repContext->setReplyToError(error, scode,
repContext->http->request->method,
repContext->http->uri,
{
debugs(88, 4, "clientProcessOnlyIfCachedMiss: '" <<
RequestMethodStr(http->request->method) << " " << http->uri << "'");
- http->al->http.code = Http::scGateway_Timeout;
- ErrorState *err = clientBuildError(ERR_ONLY_IF_CACHED_MISS, Http::scGateway_Timeout, NULL,
+ http->al->http.code = Http::scGatewayTimeout;
+ ErrorState *err = clientBuildError(ERR_ONLY_IF_CACHED_MISS, Http::scGatewayTimeout, NULL,
http->getConn()->clientConnection->remote, http->request);
removeClientStoreReference(&sc, http);
startError(err);
// TODO: change default redirect status for appropriate requests
// Squid defaults to 302 status for now for better compatibility with old clients.
- // HTTP/1.0 client should get 302 (Http::scMovedTemporarily)
+ // HTTP/1.0 client should get 302 (Http::scFound)
// HTTP/1.1 client contacting reverse-proxy should get 307 (Http::scTemporaryRedirect)
// HTTP/1.1 client being diverted by forward-proxy should get 303 (Http::scSeeOther)
- Http::StatusCode status = Http::scMovedTemporarily;
+ Http::StatusCode status = Http::scFound;
if (statusNote != NULL) {
const char * result = statusNote;
status = static_cast<Http::StatusCode>(atoi(result));
}
if (status == Http::scMovedPermanently
- || status == Http::scMovedTemporarily
+ || status == Http::scFound
|| status == Http::scSeeOther
|| status == Http::scPermanentRedirect
|| status == Http::scTemporaryRedirect) {
if (name[0] == '3' || (name[0] != '2' && name[0] != '4' && name[0] != '5' && strchr(name, ':'))) {
/* Redirection */
- Http::StatusCode status = Http::scMovedTemporarily;
+ Http::StatusCode status = Http::scFound;
// Use configured 3xx reply status if set.
if (name[0] == '3')
status = httpStatus;
break;
case ERR_READ_TIMEOUT:
- ftperr = new ErrorState(error, Http::scGateway_Timeout, fwd->request);
+ ftperr = new ErrorState(error, Http::scGatewayTimeout, fwd->request);
break;
default:
GopherStateData *gopherState = static_cast<GopherStateData *>(io.data);
debugs(10, 4, HERE << io.conn << ": '" << gopherState->entry->url() << "'" );
- gopherState->fwd->fail(new ErrorState(ERR_READ_TIMEOUT, Http::scGateway_Timeout, gopherState->fwd->request));
+ gopherState->fwd->fail(new ErrorState(ERR_READ_TIMEOUT, Http::scGatewayTimeout, gopherState->fwd->request));
if (Comm::IsConnOpen(io.conn))
io.conn->close();
debugs(11, 4, HERE << serverConnection << ": '" << entry->url() << "'" );
if (entry->store_status == STORE_PENDING) {
- fwd->fail(new ErrorState(ERR_READ_TIMEOUT, Http::scGateway_Timeout, fwd->request));
+ fwd->fail(new ErrorState(ERR_READ_TIMEOUT, Http::scGatewayTimeout, fwd->request));
}
serverConnection->close();
case Http::scMovedPermanently:
- case Http::scMovedTemporarily:
+ case Http::scFound:
case Http::scGone:
/* Responses that only are cacheable if the server says so */
- case Http::scMovedTemporarily:
+ case Http::scFound:
case Http::scTemporaryRedirect:
if (rep->date <= 0) {
debugs(22, 3, HERE << "NO because HTTP status " << rep->sline.status() << " and Date missing/invalid");
case Http::scMethodNotAllowed:
- case Http::scRequestUriTooLarge:
+ case Http::scUriTooLong:
case Http::scInternalServerError:
case Http::scServiceUnavailable:
- case Http::scGateway_Timeout:
- debugs(22, 3, HERE << "MAYBE because HTTP status " << rep->sline.status());
+ case Http::scGatewayTimeout:
+ debugs(22, 3, "MAYBE because HTTP status " << rep->sline.status());
return -1;
/* NOTREACHED */
case Http::scConflict:
case Http::scLengthRequired:
case Http::scPreconditionFailed:
- case Http::scRequestEntityTooLarge:
+ case Http::scPayloadTooLarge:
case Http::scUnsupportedMediaType:
case Http::scUnprocessableEntity:
case Http::scLocked:
{
switch (status) {
+ // 000
case Http::scNone:
return "Init"; /* we init .status with code 0 */
break;
+ // 100-199
case Http::scContinue:
return "Continue";
break;
return "Switching Protocols";
break;
+ case Http::scProcessing:
+ return "Processing";
+ break;
+
+ // 200-299
case Http::scOkay:
return "OK";
break;
return "Multi-Status";
break;
+ case Http::scAlreadyReported:
+ return "Already Reported";
+ break;
+
+ case Http::scImUsed:
+ return "IM Used";
+ break;
+
+ // 300-399
case Http::scMultipleChoices:
return "Multiple Choices";
break;
return "Moved Permanently";
break;
- case Http::scMovedTemporarily:
- return "Moved Temporarily";
+ case Http::scFound:
+ return "Found";
break;
case Http::scSeeOther:
return "Permanent Redirect";
break;
+ // 400-499
case Http::scBadRequest:
return "Bad Request";
break;
break;
case Http::scRequestTimeout:
- return "Request Time-out";
+ return "Request Timeout";
break;
case Http::scConflict:
return "Precondition Failed";
break;
- case Http::scRequestEntityTooLarge:
- return "Request Entity Too Large";
+ case Http::scPayloadTooLarge:
+ return "Payload Too Large";
break;
- case Http::scRequestUriTooLarge:
- return "Request-URI Too Large";
+ case Http::scUriTooLong:
+ return "URI Too Long";
break;
case Http::scUnsupportedMediaType:
return "Expectation Failed";
break;
+ case Http::scUnprocessableEntity:
+ return "Unprocessable Entity";
+ break;
+
+ case Http::scLocked:
+ return "Locked";
+ break;
+
+ case Http::scFailedDependency:
+ return "Failed Dependency";
+ break;
+
+ case Http::scUpgradeRequired:
+ return "Upgrade Required";
+ break;
+
+ case Http::scPreconditionRequired:
+ return "Precondition Required";
+ break;
+
+ case Http::scTooManyRequests:
+ return "Too Many Requests";
+ break;
+
+ case Http::scRequestHeaderFieldsTooLarge:
+ return "Request Header Fields Too Large";
+ break;
+
+ // 500-599
case Http::scInternalServerError:
return "Internal Server Error";
break;
return "Service Unavailable";
break;
- case Http::scGateway_Timeout:
- return "Gateway Time-out";
+ case Http::scGatewayTimeout:
+ return "Gateway Timeout";
break;
case Http::scHttpVersionNotSupported:
return "HTTP Version not supported";
break;
- // RFC 6585
- case Http::scPreconditionRequired: // 428
- return "Precondition Required";
+ case Http::scVariantAlsoNegotiates:
+ return "Variant Also Negotiates";
break;
- case Http::scTooManyFields: // 429
- return "Too Many Requests";
+ case Http::scInsufficientStorage:
+ return "Insufficient Storage";
break;
- case Http::scRequestHeaderFieldsTooLarge: // 431
- return "Request Header Fields Too Large";
+ case Http::scLoopDetected:
+ return "Loop Detected";
break;
- case Http::scNetworkAuthenticationRequired: // 511
+ case Http::scNotExtended:
+ return "Not Extended";
+ break;
+
+ case Http::scNetworkAuthenticationRequired:
return "Network Authentication Required";
break;
+ // 600+
+ case Http::scInvalidHeader:
+ case Http::scHeaderTooLarge:
+ // fall through to default.
+
default:
- debugs(57, 3, "Unknown HTTP status code: " << status);
- return "Unknown";
+ debugs(57, 3, "Unassigned HTTP status code: " << status);
}
+ return "Unassigned";
}
/**
* These basic HTTP reply status codes are defined by RFC 2616 unless otherwise stated.
+ * The IANA registry for HTTP status codes can be found at:
+ * http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
*/
typedef enum {
scNone = 0,
scNoContent = 204,
scResetContent = 205,
scPartialContent = 206,
- scMultiStatus = 207, /**< RFC2518 section 10.2 */
+ scMultiStatus = 207, /**< RFC2518 section 10.2 / RFC4918 */
+ scAlreadyReported = 208, /**< RFC5842 */
+ scImUsed = 226, /**< RFC3229 */
scMultipleChoices = 300,
scMovedPermanently = 301,
- scMovedTemporarily = 302,
+ scFound = 302,
scSeeOther = 303,
scNotModified = 304,
scUseProxy = 305,
scTemporaryRedirect = 307,
- scPermanentRedirect = 308,
+ scPermanentRedirect = 308, /**< RFC-reschke-http-status-308-07 */
scBadRequest = 400,
scUnauthorized = 401,
scPaymentRequired = 402,
scGone = 410,
scLengthRequired = 411,
scPreconditionFailed = 412,
- scRequestEntityTooLarge = 413,
- scRequestUriTooLarge = 414,
+ scPayloadTooLarge = 413,
+ scUriTooLong = 414,
scUnsupportedMediaType = 415,
scRequestedRangeNotSatisfied = 416,
scExpectationFailed = 417,
- scUnprocessableEntity = 422, /**< RFC2518 section 10.3 */
- scLocked = 423, /**< RFC2518 section 10.4 */
- scFailedDependency = 424, /**< RFC2518 section 10.5 */
+ scUnprocessableEntity = 422, /**< RFC2518 section 10.3 / RFC4918 */
+ scLocked = 423, /**< RFC2518 section 10.4 / RFC4918 */
+ scFailedDependency = 424, /**< RFC2518 section 10.5 / RFC4918 */
+ scUpgradeRequired = 426,
scPreconditionRequired = 428, /**< RFC6585 */
- scTooManyFields = 429, /**< RFC6585 */
+ scTooManyRequests = 429, /**< RFC6585 */
scRequestHeaderFieldsTooLarge = 431, /**< RFC6585 */
scInternalServerError = 500,
scNotImplemented = 501,
scBadGateway = 502,
scServiceUnavailable = 503,
- scGateway_Timeout = 504,
+ scGatewayTimeout = 504,
scHttpVersionNotSupported = 505,
- scInsufficientStorage = 507, /**< RFC2518 section 10.6 */
+ scVariantAlsoNegotiates = 506, /**< RFC2295 */
+ scInsufficientStorage = 507, /**< RFC2518 section 10.6 / RFC4918 */
+ scLoopDetected = 508, /**< RFC5842 */
+ scNotExtended = 510, /**< RFC2774 */
scNetworkAuthenticationRequired = 511, /**< RFC6585 */
// The 6xx codes below are for internal use only: Bad requests result
- // in scBadRequest; bad responses in scGateway_Timeout.
+ // in scBadRequest; bad responses in scGatewayTimeout.
scInvalidHeader = 600, /**< Squid header parsing error */
scHeaderTooLarge = 601 /* Header too large to process */
Mgr::Forwarder::handleError()
{
debugs(16, DBG_CRITICAL, "ERROR: uri " << entry->url() << " exceeds buffer size");
- sendError(new ErrorState(ERR_INVALID_URL, Http::scRequestUriTooLarge, httpRequest));
+ sendError(new ErrorState(ERR_INVALID_URL, Http::scUriTooLong, httpRequest));
mustStop("long URI");
}
newReply.notes.append(&reply.notes);
if (status == Http::scMovedPermanently
- || status == Http::scMovedTemporarily
+ || status == Http::scFound
|| status == Http::scSeeOther
|| status == Http::scPermanentRedirect
|| status == Http::scTemporaryRedirect) {
status = Http::scInternalServerError;
debugs(61, DBG_CRITICAL, "ERROR: Gateway Failure. Can not build request to be passed to " << name << ". Request ABORTED.");
} else {
- status = Http::scRequestUriTooLarge;
+ status = Http::scUriTooLong;
debugs(61, DBG_CRITICAL, "ERROR: Gateway Failure. Request passed to " << name << " exceeds MAX_REDIRECTOR_REQUEST_STRLEN (" << MAX_REDIRECTOR_REQUEST_STRLEN << "). Request ABORTED.");
}
"</ADDRESS>\n",
APP_FULLNAME, getMyHostname());
rep = new HttpReply;
- rep->setHeaders(Http::scMovedTemporarily, NULL, "text/html", mb->contentSize(), 0, squid_curtime);
+ rep->setHeaders(Http::scFound, NULL, "text/html", mb->contentSize(), 0, squid_curtime);
if (urnState->flags.force_menu) {
debugs(51, 3, "urnHandleReply: forcing menu");