[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bkdelibs=5D_/=3A_kmulti=5Bpart=3A_Adjusted_the_--_st?=
From:       Maks Orlovich <maksim () kde ! org>
Date:       2011-03-18 1:33:29
Message-ID: 20110318013329.16E1CA60B9 () git ! kde ! org
[Download RAW message or body]

Git commit 34004429f2fb878d091e2fab07970dadae78cb2e by Maks Orlovich.
Committed on 06/03/2011 at 17:10.
Pushed by orlovich into branch 'master'.

kmulti[part: Adjusted the -- stripping quirk to not break on W3c bugzilla

The use in that bugzilla does not need a bogus -- removed, as its --
is actually accurate, and properly quoted. So, we don't handle --
quirkily in the quoted case, and pass down the quotedness from kio_http

M  +14   -1    khtml/kmultipart/kmultipart.cpp     
M  +1    -0    kio/DESIGN.metadata     
M  +6    -0    kioslave/http/http.cpp     

http://commits.kde.org/kdelibs/34004429f2fb878d091e2fab07970dadae78cb2e

diff --git a/khtml/kmultipart/kmultipart.cpp b/khtml/kmultipart/kmultipart.cpp
index 85ef2ee..a943806 100644
--- a/khtml/kmultipart/kmultipart.cpp
+++ b/khtml/kmultipart/kmultipart.cpp
@@ -202,7 +202,20 @@ void KMultiPart::slotData( KIO::Job *job, const QByteArray &data \
)  QString tmp = job->queryMetaData("media-boundary");
        kDebug() << "Got Boundary from kio-http '" << tmp << "'";
        if ( !tmp.isEmpty() ) {
-           if (tmp.startsWith(QLatin1String("--")))
+           // as per r437578, sometimes we se something like this:
+           // Content-Type: multipart/x-mixed-replace; boundary=--myboundary
+           // ..
+           // --myboundary
+           // e.g. the hashes specified in the header are extra. However,
+           // we also see the following on the w3c bugzilla:
+           // boundary="------- =_aaaaaaaaaa0"
+           // ..
+           //--------- =_aaaaaaaaaa0
+           // e.g. the hashes are accurate. For now, we consider the quoted
+           // case to be quirk-free, and only apply the -- stripping quirk
+           // when we're unquoted.
+           if (tmp.startsWith(QLatin1String("--")) &&
+               job->queryMetaData("media-boundary-kio-quoted") != "true")
                m_boundary = tmp.toLatin1();
            else
                m_boundary = QByteArray("--")+tmp.toLatin1();
diff --git a/kio/DESIGN.metadata b/kio/DESIGN.metadata
index c34347d..f5dfcd1 100644
--- a/kio/DESIGN.metadata
+++ b/kio/DESIGN.metadata
@@ -38,6 +38,7 @@ UserAgent       string          The user agent name to send to \
remote host (read  
 content-type    string          The content type of the data to be uploaded (read \
and set by http)  media-*         string          Media-Parameter attributes (e.g. \
media-boundary) +media-*-kio-quoted  bool        The corresponding media- attribute's \
value was quoted. (set by http)  
 cache           "cache"         Use entry from cache if available.
                 "cacheonly"     Do not do any remote lookups, fail if not in cache. \
                (read by http)
diff --git a/kioslave/http/http.cpp b/kioslave/http/http.cpp
index 1654dfc..82009f7 100644
--- a/kioslave/http/http.cpp
+++ b/kioslave/http/http.cpp
@@ -3064,7 +3064,9 @@ endParsing:
                 mediaAttribute = mediaAttribute.trimmed();
                 mediaValue     = mediaValue.trimmed();
 
+                bool quoted = false;
                 if (mediaValue.startsWith(QLatin1Char('"'))) {
+                    quoted = true;
                     mediaValue.remove(QLatin1Char('"'));
                 }
 
@@ -3080,6 +3082,10 @@ endParsing:
                     setMetaData(QLatin1String("charset"), mediaValue);
                 } else {
                     setMetaData(QLatin1String("media-") + mediaAttribute, \
mediaValue); +                    if (quoted) {
+                        setMetaData(QLatin1String("media-") + mediaAttribute + \
QLatin1String("-kio-quoted"), +                                    \
QLatin1String("true")); +                    }
                 }
             }
         }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic