LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File kdebase-trinity-r1255714-nsplugin-fix-port-from-kde4.diff of Package kdebase3 (Project openSUSE:Factory)

Index: kdebase/nsplugins/sdk/npapi.h
===================================================================
--- kdebase/nsplugins/sdk/npapi.h	(revision 1255713)
+++ kdebase/nsplugins/sdk/npapi.h	(revision 1255714)
@@ -256,6 +256,16 @@
   uint32 end;
   uint32 lastmodified;
   void*  notifyData;
+  const char* headers;  /* Response headers from host.
+			 * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS.
+			 * Used for HTTP only; NULL for non-HTTP.
+			 * Available from NPP_NewStream onwards.
+			 * Plugin should copy this data before storing it.
+			 * Includes HTTP status line and all headers,
+			 * preferably verbatim as received from server,
+			 * headers formatted as in HTTP ("Header: Value"),
+			 * and newlines (\n, NOT \r\n) separating lines.
+			 * Terminated by \n\0 (NOT \n\n\0). */
 } NPStream;
 
 
@@ -602,6 +612,21 @@
 #define NPVERS_68K_HAS_LIVECONNECT   11
 #define NPVERS_HAS_WINDOWLESS        11
 #define NPVERS_HAS_XPCONNECT_SCRIPTING 13
+// Trinity note: we claim 13 right now, though we do
+// have response_headers.
+#define NPVERS_HAS_NPRUNTIME_SCRIPTING      14
+#define NPVERS_HAS_FORM_VALUES              15
+#define NPVERS_HAS_POPUPS_ENABLED_STATE     16
+#define NPVERS_HAS_RESPONSE_HEADERS         17
+#define NPVERS_HAS_NPOBJECT_ENUM            18
+#define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19
+#define NPVERS_HAS_ALL_NETWORK_STREAMS      20
+#define NPVERS_HAS_URL_AND_AUTH_INFO        21
+#define NPVERS_HAS_PRIVATE_MODE             22
+#define NPVERS_MACOSX_HAS_COCOA_EVENTS      23
+#define NPVERS_HAS_ADVANCED_KEY_HANDLING    25
+#define NPVERS_HAS_URL_REDIRECT_HANDLING    26
+#define NPVERS_HAS_CLEAR_SITE_DATA          27
 
 /*----------------------------------------------------------------------*/
 /*                        Function Prototypes                           */
Index: kdebase/nsplugins/viewer/nsplugin.cpp
===================================================================
--- kdebase/nsplugins/viewer/nsplugin.cpp	(revision 1255713)
+++ kdebase/nsplugins/viewer/nsplugin.cpp	(revision 1255714)
@@ -1674,6 +1674,7 @@
     _stream->pdata = 0;
     _stream->lastmodified = 0;
     _stream->notifyData = _notifyData;
+    _stream->headers = 0;
 
     _mimeType = mimeType;
 
@@ -1898,6 +1899,7 @@
         _job = KIO::get(KURL( url ), false, false);
         _job->addMetaData("errorPage", "false");
         _job->addMetaData("AllowCompressedPage", "false");
+        _job->addMetaData("PropagateHttpHeader", "true");
         if (reload) {
             _job->addMetaData("cache", "reload");
         }
@@ -1925,6 +1927,7 @@
         _job = KIO::http_post(KURL( url ), data, false);
         _job->addMetaData("content-type", args.contentType());
         _job->addMetaData("errorPage", "false");
+        _job->addMetaData("PropagateHttpHeader", "true");
         _job->addMetaData("AllowCompressedPage", "false");
         connect(_job, SIGNAL(data(KIO::Job *, const QByteArray &)),
                 SLOT(data(KIO::Job *, const QByteArray &)));
@@ -1964,13 +1967,13 @@
 
 void NSPluginStream::mimetype(KIO::Job * job, const QString &mimeType)
 {
-    kdDebug(1431) << "NSPluginStream::QByteArray - job=" << (void*)job << " mimeType=" << mimeType << endl;
+    kdDebug(1431) << "NSPluginStream::mimetype - job=" << (void*)job << " mimeType=" << mimeType << endl;
     _mimeType = mimeType;
+    QString tmp_headers = job->metaData()["HTTP-Headers"];
+    _headers.duplicate(tmp_headers.latin1(), tmp_headers.length());
+    _stream->headers = _headers.data();
 }
 
-
-
-
 void NSPluginStream::resume()
 {
    if ( error() || tries()>8 ) {
Index: kdebase/nsplugins/viewer/nsplugin.h
===================================================================
--- kdebase/nsplugins/viewer/nsplugin.h	(revision 1255713)
+++ kdebase/nsplugins/viewer/nsplugin.h	(revision 1255714)
@@ -95,6 +95,7 @@
   KURL _url;
   QString _fileURL;
   QString _mimeType;
+  QByteArray _headers;
   QByteArray _data;
   class KTempFile *_tempFile;