Changeset 22013 in webkit


Ignore:
Timestamp:
Jun 5, 2007 7:32:15 PM (17 years ago)
Author:
kmccullo
Message:

Reviewed by Mark and Olliver.

  • http://bugs.webkit.org/show_bug.cgi?id=13352 REGRESSION: Gmail hangs on send message.
  • Now we don't hang, but we do so by avoiding certain legitimate characters, the evangelism bug for this is: <rdar://problem/5252577> gmail does not accept legal characters in the form boundary
  • html/HTMLFormElement.cpp: (WebCore::getUniqueBoundaryString):
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r21982 r22013  
     12007-06-05  Kevin McCullough  <kmccullough@apple.com>
     2
     3        Reviewed by Mark and Olliver.
     4
     5        - http://bugs.webkit.org/show_bug.cgi?id=13352  REGRESSION: Gmail hangs on send message.
     6        - Now we don't hang, but we do so by avoiding certain legitimate characters, the evangelism bug for this is: <rdar://problem/5252577> gmail does not accept legal characters in the form boundary
     7
     8        * html/HTMLFormElement.cpp:
     9        (WebCore::getUniqueBoundaryString):
     10
    1112007-06-05  Anders Carlsson  <andersca@apple.com>
    212
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r21979 r22013  
    1153411534                        isa = PBXProject;
    1153511535                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
     11536                        compatibilityVersion = "Xcode 2.4";
    1153611537                        hasScannedForEncodings = 1;
    1153711538                        knownRegions = (
     
    1154811549                        projectDirPath = "";
    1154911550                        projectRoot = "";
     11551                        shouldCheckCompatibility = 1;
    1155011552                        targets = (
    1155111553                                93F198A508245E59001E9ABC /* WebCore */,
  • trunk/WebCore/html/HTMLFormElement.cpp

    r20260 r22013  
    366366static void getUniqueBoundaryString(Vector<char>& boundary)
    367367{
     368    // The RFC 2046 spec says the AlphaNumeric characters plus the following characters
     369    // are legal for boundaries:  '()+_,-./:=?
     370    // However the following characters, though legal, cause some sites to fail:
     371    // (),./:=
     372    // http://bugs.webkit.org/show_bug.cgi?id=13352
     373    static const char AlphaNumericEncMap[64] =
     374    {
     375      0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
     376      0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
     377      0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
     378      0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
     379      0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E,
     380      0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
     381      0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33,
     382      0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x41
     383      // FIXME <rdar://problem/5252577> gmail does not accept legal characters in the form boundary
     384      // As stated above, some legal characters cause, sites to fail. Specifically
     385      // the / character which was the last character in the above array. I have
     386      // replaced the last character with another character already in the array
     387      // (notice the first and last values are both 0x41, A). Instead of picking
     388      // another unique legal character for boundary strings that, because it has
     389      // never been tested, may or may not break other sites, I simply
     390      // replaced / with A.  This means A is twice as likely to occur in our boundary
     391      // strings than any other character but I think this is fine for the time being.
     392      // The FIXME here is about restoring the / character once the aforementioned
     393      // radar has been resolved.
     394    };
     395
    368396    // Start with an informative prefix.
    369397    const char boundaryPrefix[] = "----WebKitFormBoundary";
    370398    boundary.append(boundaryPrefix, strlen(boundaryPrefix));
    371399
    372     // Append 16 characters of base 64 randomness.
     400    // Append 16 random 7bit ascii AlphaNumeric characters.
    373401    Vector<char> randomBytes;
    374     for (int i = 0; i < 3; ++i) {
     402
     403    for (int i = 0; i < 4; ++i) {
    375404        int randomness = randomNumber();
    376         randomBytes.append(static_cast<char>(randomness >> 24));
    377         randomBytes.append(static_cast<char>(randomness >> 16));
    378         randomBytes.append(static_cast<char>(randomness >> 8));
    379         randomBytes.append(static_cast<char>(randomness));
    380     }
    381     Vector<char> randomBase64;
    382     base64Encode(randomBytes, randomBase64);
    383     boundary.append(randomBase64);
    384 
    385     // Add a 0 at the end so we can use this as a C-style string.
    386     boundary.append(0);
     405        randomBytes.append(AlphaNumericEncMap[(randomness >> 24) & 0x3F]);
     406        randomBytes.append(AlphaNumericEncMap[(randomness >> 16) & 0x3F]);
     407        randomBytes.append(AlphaNumericEncMap[(randomness >> 8) & 0x3F]);
     408        randomBytes.append(AlphaNumericEncMap[randomness & 0x3F]);
     409    }
     410
     411    boundary.append(randomBytes);
     412    boundary.append(0); // Add a 0 at the end so we can use this as a C-style string.
    387413}
    388414
Note: See TracChangeset for help on using the changeset viewer.