[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:23:31 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 5b8ff36f302d3999f58cccf6135a2a6eb4f028c1
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Feb 4 19:08:06 2003 +0000

            Reviewed by Trey.
    
            - fixed 3150252 -- files with question marks in their names fail to upload as attachments
    
            * khtml/html/html_formimpl.cpp:
            (HTMLFormElementImpl::formData): Don't include a Content-Type header at all if we don't
            have a MIME type to send. Matches other web browsers' behavior.
            (HTMLInputElementImpl::encoding): Construct the URL using setPath rather than just passing
            a filename to the KURL constructor.
            (HTMLSelectElementImpl::state): Tweak #if formatting a bit.
            (HTMLSelectElementImpl::restoreState): Improve comment a bit.
            * kwq/KWQKURL.mm: Make ? be a "bad character". I checked carefully to be sure this does
            not adversely affect any calls, including running our KURL tests.
            (KURL::setPath): Encode the passed-in path. I determined this was correct both by looking
            at all the call sites in KHTML code to see that they would want this behavior, and by noticing
            that the path() getter decodes the path.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3562 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 5bf37a8..73edfbe 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,22 @@
+2003-02-04  Darin Adler  <darin at apple.com>
+
+        Reviewed by Trey.
+
+        - fixed 3150252 -- files with question marks in their names fail to upload as attachments
+
+        * khtml/html/html_formimpl.cpp:
+        (HTMLFormElementImpl::formData): Don't include a Content-Type header at all if we don't
+        have a MIME type to send. Matches other web browsers' behavior.
+        (HTMLInputElementImpl::encoding): Construct the URL using setPath rather than just passing
+        a filename to the KURL constructor.
+        (HTMLSelectElementImpl::state): Tweak #if formatting a bit.
+        (HTMLSelectElementImpl::restoreState): Improve comment a bit.
+        * kwq/KWQKURL.mm: Make ? be a "bad character". I checked carefully to be sure this does
+        not adversely affect any calls, including running our KURL tests.
+        (KURL::setPath): Encode the passed-in path. I determined this was correct both by looking
+        at all the call sites in KHTML code to see that they would want this behavior, and by noticing
+        that the path() getter decodes the path.
+
 2003-02-04  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by Darin
@@ -85,7 +104,7 @@
 
 	The bug # is 3162989.
 	
-        Reviewed by NOBODY (OOPS!).
+        Reviewed by Darin.
 
         * khtml/rendering/render_object.cpp:
         (RenderObject::containingBlock):
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 5bf37a8..73edfbe 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,22 @@
+2003-02-04  Darin Adler  <darin at apple.com>
+
+        Reviewed by Trey.
+
+        - fixed 3150252 -- files with question marks in their names fail to upload as attachments
+
+        * khtml/html/html_formimpl.cpp:
+        (HTMLFormElementImpl::formData): Don't include a Content-Type header at all if we don't
+        have a MIME type to send. Matches other web browsers' behavior.
+        (HTMLInputElementImpl::encoding): Construct the URL using setPath rather than just passing
+        a filename to the KURL constructor.
+        (HTMLSelectElementImpl::state): Tweak #if formatting a bit.
+        (HTMLSelectElementImpl::restoreState): Improve comment a bit.
+        * kwq/KWQKURL.mm: Make ? be a "bad character". I checked carefully to be sure this does
+        not adversely affect any calls, including running our KURL tests.
+        (KURL::setPath): Encode the passed-in path. I determined this was correct both by looking
+        at all the call sites in KHTML code to see that they would want this behavior, and by noticing
+        that the path() getter decodes the path.
+
 2003-02-04  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by Darin
@@ -85,7 +104,7 @@
 
 	The bug # is 3162989.
 	
-        Reviewed by NOBODY (OOPS!).
+        Reviewed by Darin.
 
         * khtml/rendering/render_object.cpp:
         (RenderObject::containingBlock):
diff --git a/WebCore/khtml/html/html_formimpl.cpp b/WebCore/khtml/html/html_formimpl.cpp
index dc29714..dca34bd 100644
--- a/WebCore/khtml/html/html_formimpl.cpp
+++ b/WebCore/khtml/html/html_formimpl.cpp
@@ -324,18 +324,22 @@ QByteArray HTMLFormElementImpl::formData(bool& ok)
                         if (path.length()) fileUploads << path;
                         QString onlyfilename = path.mid(path.findRev('/')+1);
 
+                        // FIXME: This won't work if the filename includes a " mark,
+                        // or control characters like CR or LF.
                         hstr += ("; filename=\"" + onlyfilename + "\"").ascii();
                         if(!static_cast<HTMLInputElementImpl*>(current)->value().isEmpty())
                         {
-                            hstr += "\r\nContent-Type: ";
 #if APPLE_CHANGES
                             KWQKHTMLPart *part = KWQ(current->getDocument()->view()->part());
                             QString mimeType = part->mimeTypeForFileName(onlyfilename);
-                            hstr += mimeType.ascii();
-#else /* APPLE_CHANGES not defined */
+#else
                             KMimeType::Ptr ptr = KMimeType::findByURL(KURL(path));
-                            hstr += ptr->name().ascii();
-#endif /* APPLE_CHANGES not defined */
+                            QString mimeType = ptr->name();
+#endif
+                            if (!mimeType.isEmpty()) {
+                                hstr += "\r\nContent-Type: ";
+                                hstr += mimeType.ascii();
+                            }
                         }
                     }
 
@@ -1436,7 +1440,8 @@ bool HTMLInputElementImpl::encoding(const QTextCodec* codec, khtml::encodingList
                 return true;
             }
 
-            KURL fileurl(value().string());
+            KURL fileurl("file:///");
+            fileurl.setPath(value().string());
             KIO::UDSEntry filestat;
 
             if (!KIO::NetAccess::stat(fileurl, filestat)) {
@@ -1454,7 +1459,7 @@ bool HTMLInputElementImpl::encoding(const QTextCodec* codec, khtml::encodingList
                 return false;
             }
 
-            if ( KIO::NetAccess::download(KURL(value().string()), local) )
+            if ( KIO::NetAccess::download(fileurl, local) )
             {
                 QFile file(local);
                 if (file.open(IO_ReadOnly))
@@ -1788,7 +1793,7 @@ QString HTMLSelectElementImpl::state( )
 {
 #if !APPLE_CHANGES
     QString state;
-#endif /* APPLE_CHANGES not defined */
+#endif
     QMemArray<HTMLGenericFormElementImpl*> items = listItems();
 
     int l = items.count();
@@ -1823,12 +1828,11 @@ void HTMLSelectElementImpl::restoreState(QStringList &_states)
     if(!state.isEmpty() && !state.contains('X') && !m_multiple) {
         qWarning("should not happen in restoreState!");
 #if APPLE_CHANGES
-        // Invalid access to string's internal buffer.  Should never get here
-        // anyway.
+        // KWQString doesn't support this operation. Should never get here anyway.
         //state[0] = 'X';
-#else /* APPLE_CHANGES not defined */
+#else
         state[0] = 'X';
-#endif /* APPLE_CHANGES not defined */
+#endif
     }
 
     QMemArray<HTMLGenericFormElementImpl*> items = listItems();
diff --git a/WebCore/kwq/KWQKURL.mm b/WebCore/kwq/KWQKURL.mm
index 6a246c2..672cc89 100644
--- a/WebCore/kwq/KWQKURL.mm
+++ b/WebCore/kwq/KWQKURL.mm
@@ -54,7 +54,7 @@ typedef enum {
     // digit | "A" | "B" | "C" | "D" | "E" | "F" | "a" | "b" | "c" | "d" | "e" | "f"
     HexDigitChar = 1 << 6,
 
-    // not allowed in path and not ? or #
+    // not allowed in path
     BadChar = 1 << 7
 } URLCharacterClasses;
 
@@ -92,7 +92,7 @@ static const unsigned char characterClassTable[256] = {
     /* 57  9 */ SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
     /* 58  : */ UserInfoChar | IPv6Char,    /* 59  ; */ UserInfoChar,
     /* 60  < */ BadChar,    /* 61  = */ UserInfoChar,
-    /* 62  > */ BadChar,    /* 63  ? */ PathSegmentEndChar,
+    /* 62  > */ BadChar,    /* 63  ? */ PathSegmentEndChar | BadChar,
     /* 64  @ */ 0,
     /* 65  A */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,    
     /* 66  B */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
@@ -595,7 +595,7 @@ void KURL::setQuery(const QString &query, int encoding_hint)
 void KURL::setPath(const QString &s)
 {
     if (m_isValid) {
-	QString newURL = urlString.left(portEndPos) + s + urlString.mid(pathEndPos);
+	QString newURL = urlString.left(portEndPos) + encode_string(s) + urlString.mid(pathEndPos);
 	parse(newURL.ascii(), &newURL);
     }
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list