~chtsanti/squid/icap-max-connections

« back to all changes in this revision

Viewing changes to src/errorpage.cc

  • Committer: Christos Tsantilas
  • Date: 2009-02-18 22:18:35 UTC
  • mfrom: (9294.1.215 trunk)
  • Revision ID: chtsanti@users.sourceforge.net-20090218221835-lfxxe3bs8uhu0b1h
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
556
556
 
557
557
    if (NULL != request) {
558
558
        Packer p;
559
 
        str.Printf("%s %s HTTP/%d.%d\n",
 
559
        String urlpath_or_slash;
 
560
 
 
561
        if (request->urlpath.size() != 0)
 
562
            urlpath_or_slash = request->urlpath;
 
563
        else
 
564
            urlpath_or_slash = "/";
 
565
 
 
566
        str.Printf("%s " SQUIDSTRINGPH " HTTP/%d.%d\n",
560
567
                   RequestMethodStr(request->method),
561
 
                   request->urlpath.size() ? request->urlpath.unsafeBuf() : "/",
 
568
                   SQUIDSTRINGPRINT(urlpath_or_slash),
562
569
                   request->http_ver.major, request->http_ver.minor);
563
570
        packerToMemInit(&p, &str);
564
571
        request->header.packInto(&p);
734
741
 
735
742
        if (NULL != request) {
736
743
            Packer p;
737
 
            mb.Printf("%s %s HTTP/%d.%d\n",
 
744
            String urlpath_or_slash;
 
745
 
 
746
            if (request->urlpath.size() != 0)
 
747
                urlpath_or_slash = request->urlpath;
 
748
            else
 
749
                urlpath_or_slash = "/";
 
750
 
 
751
            mb.Printf("%s " SQUIDSTRINGPH " HTTP/%d.%d\n",
738
752
                      RequestMethodStr(request->method),
739
 
                      request->urlpath.size() ? request->urlpath.unsafeBuf() : "/",
 
753
                      SQUIDSTRINGPRINT(urlpath_or_slash),
740
754
                      request->http_ver.major, request->http_ver.minor);
741
755
            packerToMemInit(&p, &mb);
742
756
            request->header.packInto(&p);
928
942
     */
929
943
    if (!Config.errorDirectory && request && request->header.getList(HDR_ACCEPT_LANGUAGE, &hdr) ) {
930
944
 
931
 
        const char *unsafeBuf = hdr.unsafeBuf(); // raw header string for parsing
932
 
        int pos = 0; // current parsing position in header string
 
945
        size_t pos = 0; // current parsing position in header string
933
946
        char *reset = NULL; // where to reset the p pointer for each new tag file
934
947
        char *dt = NULL;
935
948
 
950
963
             *  - IFF a tag contains only two characters we can wildcard ANY translations matching: <it> '-'? .*
951
964
             *    with preference given to an exact match.
952
965
             */
953
 
            while (pos < hdr.size() && unsafeBuf[pos] != ';' && unsafeBuf[pos] != ',' && !xisspace(unsafeBuf[pos]) && dt < (dir+256) ) {
954
 
                *dt++ = xtolower(unsafeBuf[pos++]);
 
966
            while (pos < hdr.size() && hdr[pos] != ';' && hdr[pos] != ',' && !xisspace(hdr[pos]) && dt < (dir+256) ) {
 
967
                *dt++ = xtolower(hdr[pos++]);
955
968
            }
956
969
            *dt++ = '\0'; // nul-terminated the filename content string before system use.
957
970
 
958
 
            debugs(4, 9, HERE << "STATE: dt='" << dt << "', reset='" << reset << "', reset[1]='" << reset[1] << "', pos=" << pos << ", buf='" << &unsafeBuf[pos] << "'");
 
971
            debugs(4, 9, HERE << "STATE: dt='" << dt << "', reset='" << reset << "', reset[1]='" << reset[1] << "', pos=" << pos << ", buf='" << hdr.substr(pos,hdr.size()) << "'");
959
972
 
960
973
            /* if we found anything we might use, try it. */
961
974
            if (*reset != '\0') {
983
996
            dt = reset; // reset for next tag testing. we replace the failed name instead of cloning.
984
997
 
985
998
            // IFF we terminated the tag on ';' we need to skip the 'q=' bit to the next ',' or end.
986
 
            while (pos < hdr.size() && unsafeBuf[pos] != ',') pos++;
987
 
            if (unsafeBuf[pos] == ',') pos++;
 
999
            while (pos < hdr.size() && hdr[pos] != ',') pos++;
 
1000
            if (hdr[pos] == ',') pos++;
988
1001
        }
989
1002
    }
990
1003
#endif /* USE_ERR_LOCALES */