From: Automatic source maintenance Date: Thu, 18 Aug 2011 02:21:37 +0000 (-0600) Subject: SourceFormat Enforcement X-Git-Tag: SQUID_3_1_15~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2f34f39db34dbc5bf9c7134047402e29ed28662;p=thirdparty%2Fsquid.git SourceFormat Enforcement --- diff --git a/src/redirect.cc b/src/redirect.cc index 7b1070cc46..ba9c815f47 100644 --- a/src/redirect.cc +++ b/src/redirect.cc @@ -161,61 +161,60 @@ redirectStart(ClientHttpRequest * http, RH * handler, void *data) if (!r->client_ident && conn != NULL) { r->client_ident = sslGetUserEmail(fd_table[conn->fd].ssl); - debugs(61, 5, HERE << "ssl-user=" << (r->client_ident?r->client_ident:"NULL")); -} + debugs(61, 5, HERE << "ssl-user=" << (r->client_ident?r->client_ident:"NULL")); + } #endif -if (!r->client_ident) - r->client_ident = dash_str; - -r->method_s = RequestMethodStr(http->request->method); - -r->handler = handler; - -r->data = cbdataReference(data); - -if ((fqdn = fqdncache_gethostbyaddr(r->client_addr, 0)) == NULL) - fqdn = dash_str; - -sz = snprintf(buf, MAX_REDIRECTOR_REQUEST_STRLEN, "%s %s/%s %s %s myip=%s myport=%d\n", - r->orig_url, - r->client_addr.NtoA(claddr,MAX_IPSTRLEN), - fqdn, - r->client_ident[0] ? rfc1738_escape(r->client_ident) : dash_str, - r->method_s, - http->request->my_addr.NtoA(myaddr,MAX_IPSTRLEN), - http->request->my_addr.GetPort()); - -if ((sz<=0) || (sz>=MAX_REDIRECTOR_REQUEST_STRLEN)) -{ - if (sz<=0) { - status = HTTP_INTERNAL_SERVER_ERROR; - debugs(61, DBG_CRITICAL, "ERROR: Gateway Failure. Can not build request to be passed to redirector. Request ABORTED."); - } else { - status = HTTP_REQUEST_URI_TOO_LARGE; - debugs(61, DBG_CRITICAL, "ERROR: Gateway Failure. Request passed to redirector exceeds MAX_REDIRECTOR_REQUEST_STRLEN (" << MAX_REDIRECTOR_REQUEST_STRLEN << "). Request ABORTED."); + if (!r->client_ident) + r->client_ident = dash_str; + + r->method_s = RequestMethodStr(http->request->method); + + r->handler = handler; + + r->data = cbdataReference(data); + + if ((fqdn = fqdncache_gethostbyaddr(r->client_addr, 0)) == NULL) + fqdn = dash_str; + + sz = snprintf(buf, MAX_REDIRECTOR_REQUEST_STRLEN, "%s %s/%s %s %s myip=%s myport=%d\n", + r->orig_url, + r->client_addr.NtoA(claddr,MAX_IPSTRLEN), + fqdn, + r->client_ident[0] ? rfc1738_escape(r->client_ident) : dash_str, + r->method_s, + http->request->my_addr.NtoA(myaddr,MAX_IPSTRLEN), + http->request->my_addr.GetPort()); + + if ((sz<=0) || (sz>=MAX_REDIRECTOR_REQUEST_STRLEN)) { + if (sz<=0) { + status = HTTP_INTERNAL_SERVER_ERROR; + debugs(61, DBG_CRITICAL, "ERROR: Gateway Failure. Can not build request to be passed to redirector. Request ABORTED."); + } else { + status = HTTP_REQUEST_URI_TOO_LARGE; + debugs(61, DBG_CRITICAL, "ERROR: Gateway Failure. Request passed to redirector exceeds MAX_REDIRECTOR_REQUEST_STRLEN (" << MAX_REDIRECTOR_REQUEST_STRLEN << "). Request ABORTED."); + } + + clientStreamNode *node = (clientStreamNode *)http->client_stream.tail->prev->data; + clientReplyContext *repContext = dynamic_cast(node->data.getRaw()); + assert (repContext); + IpAddress tmpnoaddr; + tmpnoaddr.SetNoAddr(); + repContext->setReplyToError(ERR_GATEWAY_FAILURE, status, + http->request->method, NULL, + http->getConn() != NULL ? http->getConn()->peer : tmpnoaddr, + http->request, + NULL, + http->getConn() != NULL && http->getConn()->auth_user_request != NULL ? + http->getConn()->auth_user_request : http->request->auth_user_request); + + node = (clientStreamNode *)http->client_stream.tail->data; + clientStreamRead(node, http, node->readBuffer); + return; } - clientStreamNode *node = (clientStreamNode *)http->client_stream.tail->prev->data; - clientReplyContext *repContext = dynamic_cast(node->data.getRaw()); - assert (repContext); - IpAddress tmpnoaddr; - tmpnoaddr.SetNoAddr(); - repContext->setReplyToError(ERR_GATEWAY_FAILURE, status, - http->request->method, NULL, - http->getConn() != NULL ? http->getConn()->peer : tmpnoaddr, - http->request, - NULL, - http->getConn() != NULL && http->getConn()->auth_user_request != NULL ? - http->getConn()->auth_user_request : http->request->auth_user_request); - - node = (clientStreamNode *)http->client_stream.tail->data; - clientStreamRead(node, http, node->readBuffer); - return; -} - -debugs(61,6, HERE << "sending '" << buf << "' to the helper"); -helperSubmit(redirectors, buf, redirectHandleReply, r); + debugs(61,6, HERE << "sending '" << buf << "' to the helper"); + helperSubmit(redirectors, buf, redirectHandleReply, r); } static void