gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/StreamProvider.cpp serve...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/StreamProvider.cpp serve...
Date: Fri, 23 Feb 2007 11:26:54 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/02/23 11:26:54

Modified files:
        .              : ChangeLog 
        server         : StreamProvider.cpp StreamProvider.h impl.cpp 

Log message:
                * server/StreamProvider.{cpp,h}: turn into
                  a singleton, add getStream() version taking
                  post data.
                * server/impl.cpp: use the StreamProvider singleton.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2442&r2=1.2443
http://cvs.savannah.gnu.org/viewcvs/gnash/server/StreamProvider.cpp?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/server/StreamProvider.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/server/impl.cpp?cvsroot=gnash&r1=1.96&r2=1.97

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2442
retrieving revision 1.2443
diff -u -b -r1.2442 -r1.2443
--- ChangeLog   23 Feb 2007 09:52:59 -0000      1.2442
+++ ChangeLog   23 Feb 2007 11:26:53 -0000      1.2443
@@ -1,3 +1,10 @@
+2007-02-23 Sandro Santilli <address@hidden>
+
+       * server/StreamProvider.{cpp,h}: turn into
+         a singleton, add getStream() version taking
+         post data.
+       * server/impl.cpp: use the StreamProvider singleton.
+
 2007-02-23 Udo Giacomozzi <address@hidden>
 
        * backend/render_handler_agg.cpp: Use PIXELFORMAT_xxx defines

Index: server/StreamProvider.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/StreamProvider.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- server/StreamProvider.cpp   13 Nov 2006 17:10:57 -0000      1.13
+++ server/StreamProvider.cpp   23 Feb 2007 11:26:54 -0000      1.14
@@ -53,6 +53,13 @@
 namespace gnash
 {
 
+StreamProvider&
+StreamProvider::getDefaultInstance()
+{
+       static StreamProvider inst;
+       return inst;
+}
+
 tu_file*
 StreamProvider::getStream(const URL& url)
 {
@@ -77,7 +84,6 @@
                std::string url_str = url.str();
                const char* c_url = url_str.c_str();
                if ( URLAccessManager::allow(url) ) {
-               //if ( URLAccessManager::host_check(url.hostname()) ) {
                        return curl_adapter::make_stream(c_url);
                } else {
                        return NULL;
@@ -89,5 +95,41 @@
        }
 }
 
+tu_file*
+StreamProvider::getStream(const URL& url, const std::string& postdata)
+{
+//    GNASH_REPORT_FUNCTION;
+
+       if (url.protocol() == "file")
+       {
+               log_warning("POST data discarded while getting a stream from 
non-http uri");
+               std::string path = url.path();
+               if ( path == "-" )
+               {
+                       FILE *newin = fdopen(dup(0), "rb");
+                       return new tu_file(newin, false);
+               }
+               else
+               {
+                       return new tu_file(path.c_str(), "rb");
+               }
+       }
+       else
+       {
+#ifdef USE_CURL
+               std::string url_str = url.str();
+               const char* c_url = url_str.c_str();
+               if ( URLAccessManager::allow(url) ) {
+                       return curl_adapter::make_stream(c_url, postdata);
+               } else {
+                       return NULL;
+               }
+#else
+               log_error("Unsupported network connections");
+               return NULL;
+#endif
+       }
+}
+
 } // namespace gnash
 

Index: server/StreamProvider.h
===================================================================
RCS file: /sources/gnash/gnash/server/StreamProvider.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/StreamProvider.h     29 Oct 2006 18:34:11 -0000      1.2
+++ server/StreamProvider.h     23 Feb 2007 11:26:54 -0000      1.3
@@ -20,6 +20,9 @@
 #ifndef _GNASH_STREAMPROVIDER_H
 #define _GNASH_STREAMPROVIDER_H
 
+#include <string>
+
+
 // Forward declarations
 class tu_file;
 namespace gnash {
@@ -39,6 +42,8 @@
 
        virtual ~StreamProvider() {}
 
+       static StreamProvider& getDefaultInstance();
+
        /// Returned stream ownership is transferred to caller.
        //
        /// On error NULL is returned
@@ -46,6 +51,22 @@
        ///
        virtual tu_file* getStream(const URL& url);
        
+       /// Get a stream from the response of a POST operation
+       //
+       /// Returned stream ownership is transferred to caller.
+       ///
+       /// On error NULL is returned
+       /// Derive from this for a CachingStreamProvider
+       ///
+       /// @param url
+       ///     The url to post to.
+       ///
+       /// @param postdata
+       ///     Post data in url-encoded form.
+       ///
+       ///
+       virtual tu_file* getStream(const URL& url, const std::string& postdata);
+       
 };
 
 } // namespace gnash

Index: server/impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/impl.cpp,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -b -r1.96 -r1.97
--- server/impl.cpp     21 Feb 2007 13:22:37 -0000      1.96
+++ server/impl.cpp     23 Feb 2007 11:26:54 -0000      1.97
@@ -14,7 +14,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: impl.cpp,v 1.96 2007/02/21 13:22:37 strk Exp $ */
+/* $Id: impl.cpp,v 1.97 2007/02/23 11:26:54 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -66,7 +66,7 @@
 namespace globals { // gnash::globals
 
        /// global StreamProvider
-       static StreamProvider streamProvider;
+       StreamProvider& streamProvider = StreamProvider::getDefaultInstance();
 
        /// Base url (for relative urls resolution)
        //




reply via email to

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