gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog plugin/plugin.cpp plugin/plugin...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog plugin/plugin.cpp plugin/plugin...
Date: Wed, 30 Jan 2008 22:42:44 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/01/30 22:42:44

Modified files:
        .              : ChangeLog 
        plugin         : plugin.cpp plugin.h 
        server/vm      : ASHandlers.cpp 

Log message:
        Fix javascript urls, and cleanup.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5529&r2=1.5530
http://cvs.savannah.gnu.org/viewcvs/gnash/plugin/plugin.cpp?cvsroot=gnash&r1=1.94&r2=1.95
http://cvs.savannah.gnu.org/viewcvs/gnash/plugin/plugin.h?cvsroot=gnash&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.188&r2=1.189

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5529
retrieving revision 1.5530
diff -u -b -r1.5529 -r1.5530
--- ChangeLog   30 Jan 2008 21:39:17 -0000      1.5529
+++ ChangeLog   30 Jan 2008 22:42:40 -0000      1.5530
@@ -1,5 +1,14 @@
 2008-01-30 Sandro Santilli <address@hidden>
 
+       * plugin/plugin.{cpp,h}: make player request handling line-based
+         (each line is one request).
+       * server/vm/ASHandlers.cpp (CommonGetUrl): pass the original url to
+         the host, not the gnash::URL mangled one (this fixes javascript
+         calls); don't pass the target as it'll just confuse the url for
+         now (we still need to define a good format for the target).
+
+2008-01-30 Sandro Santilli <address@hidden>
+
        * plugin/plugin.{cpp,h}: create a pipe for standalone to plugin
          communication and handle "GET" requests by loading the url
          in the _top window.

Index: plugin/plugin.cpp
===================================================================
RCS file: /sources/gnash/gnash/plugin/plugin.cpp,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -b -r1.94 -r1.95
--- plugin/plugin.cpp   30 Jan 2008 21:39:18 -0000      1.94
+++ plugin/plugin.cpp   30 Jan 2008 22:42:41 -0000      1.95
@@ -15,7 +15,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: plugin.cpp,v 1.94 2008/01/30 21:39:18 strk Exp $ */
+/* $Id: plugin.cpp,v 1.95 2008/01/30 22:42:41 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "gnashconfig.h"
@@ -575,38 +575,58 @@
        int inputfd = g_io_channel_unix_get_fd(iochan);
 
        cout << "Checking player requests on fd " << inputfd << endl;
-       cout.flush();
 
-#define MAXLINE 256
-       char buf[MAXLINE];
-
-       int ret = read(inputfd, buf, MAXLINE-1);
-       if ( ret == -1 )
+       do
        {
-               cout << " player request channel " << inputfd << " read error " 
<< strerror(errno) << endl;
+               GError* error=NULL;
+               gchar* request;
+               gsize requestSize=0;
+               GIOStatus status = g_io_channel_read_line(iochan, &request, 
&requestSize, NULL, &error);
+               switch ( status )
+               {
+                       case G_IO_STATUS_ERROR:
+                               cout << "Error reading request line: " << 
error->message << endl; 
+                               g_error_free(error);
                return false;
+                       case G_IO_STATUS_EOF:
+                               cout << "EOF (error:" << error << ")" << endl;
+                               return false;
+                       case G_IO_STATUS_AGAIN:
+                               cout << "Read again (error:" << error << ")" << 
endl;
+                               break;
+                       case G_IO_STATUS_NORMAL:
+                               // process request
+                               cout << "Normal read: " << request << " 
(error:" << error << ")" << endl;
+                               break;
+                       default:
+                               cout << "Abnormal status " << status << "  
(error:" << error << ")" << endl;
+                               return false;
+                       
        }
-       if ( ! ret )
-       {
-               cout << " no bytes read from player requests channel " << 
inputfd << endl;
-               return false; // correct ?
-       }
-       buf[ret] = '\0';
 
-       cout << " read " << ret << " bytes from fd " << inputfd << ": " << endl
-               << buf << endl;
+               // process request..
+               processPlayerRequest(request, requestSize);
+               g_free(request);
 
-       size_t linelen = ret;
+       } while (g_io_channel_get_buffer_condition(iochan) & G_IO_IN);
+
+       return true;
+
+}
+
+bool
+nsPluginInstance::processPlayerRequest(gchar* buf, gsize linelen)
+{
        if ( linelen < 4 )
        {
                cout << "Invalid player request (too short): " << buf << endl;
-               return true;
+               return false;
        }
 
        if ( strncmp(buf, "GET ", 4) )
        {
                cout << "Unknown player request: " << buf << endl;
-               return true;
+               return false;
        }
 
        char* url = buf+4;
@@ -614,7 +634,6 @@
 
        cout << "Asked to get URL '" << url << "'" << endl;
        NPN_GetURL(_instance, url, target);
-
        return true;
 }
 

Index: plugin/plugin.h
===================================================================
RCS file: /sources/gnash/gnash/plugin/plugin.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- plugin/plugin.h     30 Jan 2008 21:39:18 -0000      1.36
+++ plugin/plugin.h     30 Jan 2008 22:42:41 -0000      1.37
@@ -15,7 +15,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: plugin.h,v 1.36 2008/01/30 21:39:18 strk Exp $ */
+/* $Id: plugin.h,v 1.37 2008/01/30 22:42:41 strk Exp $ */
 
 #ifndef __PLUGIN_H__
 #define __PLUGIN_H__
@@ -97,6 +97,20 @@
 
     bool handlePlayerRequests(GIOChannel* iochan, GIOCondition cond);
 
+    /// Process a null-terminated request line
+    //
+    /// @param buf
+    ///          The single request.
+    ///   Caller is responsible for memory management, but give us
+    ///   permission to modify the string.
+    ///
+    /// @param len
+    ///          Lenght of buffer.
+    ///
+    /// @return true if the request was processed, false otherwise (bogus 
request..)
+    ///
+    bool processPlayerRequest(gchar* buf, gsize len);
+
     // EMBED or OBJECT attributes / parameters
     // @@ this should likely replace the _options element below
     std::map<std::string, std::string> _params;

Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -b -r1.188 -r1.189
--- server/vm/ASHandlers.cpp    30 Jan 2008 21:39:18 -0000      1.188
+++ server/vm/ASHandlers.cpp    30 Jan 2008 22:42:44 -0000      1.189
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: ASHandlers.cpp,v 1.188 2008/01/30 21:39:18 strk Exp $ */
+/* $Id: ASHandlers.cpp,v 1.189 2008/01/30 22:42:44 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "gnashconfig.h"
@@ -2314,7 +2314,20 @@
        {
                log_debug("user-provided host requests fd is %d", hostfd);
                std::stringstream request;
-               request << "GET " << url << " " << target_string << endl;
+
+               // TODO: define a format for othe requests, we'll either need
+               //       to use separators and escaping or header specified size
+               //
+               // for now will just omit the target and let the handler 
consider
+               // all as an url
+               //
+               //request << "GET " << url << " " << target_string << endl;
+               log_unimpl("target window %s load (we'll load in _top) always", 
target_string.c_str());
+
+               // use the original url, non parsed (the browser will know 
better how to resolve relative urls and handle hactionscript)
+               //request << "GET " << url << endl;
+               request << "GET " << url_c << endl;
+
                string requestString = request.str();
                const char* cmd = requestString.c_str();
                size_t len = requestString.length();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]