Bug 49746 - NPN_PostURLNotify not initiating NPP_NewStream with Flash 6 Linux plugin
Summary: NPN_PostURLNotify not initiating NPP_NewStream with Flash 6 Linux plugin
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: nsplugins (show other bugs)
Version: unspecified
Platform: RedHat Enterprise Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 54201 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-10-26 22:30 UTC by Ed Millard
Modified: 2003-02-28 21:21 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Millard 2002-10-26 22:30:32 UTC
Version:            (using KDE KDE 3.0.3)
Installed from:    RedHat RPMs
Compiler:          gcc 2.96 
OS:          Linux

Install the current Flash 6 Linux Beta:

	http://www.macromedia.com/software/flashplayer/special/beta/

Load this Flash example:

	http://examples.macromedia.com/petmarket

In Mozilla it loads OK.  In Konqueror it stalls at "Loading Localized Text".
The Flash plugin is requesting a new stream with NPN_PostURLNotify().

url="http://examples.macromedia.com/flashservices/gateway"

Content-Type: application/x-amf^M
Content-Length: 177

Mozilla initiates the request with the expected callback to NPP_NewStream, Konqueror doesn't.
Comment 1 Ed Millard 2002-10-26 22:31:33 UTC
I should add this may well be a bug in the Flash plugin but its not clear why 
it works OK in Mozilla and not Konqueror 
Comment 2 Till Krech 2002-10-30 20:53:51 UTC
NPN_PostURL and NPN_PostURLNotify are still unimplemented in nspluginviewer. 
I'm currently working on this.
Comment 3 George Staikos 2003-02-22 05:40:54 UTC
*** Bug 54201 has been marked as a duplicate of this bug. ***
Comment 4 George Staikos 2003-02-22 05:59:33 UTC
Hi Till, any update on this? 
Comment 5 George Staikos 2003-02-22 07:21:11 UTC
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;
 


Comment 6 George Staikos 2003-02-24 00:35:27 UTC
I updated my plugin to flash 6 but I cannot get that demo to work.  It gives me a blank 
screen.  I don't see any debug output from it trying to call PostURL* either.  Are there 
other problems triggering this? 
 
It seems to work better in Netscape 4.x, but that also errors out with: 
 
                                                  Network Communication Error. A communication 
error occured with the 
                                                  Pet Market application. This might be caused by: 
 
                                                    
Comment 7 George Staikos 2003-02-28 21:21:53 UTC
Subject: kdebase/nsplugins/viewer

CVS commit by staikos: 

Make POST work in some cases.

See before and after on:
http://examples.macromedia.com/petmarket
(must have Flash 6)

This does not handle POST where the data gets returned anywhere except back to
the plugin.  That is, it doesn't allow the post results to appear in a browser
frame yet.  This is because I left:
// FIXME
there which of course doesn't do much.  It's all documented though.  Also
these functions only support "http" and "https" and nothing else.  I have no
personal intention to go any further with this, but I think it's supposed to
be possible to do other URLs too, at least that's what I figured from reading
the specs.

One other thing that does not work is plugins which put the POST data in a file
and pass the file name in to be POSTed.  I just haven't written the header
parser here.  If you find a site that uses it, show me, send beer/pizza, and
I'll do that for you too.

CCMAIL: kfm-devel@kde.org, 49746-done@bugs.kde.org


  M +1 -1      Makefile.am   1.21
  M +59 -7     nsplugin.cpp   1.88
  M +7 -4      nsplugin.h   1.36