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

List:       kde-bugs-dist
Subject:    [Bug 49746] NPN_PostURLNotify not initiating NPP_NewStream with Flash 6 Linux plugin
From:       George Staikos <staikos () kde ! org>
Date:       2003-02-22 6:21:14
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
     
http://bugs.kde.org/show_bug.cgi?id=49746     




------- Additional Comments From staikos@kde.org  2003-02-22 07:21 -------
Subject: kdebase/nsplugins/viewer

CVS commit by staikos: 

Untested partial implementation of NPN_PostURL

I think it will do the post ok, but it won't return the results as it is
supposed to, and only http/https urls work.

CCMAIL: 49746@bugs.kde.org


  M +40 -4     nsplugin.cpp   1.79


--- kdebase/nsplugins/viewer/nsplugin.cpp  #1.78:1.79
@@ -232,10 +232,45 @@ NPError g_NPN_GetURLNotify(NPP instance,
 
 
-NPError g_NPN_PostURL(NPP /*instance*/, const char* /*url*/, const char* /*target*/,
-                    uint32 /*len*/, const char* /*buf*/, NPBool /*file*/)
+NPError g_NPN_PostURL(NPP /*instance*/, const char* url, const char* target,
+                    uint32 len, const char* buf, NPBool file)
 {
-   kdDebug(1431) << "g_NPN_PostURL() [unimplemented]" << endl;
+//http://devedge.netscape.com/library/manuals/2002/plugin/1.0/npn_api13.html
+   kdDebug(1431) << "g_NPN_PostURL() [incomplete]" << endl;
+   QByteArray postdata;
 
-   return NPERR_GENERIC_ERROR;
+   if (file) { // buf is a filename
+      QFile f(buf);
+      if (!f.open(IO_ReadOnly)) {
+         return NPERR_FILE_NOT_FOUND;
+      }
+
+      postdata = f.readAll();
+      f.close();
+   } else {    // buf is raw data
+      postdata.duplicate(buf, len);
+   }
+
+   if (!target) {
+      // Send the results of the post to the plugin
+   } else if (!strcmp(target, "_current") || !strcmp(target, "_self") ||
+              !strcmp(target, "_top")) {
+      // Unload the plugin, put the results in the frame/window that the
+      // plugin was loaded in
+   } else if (!strcmp(target, "_new") || !strcmp(target, "_blank")){
+      // Open a new browser window and write the results there
+   } else {
+      // Write the results to the specified frame
+   }
+
+   KURL u(url);
+
+   if (u.protocol() == "http" || u.protocol() == "https") {
+      /*job = */ KIO::http_post(u, postdata, false);
+   } else {
+      // FIXME - must implement this
+      return NPERR_INVALID_URL;
+   }
+
+   return NPERR_NO_ERROR;
 }
 
@@ -244,4 +279,5 @@ NPError g_NPN_PostURLNotify(NPP /*instan
                           uint32 /*len*/, const char* /*buf*/, NPBool /*file*/, void* /*notifyData*/)
 {
+//http://devedge.netscape.com/library/manuals/2002/plugin/1.0/npn_api14.html
    kdDebug(1431) << "g_NPN_PostURL() [unimplemented]" << endl;
[prev in list] [next in list] [prev in thread] [next in thread] 

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