gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog testsuite/libbase/Makefile.am t...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog testsuite/libbase/Makefile.am t...
Date: Thu, 22 Feb 2007 16:36:14 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/02/22 16:36:13

Modified files:
        .              : ChangeLog 
        testsuite/libbase: Makefile.am CurlStreamTest.cpp 
        libbase        : curl_adapter.cpp 

Log message:
                * libbase/curl_adapter.cpp:
                  Use a member to store post data, as it
                  needs a longer lifetime for libcurl to work.
                * testsuite/libbase/Makefile.am:
                  Don't run CurlStreamTest by 'make check'
                  as it's not ready for automatic testing.
                * testsuite/libbase/CurlStreamTest.cpp:
                  Turn the test into a tool supporting POST
                  operations (for manual testing it).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2436&r2=1.2437
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/libbase/Makefile.am?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/libbase/CurlStreamTest.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/curl_adapter.cpp?cvsroot=gnash&r1=1.20&r2=1.21

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2436
retrieving revision 1.2437
diff -u -b -r1.2436 -r1.2437
--- ChangeLog   22 Feb 2007 14:04:42 -0000      1.2436
+++ ChangeLog   22 Feb 2007 16:36:13 -0000      1.2437
@@ -1,3 +1,15 @@
+2007-02-22 Sandro Santilli <address@hidden>
+
+       * libbase/curl_adapter.cpp:
+         Use a member to store post data, as it
+         needs a longer lifetime for libcurl to work.
+       * testsuite/libbase/Makefile.am:
+         Don't run CurlStreamTest by 'make check'
+         as it's not ready for automatic testing.
+       * testsuite/libbase/CurlStreamTest.cpp: 
+         Turn the test into a tool supporting POST
+         operations (for manual testing it).
+
 2007-02-22 Tomas Groth Christensen <address@hidden>
 
        * backend/sound_handler_gst.cpp: Removed the use of ffdec_mp3 since

Index: testsuite/libbase/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/libbase/Makefile.am,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- testsuite/libbase/Makefile.am       17 Jan 2007 00:10:21 -0000      1.26
+++ testsuite/libbase/Makefile.am       22 Feb 2007 16:36:13 -0000      1.27
@@ -78,7 +78,9 @@
 
 TEST_DRIVERS = ../simple.exp
 TEST_CASES = \
-       $(check_PROGRAMS) \
+       NoSeekFileTest \
+       URLTest \
+       RcTest
        $(NULL)
 
 check-DEJAGNU: site-update $(TEST_CASES)

Index: testsuite/libbase/CurlStreamTest.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/libbase/CurlStreamTest.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- testsuite/libbase/CurlStreamTest.cpp        8 Nov 2006 09:36:15 -0000       
1.3
+++ testsuite/libbase/CurlStreamTest.cpp        22 Feb 2007 16:36:13 -0000      
1.4
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -29,13 +29,24 @@
 
 using namespace std;
 
+const char* post = NULL;
+
 #define CHUNK_SIZE 4
 
 static void
 dump_curl(const char* url, ostream& os)
 {
-       tu_file* reader = curl_adapter::make_stream(url);
-       assert(reader);
+       std::auto_ptr<tu_file> reader;
+       if ( post )
+       {
+               reader.reset( curl_adapter::make_stream(url, post) );
+       }
+       else
+       {
+               reader.reset( curl_adapter::make_stream(url) );
+       }
+
+       assert(reader.get());
 
        char buf[CHUNK_SIZE];
 
@@ -91,9 +102,18 @@
 {
        const char* input = INPUT; // Should be the path to this file
 
+       if ( argc == 1 )
+       {
+               cerr << "Usage: " << argv[0] << " <url> [<postdata>]" << endl;
+               exit(EXIT_FAILURE);
+       }
+
        if ( argc > 1 ) input = argv[1];
 
+       if ( argc > 2 ) post = argv[2];
+
        cout << "input: " << input << endl;
+       if ( post ) cout << "post data: " << post << endl;
 
 #if 0
        cout << "FILE" << endl;

Index: libbase/curl_adapter.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/curl_adapter.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- libbase/curl_adapter.cpp    22 Feb 2007 08:53:37 -0000      1.20
+++ libbase/curl_adapter.cpp    22 Feb 2007 16:36:13 -0000      1.21
@@ -16,7 +16,7 @@
 
 // 
 
-/* $Id: curl_adapter.cpp,v 1.20 2007/02/22 08:53:37 strk Exp $ */
+/* $Id: curl_adapter.cpp,v 1.21 2007/02/22 16:36:13 strk Exp $ */
 
 #if defined(_WIN32) || defined(WIN32)
 #define snprintf _snprintf
@@ -37,8 +37,11 @@
 #include "log.h"
 
 #include <map>
+#include <iostream>
 #include <string>
 
+using namespace std;
+
 //#define GNASH_CURL_VERBOSE 1
 
 // define this if you want seeks back to be reported (on stderr)
@@ -143,6 +146,9 @@
        // transfer in progress
        int _running;
 
+       // Post data. Empty if no POST has been requested
+       std::string _postdata;
+
        // Attempt at filling the cache up to the given size.
        // Will call libcurl routines to fetch data.
        void fill_cache(off_t size);
@@ -358,7 +364,8 @@
 CurlStreamFile::CurlStreamFile(const std::string& url, const std::string& vars)
 {
        init(url);
-       // TODO: post data !
+
+       _postdata = vars;
 
        CURLcode ccode;
 
@@ -367,12 +374,15 @@
                throw gnash::GnashException(curl_easy_strerror(ccode));
        }
 
-       ccode = curl_easy_setopt(_handle, CURLOPT_POSTFIELDS, vars.c_str());
+       // libcurl needs to access the POSTFIELDS during 'perform' operations,
+       // so we must use a string whose lifetime is ensured to be longer then
+       // the multihandle itself.
+       // The _postdata member should meet this requirement
+       ccode = curl_easy_setopt(_handle, CURLOPT_POSTFIELDS, 
_postdata.c_str());
        if ( ccode != CURLE_OK ) {
                throw gnash::GnashException(curl_easy_strerror(ccode));
        }
 
-       // CURLMcode ret = 
        CURLMcode mcode = curl_multi_add_handle(_mhandle, _handle);
        if ( mcode != CURLM_OK ) {
                throw gnash::GnashException(curl_multi_strerror(mcode));




reply via email to

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