--Boundary-00=_gwvEEdfadIe019v Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi It doesn't seems like Konqueror is honoring content-disposition:attachment in HTTP. Though the bug http://bugs.kde.org/show_bug.cgi?id=31662 has been closed. I think maybe the bug regressed after closing http://bugs.kde.org/show_bug.cgi?id=33769, since we do not parse the filename and type separately. The following patch implements separate passing of the content-disposition type and filename, and uses the type to decide on embedding in konq_run. Is it a problem that I rename the meta-data name in the http kioslave? Should I instead keep the filename as content-disposition and put the type under a new name? `Allan --Boundary-00=_gwvEEdfadIe019v Content-Type: text/x-diff; charset="us-ascii"; name="content-disposition.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="content-disposition.diff" Index: kdelibs/kparts/browserrun.h =================================================================== --- kdelibs/kparts/browserrun.h (revision 517591) +++ kdelibs/kparts/browserrun.h (working copy) @@ -75,22 +75,27 @@ //KParts::URLArgs urlArgs() const { return m_args; } //KParts::ReadOnlyPart* part() const { return m_part; } - + /** * @return the URL we're probing */ KURL url() const { return m_strURL; } - + /** * @return true if no dialog will be shown in case of errors */ bool hideErrorDialog() const; - + /** - * @return Suggested filename given by the server (e.g. HTTP content-disposition) + * @return Suggested filename given by the server (e.g. HTTP content-disposition filename) */ QString suggestedFilename() const { return m_suggestedFilename; } - + + /** + * @return Suggested disposition by the server (e.g. HTTP content-disposition) + */ + QString contentDisposition() const; + enum AskSaveResult { Save, Open, Cancel }; /** * Ask the user whether to save or open a url in another application. Index: kdelibs/kparts/browserrun.cpp =================================================================== --- kdelibs/kparts/browserrun.cpp (revision 517591) +++ kdelibs/kparts/browserrun.cpp (working copy) @@ -36,6 +36,7 @@ { public: bool m_bHideErrorDialog; + QString contentDisposition; }; BrowserRun::BrowserRun( const KURL& url, const KParts::URLArgs& args, @@ -185,7 +186,8 @@ m_strURL = job->url(); kdDebug(1000) << "slotBrowserMimetype: found " << type << " for " << m_strURL.prettyURL() << endl; - m_suggestedFilename = job->queryMetaData("content-disposition"); + m_suggestedFilename = job->queryMetaData("content-disposition-filename"); + d->contentDisposition = job->queryMetaData("content-disposition"); //kdDebug(1000) << "m_suggestedFilename=" << m_suggestedFilename << endl; // Make a copy to avoid a dead reference @@ -507,4 +509,8 @@ return d->m_bHideErrorDialog; } +QString BrowserRun::contentDisposition() const { + return d->contentDisposition; +} + #include "browserrun.moc" Index: kdelibs/kioslave/http/http.cc =================================================================== --- kdelibs/kioslave/http/http.cc (revision 517591) +++ kdelibs/kioslave/http/http.cc (working copy) @@ -2711,6 +2711,7 @@ QCString cookieStr; // In case we get a cookie. QString disposition; // Incase we get a Content-Disposition + QString dispositionFilename; // Incase we get a Content-Disposition filename QString mediaValue; QString mediaAttribute; @@ -3245,7 +3246,7 @@ dispositionBuf--; if ( dispositionBuf > bufStart ) - disposition = QString::fromLatin1( bufStart, dispositionBuf-bufStart ); + dispositionFilename = QString::fromLatin1( bufStart, dispositionBuf-bufStart ); break; } @@ -3267,15 +3268,15 @@ // Content-Dispostion is not allowed to dictate directory // path, thus we extract the filename only. - if ( !disposition.isEmpty() ) + if ( !dispositionFilename.isEmpty() ) { - int pos = disposition.findRev( '/' ); + int pos = dispositionFilename.findRev( '/' ); if( pos > -1 ) - disposition = disposition.mid(pos+1); + dispositionFilename = dispositionFilename.mid(pos+1); - kdDebug(7113) << "(" << m_pid << ") Content-Disposition: " - << disposition<< endl; + kdDebug(7113) << "(" << m_pid << ") Content-Disposition: filename=" + << dispositionFilename<< endl; } } else if (strncasecmp(buf, "Proxy-Connection:", 17) == 0) @@ -3754,6 +3755,12 @@ << disposition << endl; setMetaData("content-disposition", disposition); } + if( !dispositionFilename.isEmpty() ) + { + kdDebug(7113) << "(" << m_pid << ") Setting Content-Disposition filename metadata to: " + << dispositionFilename << endl; + setMetaData("content-disposition-filename", dispositionFilename); + } if (!m_request.lastModified.isEmpty()) setMetaData("modified", m_request.lastModified); Index: kdebase/konqueror/konq_run.cc =================================================================== --- kdebase/konqueror/konq_run.cc (revision 517591) +++ kdebase/konqueror/konq_run.cc (working copy) @@ -80,11 +80,9 @@ bool tryEmbed = true; // One case where we shouldn't try to embed, is when the server asks us to save - // ####### only if content-disposition doesn't say inline -#if 0 - if ( !m_suggestedFilename.isEmpty() ) + if ( contentDisposition() == "attachment" ) tryEmbed = false; -#endif + if ( KonqMainWindow::isMimeTypeAssociatedWithSelf( mimeType ) ) m_req.forceAutoEmbed = true; --Boundary-00=_gwvEEdfadIe019v--