~ubuntu-branches/ubuntu/oneiric/squid3/oneiric-security

« back to all changes in this revision

Viewing changes to src/client_side_request.cc

  • Committer: Bazaar Package Importer
  • Author(s): Mahyuddin Susanto
  • Date: 2011-02-15 18:46:13 UTC
  • mfrom: (21.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110215184613-1u3dh5sz4i055flk
Tags: 3.1.10-1ubuntu1
* Merge from debian unstable. (LP: #719283)  Remaining changes:
  - debian/patches/18-fix-ftbfs-binutils-gold.dpatch: Add library linker into
    LIBS instead to LDFLAGS to fixing FTBFS binutils-gold.
* Drop Ubuntu configuration for ufw which landed in Debian and sync it: 
  - debian/squid3.ufw.profile.

Show diffs side-by-side

added added

removed removed

Lines of Context:
962
962
    }
963
963
 
964
964
#endif
965
 
    if (request->method == METHOD_TRACE || request->method == METHOD_OPTIONS) {
966
 
        request->max_forwards = req_hdr->getInt64(HDR_MAX_FORWARDS);
967
 
    }
968
965
 
969
966
    request->flags.cachable = http->request->cacheable();
970
967
 
1012
1009
            if ((t = strchr(result, ':')) != NULL) {
1013
1010
                http->redirect.status = status;
1014
1011
                http->redirect.location = xstrdup(t + 1);
 
1012
                // TODO: validate the URL produced here is RFC 2616 compliant absolute URI
1015
1013
            } else {
1016
 
                debugs(85, 1, "clientRedirectDone: bad input: " << result);
 
1014
                if (old_request->http_ver < HttpVersion(1,1))
 
1015
                    debugs(85, DBG_CRITICAL, "ERROR: URL-rewrite produces invalid 302 redirect Location: " << result);
 
1016
                else
 
1017
                    debugs(85, DBG_CRITICAL, "ERROR: URL-rewrite produces invalid 303 redirect Location: " << result);
1017
1018
            }
1018
 
        } else if (strcmp(result, http->uri))
1019
 
            new_request = HttpRequest::CreateFromUrlAndMethod(result, old_request->method);
 
1019
        } else if (strcmp(result, http->uri)) {
 
1020
            if (!(new_request = HttpRequest::CreateFromUrlAndMethod(result, old_request->method)))
 
1021
                debugs(85, DBG_CRITICAL, "ERROR: URL-rewrite produces invalid request: " <<
 
1022
                       old_request->method << " " << result << " HTTP/1.1");
 
1023
        }
1020
1024
    }
1021
1025
 
1022
1026
    if (new_request) {
1040
1044
        if (old_request->body_pipe != NULL) {
1041
1045
            new_request->body_pipe = old_request->body_pipe;
1042
1046
            old_request->body_pipe = NULL;
1043
 
            debugs(0,0,HERE << "redirecting body_pipe " << new_request->body_pipe << " from request " << old_request << " to " << new_request);
 
1047
            debugs(61,2, HERE << "URL-rewriter diverts body_pipe " << new_request->body_pipe <<
 
1048
                   " from request " << old_request << " to " << new_request);
1044
1049
        }
1045
1050
 
1046
1051
        new_request->content_length = old_request->content_length;
1368
1373
    assert(!virginHeadSource);
1369
1374
    assert(!adaptedBodySource);
1370
1375
    virginHeadSource = initiateAdaptation(
1371
 
                           new Adaptation::Iterator(this, request, NULL, g));
 
1376
                           new Adaptation::Iterator(request, NULL, g));
1372
1377
 
1373
1378
    // we could try to guess whether we can bypass this adaptation
1374
1379
    // initiation failure, but it should not really happen
1375
 
    assert(virginHeadSource != NULL); // Must, really
 
1380
    Must(initiated(virginHeadSource));
1376
1381
}
1377
1382
 
1378
1383
void