gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash configure.ac ChangeLog cygnal/Makefile.am...


From: Rob Savoye
Subject: [Gnash-commit] gnash configure.ac ChangeLog cygnal/Makefile.am...
Date: Tue, 11 Dec 2007 03:23:03 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Rob Savoye <rsavoye>    07/12/11 03:23:03

Modified files:
        .              : configure.ac ChangeLog 
        cygnal         : Makefile.am cygnal.cpp http.cpp http.h 
                         netstats.cpp netstats.h stream.cpp 
Added files:
        cygnal/testsuite: Makefile.am simple.exp 
        cygnal/testsuite/cygnal.all: Makefile.am test_http.cpp 
Removed files:
        cygnal         : Change_Log.txt 

Log message:
                * cygnal/cygnal.cpp: Use a cygnal-dbg.log file instead of
                gnash-dbg.log. Use boost bind variables for all threads.
                * cygnal/http.{cpp,h}: Add methods for encoding HTTP header
                fields. Use a real date, instead of the bogus one. Check the 
file
                types to set the Content-Type HTTP field correctly.
                * cygnal/stream.cpp: Comment out lotsa debug messages.
                * cygnal/Makefile.am: Drop DIST_SUBDIRS, they don't compile
                for anything but win32 anyway. Add testsuite directory.
                * cygnal/testsuite: New testsuite directory. It's here rather 
than
                in gnash/testsuite since these tests are very different from
        
                ones gnash needs for most things.
                * cygnal/testsuite/Makefile.am: New Makefile for Cygnal test
                directories.
                * cygnal/testsuite/cygnal.all: Cygnal specific test cases live
                here.
                * cygnal/testsuite/cygnal.all/Makefile.am: Build the test cases
                and run DejaGnu on them.
                * cygnal/testsuite/cygnal.all/test_http.cpp: Test case for HTTP
                protocol.
                * configure.ac: Add new cygnal/testsuite Makefiles.
                * cygnal/testsuite/simpe.exp: clone the one used currently for
                Gnash testing.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/configure.ac?cvsroot=gnash&r1=1.454&r2=1.455
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5124&r2=1.5125
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/Makefile.am?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/cygnal.cpp?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/http.cpp?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/http.h?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/netstats.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/netstats.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/stream.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/Change_Log.txt?cvsroot=gnash&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/testsuite/Makefile.am?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/testsuite/simple.exp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/testsuite/cygnal.all/Makefile.am?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/testsuite/cygnal.all/test_http.cpp?cvsroot=gnash&rev=1.1

Patches:
Index: configure.ac
===================================================================
RCS file: /sources/gnash/gnash/configure.ac,v
retrieving revision 1.454
retrieving revision 1.455
diff -u -b -r1.454 -r1.455
--- configure.ac        4 Dec 2007 23:50:06 -0000       1.454
+++ configure.ac        11 Dec 2007 03:23:01 -0000      1.455
@@ -15,7 +15,7 @@
 dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 dnl  
 
-dnl $Id: configure.ac,v 1.454 2007/12/04 23:50:06 strk Exp $
+dnl $Id: configure.ac,v 1.455 2007/12/11 03:23:01 rsavoye Exp $
 
 AC_PREREQ(2.50)
 AC_INIT(gnash, cvs)
@@ -269,7 +269,6 @@
         build_alp=yes
 dnl        AC_DEFINE(USE_ALP, [1], [Use the ALP framework])
         build_gtk=yes
-dnl         AC_DEFINE(USE_GTK, [1], [Use the GTK GUI])
         ;;
       gtk|GTK|gtk2|GTK2)
 dnl        AC_DEFINE(USE_GTK, [1], [Use the GTK GUI])
@@ -709,10 +708,10 @@
 if test x"${build_alp}" = xyes; then
   GNASH_PATH_ALP
   if test x"${have_alp}" = x"yes"; then
-    AC_DEFINE([HAVE_ALP], [], [Access Linux Platform framework])
+    AC_DEFINE([HAVE_ALP], 1, [Access Linux Platform framework])
   fi
   cross_compiling=yes
-  build_gtk=yes
+dnl  build_gtk=yes
   build_kde=no
   build_ogl=no
   build_agg=yes
@@ -741,7 +740,7 @@
 dnl   disable build of the GUIS for which deps are NOT met
 dnl ------------------------------------------------------------
 
-if test x$build_gtk = xyes; then
+if test x$build_gtk = xyes -o $build_alp = xyes -o x$build_hildon = xyes; then
    GNASH_PATH_GTK2
    GNASH_PATH_PANGO
    GNASH_PKG_FIND(atk, [atk/atk.h], [atk library], atk_focus_tracker_init, 
[1.0])
@@ -749,6 +748,7 @@
       GNASH_PATH_GLEXT
    fi
 
+  GNASH_PKG_FIND(cairo, [cairo.h], [cairo render library], cairo_status)
    dnl if gtk isn't installed, even if it's specified, don't try to build
    dnl the GTK gui. 
    if test x$has_gtk2 = xno; then
@@ -786,6 +786,7 @@
 
 AC_CHECK_FUNCS(mallinfo)
 AC_PATH_TOOL([AUTOTRACE], [autotrace])
+AC_PATH_TOOL([NETCAT], [netcat])
 AC_HEADER_DIRENT
 
 dnl -----------------------------------------------------------------
@@ -1608,13 +1609,13 @@
 plugin/Makefile
 plugin/klash/Makefile
 cygnal/Makefile
-cygnal/ACT/Makefile
-cygnal/ACT/test_support/Makefile
-cygnal/ACT/unit_tests/Makefile
-cygnal/IO/Makefile
-cygnal/HTTP/Makefile
-cygnal/Net/Makefile
-cygnal/unit_tests/Makefile
+cygnal/testsuite/Makefile
+cygnal/testsuite/cygnal.all/Makefile
+dnl cygnal/ACT/unit_tests/Makefile
+dnl cygnal/IO/Makefile
+dnl cygnal/HTTP/Makefile
+dnl cygnal/Net/Makefile
+dnl cygnal/unit_tests/Makefile
 )
 
 ###

Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5124
retrieving revision 1.5125
diff -u -b -r1.5124 -r1.5125
--- ChangeLog   11 Dec 2007 00:14:22 -0000      1.5124
+++ ChangeLog   11 Dec 2007 03:23:01 -0000      1.5125
@@ -1,5 +1,35 @@
+2007-12-10  Rob Savoye  <address@hidden>
+
+       * cygnal/cygnal.cpp: Use a cygnal-dbg.log file instead of
+       gnash-dbg.log. Use boost bind variables for all threads.
+       * cygnal/http.{cpp,h}: Add methods for encoding HTTP header
+       fields. Use a real date, instead of the bogus one. Check the file
+       types to set the Content-Type HTTP field correctly.
+       * cygnal/stream.cpp: Comment out lotsa debug messages.
+       * cygnal/Makefile.am: Drop DIST_SUBDIRS, they don't compile
+       for anything but win32 anyway. Add testsuite directory.
+       * cygnal/testsuite: New testsuite directory. It's here rather than
+       in gnash/testsuite since these tests are very different from
+
+       ones gnash needs for most things.
+       * cygnal/testsuite/Makefile.am: New Makefile for Cygnal test
+       directories.
+       * cygnal/testsuite/cygnal.all: Cygnal specific test cases live
+       here.
+       * cygnal/testsuite/cygnal.all/Makefile.am: Build the test cases
+       and run DejaGnu on them.
+       * cygnal/testsuite/cygnal.all/test_http.cpp: Test case for HTTP
+       protocol.
+       * configure.ac: Add new cygnal/testsuite Makefiles.
+       * cygnal/testsuite/simpe.exp: clone the one used currently for
+       Gnash testing.
+
 2007-12-10 Sandro Santilli <address@hidden>
 
+       * testsuite/actionscript.all/Makefile.am: fix abs_mediadir to
+         contain quotes. Prior version failed building XML-*.swf files,
+         dunno if this patch breaks POSIX compatibility.
+
        * utilities/processor.cpp: check for quit request right
          after calling movie_root::setRootMovie, as that would
          execute actions in first frame.

Index: cygnal/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/cygnal/Makefile.am,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- cygnal/Makefile.am  18 Jul 2007 14:26:34 -0000      1.8
+++ cygnal/Makefile.am  11 Dec 2007 03:23:02 -0000      1.9
@@ -16,13 +16,15 @@
 #   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 
-# $Id: Makefile.am,v 1.8 2007/07/18 14:26:34 strk Exp $
-
 ## Process this file with automake to generate Makefile.in
 
 AUTOMAKE_OPTIONS = dejagnu
 
-DIST_SUBDIRS  = ACT IO HTTP Net unit_tests 
+SUBDIRS = \
+       . \
+       testsuite
+
+#DIST_SUBDIRS  = ACT IO HTTP Net unit_tests 
 
 AM_CPPFLAGS = # -Wall
 
@@ -79,7 +81,3 @@
 mudflap:
        @echo "Rebuilding with GCC Mudflap support"
        $(MAKE) CXXFLAGS="$(CXXFLAGS) $(MUDFLAP_OPT)" LIBS="$(LIBS) 
$(MUDFLAP_LIB)"
-
-# EXTRA_PROGRAMS = talloc
-# talloc_SOURCES = talloc.cpp
-# talloc_LDADD = $(AM_LDFLAGS)

Index: cygnal/cygnal.cpp
===================================================================
RCS file: /sources/gnash/gnash/cygnal/cygnal.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- cygnal/cygnal.cpp   5 Sep 2007 16:53:34 -0000       1.14
+++ cygnal/cygnal.cpp   11 Dec 2007 03:23:02 -0000      1.15
@@ -17,7 +17,6 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 // 
 
-/* $Id: cygnal.cpp,v 1.14 2007/09/05 16:53:34 nihilus Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -30,9 +29,9 @@
 #include <cerrno>
 
 extern "C"{
-        #include <unistd.h>
+# include <unistd.h>
 #ifdef HAVE_GETOPT_H
-        #include <getopt.h>
+# include <getopt.h>
 #endif
 #ifndef __GNUC__
         extern int optind, getopt(int, char *const *, const char *);
@@ -40,7 +39,6 @@
 #endif
 }
 
-#include "stream.h"
 #include "network.h"
 #include "log.h"
 #include "rc.h"
@@ -49,6 +47,7 @@
 #include "limits.h"
 #include "netstats.h"
 #include "statistics.h"
+#include "stream.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -59,8 +58,10 @@
 #include <locale.h>
 #endif
 
+#include <boost/date_time/gregorian/gregorian.hpp>
+//#include <boost/date_time/local_time/local_time.hpp>
+#include <boost/date_time/time_zone_base.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
-
 #include <boost/thread/thread.hpp>
 #include <boost/bind.hpp>
 
@@ -75,10 +76,11 @@
 static void cntrlc_handler(int sig);
 
 //static void start_thread();
-static void rtmp_thread();
-static void http_thread();
-static void ssl_thread();
+static void rtmp_thread(struct thread_params *conndata);
+static void http_thread(struct thread_params *conndata);
+static void ssl_thread(struct thread_params *conndata);
 static void stream_thread(struct thread_params *sendfile);
+static void dispatch_thread(struct thread_params *params);
 
 namespace {
 gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
@@ -87,6 +89,7 @@
 
 struct thread_params {
     int netfd;
+    int port;
     char filespec[256];
     Statistics *statistics;
 };
@@ -115,6 +118,8 @@
 int
 main(int argc, char *argv[])
 {
+    dbglogfile.openLog("cygnal-dbg.log");
+    
     // Initialize national language support
 #ifdef ENABLE_NLS
     setlocale (LC_MESSAGES, "");
@@ -160,7 +165,7 @@
        log_msg (_("Document Root for media files is: %s"),
                   docroot);
     } else {
-       docroot = "/var/www";
+       docroot = "/var/www/html/software/gnash/tests/";
     }
     
     while ((c = getopt (argc, argv, "hvwp:")) != -1) {
@@ -198,14 +203,28 @@
     act.sa_handler = cntrlc_handler;
     sigaction (SIGINT, &act, NULL);
 
-    boost::thread rtmp_port(&rtmp_thread);
-    boost::thread http_port(&http_thread);
-    boost::thread ssl_port(&ssl_thread);
+    struct thread_params rtmp_data;
+    struct thread_params http_data;
+    struct thread_params ssl_data;
+    rtmp_data.port = 1935;
+//    boost::thread rtmp_port(boost::bind(&rtmp_thread, &rtmp_data));
+
+    http_data.port = 4080;
+    Statistics st;
+    http_data.statistics = &st;
+    boost::thread http_port(boost::bind(&http_thread, &http_data));
+
+    ssl_data.port = 4443;
+//    boost::thread ssl_port(boost::bind(&ssl_thread, &ssl_data));
+    
+//    boost::thread rtmp_port(&rtmp_thread);
+//    boost::thread http_port(&http_thread);
+//    boost::thread ssl_port(&ssl_thread);
 
     // wait for the thread to finish
-    rtmp_port.join();
+//    rtmp_port.join();
     http_port.join();
-    ssl_port.join();
+//    ssl_port.join();
 
     log_msg (_("All done I think..."));
     
@@ -213,56 +232,35 @@
 }
 
 static void
-rtmp_thread()
+dispatch_thread(struct thread_params *params)
 {
     GNASH_REPORT_FUNCTION;
-    int retries = 0;
-    RTMPproto proto;
-    
-    Statistics st;
-    st.setFileType(NetStats::RTMP);
-    
-    proto.createServer(RTMP);
-    while (retries++ < thread_retries) {
-       log_msg(_("%s: Thread for RTMP port looping..."), __PRETTY_FUNCTION__);
-       proto.newConnection(true);
-       st.startClock();
-       proto.handShakeWait();
-       proto.handShakeResponse();
-       proto.serverFinish();
-       
-       // Keep track of the network statistics
-       st.stopClock();
-       log_msg (_("Bytes read: %d"), proto.getBytesIn());
-       log_msg (_("Bytes written: %d"), proto.getBytesOut());
-       st.setBytes(proto.getBytesIn() + proto.getBytesOut());
-       st.addStats();
-       proto.resetBytesIn();
-       proto.resetBytesOut();  
-    }    
+    log_msg("Param port is: %d", params->port);
 }
 
 static void
-http_thread()
+http_thread(struct thread_params *conndata)
 {
     GNASH_REPORT_FUNCTION;
     int retries = 0;
     HTTP www;
-    struct thread_params thread_data;
+//    struct thread_params thread_data;
     string url, filespec, parameters;
     string::size_type pos;
     int port = RTMPT + port_offset;
     int filesize;
     struct stat filestats;
 
+    www.toggleDebug(true);
+    
     www.createServer(port);
     while (retries++ < thread_retries) {
        log_msg(_("%s: Thread for port %d looping..."), __PRETTY_FUNCTION__, 
port);
        www.newConnection(true);
-       Statistics st;
-       st.setFileType(NetStats::RTMPT);
-       st.startClock();
-       thread_data.netfd = www.getFileFd();
+
+       conndata->statistics->setFileType(NetStats::RTMPT);
+       conndata->statistics->startClock();
+       conndata->netfd = www.getFileFd();
        url = docroot;
        url += www.waitForGetRequest();
        pos = url.find("?");
@@ -274,36 +272,73 @@
        } else {
            filesize = 0;
        }
+       
+       www.getFileType(filespec);
        www.sendGetReply(filesize);
-       strcpy(thread_data.filespec, filespec.c_str());
-       thread_data.statistics = &st;
+//     strcpy(thread_data.filespec, filespec.c_str());
+//     thread_data.statistics = conndata->statistics;
        
        // Keep track of the network statistics
-       st.stopClock();
+       conndata->statistics->stopClock();
 //     log_msg (_("Bytes read: %d"), www.getBytesIn());
 //     log_msg (_("Bytes written: %d"), www.getBytesOut());
 //     st.setBytes(www.getBytesIn() + www.getBytesOut());
-       st.addStats();
+       conndata->statistics->addStats();
 //     www.resetBytesIn();
 //     www.resetBytesOut();
        
        if (url != docroot) {
            log_msg (_("File to load is: %s"), filespec.c_str());
            log_msg (_("Parameters are: %s"), parameters.c_str());
-           memcpy(thread_data.filespec, filespec.c_str(), filespec.size());
-           boost::thread sendthr(boost::bind(&stream_thread, &thread_data));
+           memset(conndata->filespec, 0, 256);
+           memcpy(conndata->filespec, filespec.c_str(), filespec.size());
+           boost::thread sendthr(boost::bind(&stream_thread, conndata));
            sendthr.join();
        }
        // See if this is a persistant connection
-       if (!www.keepAlive()) {
-           www.closeConnection();
+//     if (!www.keepAlive()) {
+//         www.closeConnection();
+//     }
+       conndata->statistics->dump();
        }
+}
+
+static void
+rtmp_thread(struct thread_params *conndata)
+{
+    GNASH_REPORT_FUNCTION;
+    int retries = 0;
+    RTMPproto proto;
+    
+    Statistics st;
+    st.setFileType(NetStats::RTMP);
+
+    log_msg("Param port is: %d", conndata->port);
+    
+    proto.createServer(RTMP);
+    while (retries++ < thread_retries) {
+       log_msg(_("%s: Thread for RTMP port looping..."), __PRETTY_FUNCTION__);
+       proto.newConnection(true);
+       st.startClock();
+       proto.handShakeWait();
+       proto.handShakeResponse();
+       proto.serverFinish();
+       
+       // Keep track of the network statistics
+       st.stopClock();
+       log_msg (_("Bytes read: %d"), proto.getBytesIn());
+       log_msg (_("Bytes written: %d"), proto.getBytesOut());
+       st.setBytes(proto.getBytesIn() + proto.getBytesOut());
+       st.addStats();
+       proto.resetBytesIn();
+       proto.resetBytesOut();  
+
+       st.dump();
     }
-//    st.dump();
 }
 
 static void
-ssl_thread()
+ssl_thread(struct thread_params *conndata)
 {
     GNASH_REPORT_FUNCTION;
     int retries = 0;
@@ -318,6 +353,7 @@
     
     www.createServer(port);
     
+    log_msg("Param port is: %d", conndata->port);
     while (retries++ < thread_retries) {
        log_msg (_("%s: Thread for port %d looping..."), __PRETTY_FUNCTION__, 
port);
        www.newConnection(true);
@@ -328,7 +364,6 @@
     }
 }
 
-
 static void
 stream_thread(struct  thread_params *params)
 {
@@ -342,8 +377,10 @@
     Stream str;
     str.open(params->filespec, params->netfd, params->statistics);
     str.play();
+//    ::close(params->netfd);
 }
 
+
 // Trap Control-C so we can cleanly exit
 static void
 cntrlc_handler (int /*sig*/)

Index: cygnal/http.cpp
===================================================================
RCS file: /sources/gnash/gnash/cygnal/http.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- cygnal/http.cpp     1 Jul 2007 10:53:49 -0000       1.9
+++ cygnal/http.cpp     11 Dec 2007 03:23:02 -0000      1.10
@@ -17,16 +17,20 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: http.cpp,v 1.9 2007/07/01 10:53:49 bjacques Exp $ */
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #include <boost/thread/mutex.hpp>
+#include <boost/date_time/gregorian/gregorian.hpp>
+//#include <boost/date_time/local_time/local_time.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+//#include <boost/date_time/time_zone_base.hpp>
 #include <string>
 #include <iostream>
 #include <cstring>
+#include <sys/types.h>
+#include <sys/stat.h>
 #include "http.h"
 #include "log.h"
 
@@ -35,7 +39,6 @@
 
 static boost::mutex stl_mutex;
 
-
 namespace cygnal
 {
 
@@ -85,15 +88,15 @@
     }
     
     extractMethod(buffer);
-//     extractReferer(buffer);
-//     extractHost(buffer);
+    extractReferer(buffer);
+    extractHost(buffer);
     extractAgent(buffer);
     extractLanguage(buffer);
     extractCharset(buffer);
     extractConnection(buffer);
-//     extractEncoding(buffer);
-//     extractTE(buffer);
-//    dump();
+    extractEncoding(buffer);
+    extractTE(buffer);
+    dump();
 
     // See if we got a legit GET request
     if (strncmp(buffer, "GET ", 4) == 0) {
@@ -106,40 +109,221 @@
 }
 
 bool
-HTTP::sendGetReply(int filesize)
+HTTP::formatHeader(const short type)
+{
+    GNASH_REPORT_FUNCTION;
+
+    formatHeader(0, type);
+}
+
+
+bool
+HTTP::formatHeader(int filesize, const short type)
+{
+    GNASH_REPORT_FUNCTION;
+
+    _header << "HTTP/1.1 200 OK" << endl;
+//    _header << "Server: Cygnal/0.8.1 (Linux)" << endl;
+    this->formatDate();
+    this->formatConnection("close");
+//     _header << "Accept-Ranges: bytes" << endl;
+    this->formatContentLength(filesize);
+    this->formatContentType();
+    // All HTTP messages are followed by a blank line.
+    this->terminateHeader();
+}
+
+bool
+HTTP::formatDate()
+{
+    GNASH_REPORT_FUNCTION;
+    boost::posix_time::ptime now = 
boost::posix_time::second_clock::local_time();
+    
+//    cout <<  now.time_of_day() << endl;
+    
+    boost::gregorian::date d(now.date());
+//     boost::gregorian::date d(boost::gregorian::day_clock::local_day());
+//     cout << boost::posix_time::to_simple_string(now) << endl;
+//     cout << d.day_of_week() << endl;
+//     cout << d.day() << endl;
+//     cout << d.year() << endl;
+//     cout << d.month() << endl;
+    
+//    boost::date_time::time_zone_ptr zone(new posix_time_zone("MST"));
+//    boost::date_time::time_zone_base b(now "MST");
+//    cout << zone.dst_zone_abbrev() << endl;
+
+    _header << "Date: " << d.day_of_week();
+    _header << ", " << d.day();
+    _header << " "  << d.month();
+    _header << " "  << d.year();
+    _header << " "  << now.time_of_day();
+    _header << " GMT" << endl;
+
+}
+
+bool
+HTTP::formatMethod(const char *data)
+{
+    GNASH_REPORT_FUNCTION;
+    _header << "Method: " << data << endl;
+}
+
+bool
+HTTP::formatReferer(const char *refer)
+{
+    GNASH_REPORT_FUNCTION;
+    _header << "Referer: " << refer << endl;
+}
+
+bool
+HTTP::formatConnection(const char *options)
+{
+    GNASH_REPORT_FUNCTION;
+    _header << "Connection: " << options << endl;
+}
+
+bool
+HTTP::formatContentType()
+{
+    return formatContentType(_filetype);
+}
+
+bool
+HTTP::formatContentType(filetype_e filetype)
+{
+    GNASH_REPORT_FUNCTION;
+    
+    switch (filetype) {
+      case HTML:
+         _header << "Content-Type: text/html; charset=UTF-8" << endl;
+         break;
+      case SWF:
+//       _header << "Content-Type: application/x-shockwave-flash" << endl;
+         _header << "Content-Type: application/futuresplash" << endl;
+         break;
+      case VIDEO:
+         _header << "Content-Type: video/flv" << endl;
+         break;
+      case MP3:
+         _header << "Content-Type: audio/mpeg" << endl;
+         break;
+      default:
+         _header << "Content-Type: text/html; charset=UTF-8" << endl;
+    }
+}
+
+bool
+HTTP::formatContentLength(int filesize)
+{
+    GNASH_REPORT_FUNCTION;
+    _header << "Content-Length: " << filesize << endl;
+}
+
+bool
+HTTP::formatHost(const char *host)
+{
+    GNASH_REPORT_FUNCTION;
+    _header << "Host: " << host << endl;
+}
+
+bool
+HTTP::formatAgent(const char *agent)
+{
+    GNASH_REPORT_FUNCTION;
+    _header << "User-Agent: " << agent << endl;
+}
+
+bool
+HTTP::formatLanguage(const char *lang)
 {
     GNASH_REPORT_FUNCTION;
-    boost::posix_time::ptime now = 
boost::posix_time::microsec_clock::local_time();
 
-    now.time_of_day();
+    // For some browsers this appears to also be Content-Language
+    _header << "Accept-Language: " << lang << endl;
+}
     
-    const char reply[] =
-        "HTTP/1.1 200 OK\r\n"
-        "Date: Sun, 20 Apr 2006 04:20:00 GMT\r\n"
-        "Content-Type: application/futuresplash\r\n"
-        "Connection: close\r\n"
-        "Content-Length: XX      \r\n"
-        "\r\n"                  // All HTTP messages are followed by a blank 
line.
-        ;
-
-    // This is a bit ugly, but we splice the file size onto the request string
-    // without any memory allocation, which could incur a small performance 
hit.
-    char *length = strstr(reply, " XX");
-    sprintf(length, " %d", filesize);
-// FIXME:  Doesn't this write to a const array?  And doesn't it fail to
-// supply the two \r\n's needed to finish the string?  --gnu
+bool
+HTTP::formatCharset(const char *set)
+{
+    GNASH_REPORT_FUNCTION;
+    // For some browsers this appears to also be Content-Charset
+    _header << "Accept-Charset: " << set << endl;
+}
     
-    int ret = writeNet(reply, strlen(reply));
+bool
+HTTP::formatEncoding(const char *code)
+{
+    GNASH_REPORT_FUNCTION;
+    _header << "Accept-Encoding: " << code << endl;
+}
 
-    if (ret >= 0 && (unsigned)ret == strlen(reply)) {
-        log_msg (_("Sent GET Reply: %s"), reply);
+bool
+HTTP::formatTE(const char *te)
+{
+    GNASH_REPORT_FUNCTION;
+    _header << "TE: " << te << endl;
+}
+
+bool
+HTTP::sendGetReply(int filesize)
+{
+    GNASH_REPORT_FUNCTION;
+    
+//     const char reply[] =
+//         "HTTP/1.1 200 OK\r\n"
+//         "Date: Sun, 20 Apr 2006 04:20:00 GMT\r\n"
+//         "Content-Type: application/futuresplash\r\n"
+//         "Connection: close\r\n"
+//         "Content-Length: XX      \r\n"
+//         "\r\n"                  // All HTTP messages are followed by a 
blank line.
+//         ;
+
+// //     // This is a bit ugly, but we splice the file size onto the request 
string
+// //     // without any memory allocation, which could incur a small 
performance hit.
+//      char *length = strstr(reply, " XX");
+//      sprintf(length, " %d", filesize);
+//      case SWF:
+//       _header << "Content-Type: application/futuresplash" << endl;
+//       break;
+ // // FIXME:  Doesn't this write to a const array?  And doesn't it fail to
+// // // supply the two \r\n's needed to finish the string?  --gnu
+
+    formatHeader(filesize, RTMP);
+    int ret = writeNet(_header.str().c_str(), _header.str().size());
+
+    if (ret >= 0 && (unsigned)ret == _header.str().size()) {
+        log_msg (_("Sent GET Reply"));
+//        log_msg (_("Sent GET Reply: %s"), _header.str().c_str());
     } else {
         log_msg (_("Couldn't send GET Reply, writeNet returned %d"), ret);
-       // TODO: FIXME: shouldn't we return false here ?
+       return false;
     }
+//    cout << "GET Header is:" << endl << _header.str() << endl;
     return true; // Default to true
 }
 
+bool
+HTTP::formatRequest(const char *url, http_method_e req)
+{
+    GNASH_REPORT_FUNCTION;
+
+    _header.str("");
+
+    _header << req << " " << url << "HTTP/1.1" << endl;
+    _header << "User-Agent: Opera/9.01 (X11; Linux i686; U; en)" << endl;
+    _header << "Accept: text/html, application/xml;q=0.9, 
application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, 
*/*;q=0.1" << endl;
+
+    _header << "Accept-Language: en" << endl;
+    _header << "Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1" << endl;
+    
+    _header << "Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0" << 
endl;
+    _header << "Referer: " << url << endl;
+
+    _header << "Connection: Keep-Alive, TE" << endl;
+    _header << "TE: deflate, gzip, chunked, identity, trailers" << endl;
+    
+}
 // bool
 // HTTP::sendGetReply(Network &net)
 // {
@@ -373,6 +557,58 @@
     return keepAlive(_connection.c_str());
 }
 
+    // Get the file type, so we know how to set the
+    // Content-type in the header.
+HTTP::filetype_e
+HTTP::getFileType(std::string filespec)
+{
+    GNASH_REPORT_FUNCTION;    
+    bool try_again = true;
+    string actual_filespec = filespec;
+    struct stat st;
+
+    while (try_again) {
+       try_again = false;
+       if (stat(actual_filespec.c_str(), &st) == 0) {
+           // If it's a directory, then we emulate what apache
+           // does, which is to load the index.html file in that
+           // directry if it exists.
+           if (S_ISDIR(st.st_mode)) {
+               log_msg("%s is a directory\n", actual_filespec.c_str());
+               if (actual_filespec[actual_filespec.size()-1] != '/') {
+                   actual_filespec += '/';
+               }
+               actual_filespec += "index.html";
+               try_again = true;
+               continue;
+           } else {            // not a directory
+               log_msg("%s is not a directory\n", actual_filespec.c_str());
+               string::size_type pos;
+               pos = filespec.rfind(".");
+               if (pos != string::npos) {
+                   string suffix = filespec.substr(pos, filespec.size());
+                   if (suffix == "html") {
+                       _filetype = HTML;
+                       log_msg("HTML content found");
+                   }
+                   if (suffix == "swf") {
+                       _filetype = SWF;
+                       log_msg("SWF content found");
+                   }
+                   if (suffix == "flv") {
+                       _filetype = VIDEO;
+                       log_msg("FLV content found");
+                   }
+                   if (suffix == "mp3") {
+                       _filetype = AUDIO;
+                       log_msg("MP3 content found");
+                   }
+               }
+           }
+       } // end of stat()
+    } // end of try_waiting
+}
+
 void
 HTTP::dump() {
     GNASH_REPORT_FUNCTION;

Index: cygnal/http.h
===================================================================
RCS file: /sources/gnash/gnash/cygnal/http.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- cygnal/http.h       1 Jul 2007 10:53:49 -0000       1.7
+++ cygnal/http.h       11 Dec 2007 03:23:02 -0000      1.8
@@ -24,9 +24,6 @@
 #endif
 
 #include "network.h"
-
-#include <boost/date_time/posix_time/posix_time.hpp> //include all types plus 
i/o
-
 #include <string>
 #include <map>
 
@@ -100,6 +97,15 @@
         const char *code;
         const char *msg;
     };
+    typedef enum {
+       NONE,
+       HTML,
+       SWF,
+       VIDEO,
+       AUDIO,
+       MP3,
+       OSCP
+    } filetype_e;
     HTTP();
     ~HTTP();
     std::string waitForGetRequest();
@@ -122,10 +128,41 @@
     std::string extractCharset(const char *data);
     std::string extractEncoding(const char *data);
     std::string extractTE(const char *data);
+
+    // These methods add data to the fields in the HTTP header.
+    bool clearHeader() { _header.str(""); };
+    bool formatHeader(int filesize, const short type);
+    bool formatHeader(const short type);
+    bool formatRequest(const char *url, http_method_e req);
+    bool formatMethod(const char *data);
+    bool formatDate();
+    bool formatReferer(const char *data);
+    bool formatConnection(const char *data);
+    bool formatContentLength(int filesize);
+    bool formatContentType();
+    bool formatContentType(filetype_e type);
+    bool formatHost(const char *data);
+    bool formatAgent(const char *data);
+    bool formatLanguage(const char *data);
+    bool formatCharset(const char *data);
+    bool formatEncoding(const char *data);
+    bool formatTE(const char *data);
+
     bool keepAlive(const char *data);
     bool keepAlive();
+
+    // All HTTP messages are terminated with a blank line
+    void terminateHeader() { _header << std::endl; };
+    
+    // Return the header that's been built up.
+    std::string getHeader() { return _header.str(); };
+
+    // Get the file type, so we know how to set the
+    // Content-type in the header.
+    filetype_e getFileType(std::string filespec);
     void dump();
 private:
+    filetype_e  _filetype;
     std::string _filespec;
     std::string _url;
     std::map<int, struct status_codes *> _status_codes;
@@ -134,11 +171,13 @@
     std::string _referer;
     std::string _connection;
     std::string _host;
+    int         _port;
     std::string _agent;
     std::string _language;
     std::string _charset;
     std::string _encoding;
     std::string _te;
+    std::stringstream _header;
 };  
     
 } // end of cygnal namespace

Index: cygnal/netstats.cpp
===================================================================
RCS file: /sources/gnash/gnash/cygnal/netstats.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- cygnal/netstats.cpp 1 Jul 2007 10:53:50 -0000       1.7
+++ cygnal/netstats.cpp 11 Dec 2007 03:23:02 -0000      1.8
@@ -16,7 +16,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: netstats.cpp,v 1.7 2007/07/01 10:53:50 bjacques Exp $ */
+/* $Id: netstats.cpp,v 1.8 2007/12/11 03:23:02 rsavoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -31,25 +31,29 @@
 
 namespace cygnal {
 
-NetStats::NetStats() {
-    GNASH_REPORT_FUNCTION;
+NetStats::NetStats()
+{
+//    GNASH_REPORT_FUNCTION;
 }
 
-NetStats::~NetStats() {
-    GNASH_REPORT_FUNCTION;    
+NetStats::~NetStats()
+{
+//    GNASH_REPORT_FUNCTION;    
 }
 
 boost::posix_time::ptime
-NetStats::startClock() {
-    GNASH_REPORT_FUNCTION;
+NetStats::startClock()
+{
+//    GNASH_REPORT_FUNCTION;
 
     _starttime = boost::posix_time::microsec_clock::local_time();
     return _stoptime;
 }
 
 boost::posix_time::ptime
-NetStats::stopClock() {
-    GNASH_REPORT_FUNCTION;
+NetStats::stopClock()
+{
+//    GNASH_REPORT_FUNCTION;
     
     _stoptime = boost::posix_time::microsec_clock::local_time();
     return _stoptime;

Index: cygnal/netstats.h
===================================================================
RCS file: /sources/gnash/gnash/cygnal/netstats.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- cygnal/netstats.h   1 Jul 2007 10:53:50 -0000       1.4
+++ cygnal/netstats.h   11 Dec 2007 03:23:02 -0000      1.5
@@ -23,7 +23,8 @@
 #include "config.h"
 #endif
 
-#include <boost/date_time/posix_time/posix_time.hpp> //include all types plus 
i/o
+//include all types plus i/o
+#include <boost/date_time/posix_time/posix_time.hpp>
 
 namespace cygnal 
 {

Index: cygnal/stream.cpp
===================================================================
RCS file: /sources/gnash/gnash/cygnal/stream.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- cygnal/stream.cpp   1 Jul 2007 10:53:50 -0000       1.7
+++ cygnal/stream.cpp   11 Dec 2007 03:23:03 -0000      1.8
@@ -17,8 +17,6 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: stream.cpp,v 1.7 2007/07/01 10:53:50 bjacques Exp $ */
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -53,7 +51,7 @@
 static void
 sendfile_thread()
 {
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
     
     struct stat stats;
     struct filedes loadfile;
@@ -84,6 +82,8 @@
                       (void *)fdptr);
        }
        
+       printf("FIXME: st_dev is: %d\n", stats.st_dev);
+    
 //     if (stats.st_size > 1024*8) {
 //     }
        
@@ -132,23 +132,23 @@
       _seekptr(0),
       _filesize(0)
 {
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
     
 }
 
 Stream::~Stream() {
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
     if (_filefd) {
         close(_filefd);
     }
     if (_netfd) {
-        close(_netfd);
+       ::close(_netfd);
     }
 }
 
 bool
 Stream::open(const char *filespec) {
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
     
     return open(filespec, _netfd);
 }
@@ -156,7 +156,7 @@
 bool
 Stream::open(const char *filespec, int /*netfd*/)
 {
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
 
     //struct stat stats;
     // TODO: should we use the 'netfd' passed as parameter instead ?
@@ -199,6 +199,7 @@
             _state = OPEN;
             return true;
        }
+       ::close(_filefd);
 //     if (stats.st_size > 1024*8) {
 //     }
        
@@ -217,14 +218,14 @@
 // Stream the movie
 bool
 Stream::play() {
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
 
     return play(_netfd);
 }
 
 bool
 Stream::play(int netfd) {
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
 
     _netfd = netfd;
     _state = PLAY;
@@ -276,7 +277,7 @@
 // Stream a preview, instead of the full movie.
 bool
 Stream::preview(const char* /*filespec*/, int /*frames*/) {
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
 
     _state = PREVIEW;
     return true; // Default to true    
@@ -285,7 +286,7 @@
 // Stream a series of thumbnails
 bool
 Stream::thumbnail(const char* /*filespec*/, int /*quantity*/) {
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
     
     _state = THUMBNAIL;
     return true; // Default to true
@@ -294,7 +295,7 @@
 // Pause the stream
 bool
 Stream::pause(int /*frame*/) {
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
     
     _state = PAUSE;
     return true; // Default to true
@@ -303,7 +304,7 @@
 // Seek within the stream
 bool
 Stream::seek(int /*frame*/) {
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
     
     _state = SEEK;
     return true; // Default to true    
@@ -312,7 +313,7 @@
 // Upload a stream into a sandbox
 bool
 Stream::upload(const char* /*filespec*/) {
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
     
     _state = UPLOAD;
     return true; // Default to true
@@ -320,7 +321,7 @@
 
 // Stream a single "real-time" source.
 bool Stream::multicast(const char* /*filespec*/) {
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
     
     _state = MULTICAST;
     return true; // Default to true    

Index: cygnal/testsuite/Makefile.am
===================================================================
RCS file: cygnal/testsuite/Makefile.am
diff -N cygnal/testsuite/Makefile.am
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cygnal/testsuite/Makefile.am        11 Dec 2007 03:23:03 -0000      1.1
@@ -0,0 +1,24 @@
+# 
+#   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
+#   the Free Software Foundation; either version 3 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program; if not, write to the Free Software
+#   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+
+## Process this file with automake to generate Makefile.in
+
+AUTOMAKE_OPTIONS = 
+
+SUBDIRS = cygnal.all
+

Index: cygnal/testsuite/simple.exp
===================================================================
RCS file: cygnal/testsuite/simple.exp
diff -N cygnal/testsuite/simple.exp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cygnal/testsuite/simple.exp 11 Dec 2007 03:23:03 -0000      1.1
@@ -0,0 +1,110 @@
+
+load_lib "dejagnu.exp"
+
+
+# If tracing has been enabled at the top level, then turn it on here
+# too.
+if $tracelevel {
+    strace $tracelevel
+}
+
+# After these many seconds of execution the test script is aborted with a 
failure.
+# This is to handle deadlocks. We don't reset the timeout when a match is
+# found to avoid hanging in case of a testcase sending matches in an infinite 
loops.
+# (not unlikely as it seems, think about flash movies...)
+set timeout 600
+set file all
+set params ""
+
+# testcases is set by the Makefile in the site.exp data file.
+foreach file $testcases {
+
+    verbose "Running test $file"
+
+    # spawn the executable and look for the DejaGnu output messages from the
+    # test case.
+
+    # this version of the call allows use of 'wait' to check return code
+    # -open [open "|cmd" "r"] doesn't work for that
+    spawn -noecho ./$file 
+
+    expect {
+       -re "^\[^\n]*NOTE:\[^\n]*\n" {
+           regsub ".*NOTE: " $expect_out(0,string) "" output
+           set output [string range $output 0 end-2]
+           verbose "${file} $output" 
+           exp_continue -continue_timer
+       }
+       -re "^\[^\n]*XPASSED:\[^\n]*\n" {
+           regsub ".*XPASSED: " $expect_out(0,string) "" output
+           set output [string range $output 0 end-2]
+           xpass "${file}: $output"
+           exp_continue -continue_timer
+       }
+       -re "^\[^\n]*PASSED:\[^\n]*\n" {
+           regsub ".*PASSED: " $expect_out(0,string) "" output
+           set output [string range $output 0 end-2]
+           pass "${file}: $output"
+           exp_continue -continue_timer
+       }
+       -re "^\[^\n]*XFAILED:\[^\n]*\n" {
+           regsub ".*XFAILED: " $expect_out(0,string) "" output
+           set output [string range $output 0 end-2] 
+           xfail "${file}: $output"
+           exp_continue -continue_timer
+       }
+       -re "^\[^\n]*FAILED:\[^\n]*\n" {
+           regsub ".*FAILED: " $expect_out(0,string) "" output
+           set output [string range $output 0 end-2] 
+           fail "${file}: $output"
+           exp_continue -continue_timer
+       }
+       -re "^\[^\n]*UNTESTED:\[^\n]*\n" {
+           regsub ".*UNTESTED: " $expect_out(0,string) "" output
+           set output [string range $output 0 end-2]
+           untested "${file}: $output"
+           exp_continue -continue_timer
+       }
+       -re "^\[^\n]*UNRESOLVED:\[^\n]*\n" {
+           regsub ".*UNRESOLVED: " $expect_out(0,string) "" output
+           set output [string range $output 0 end-2]
+           unresolved "${file}: $output"
+           exp_continue -continue_timer
+       }
+       -re "^\[^\n]*\n" {
+            # just remove non-matching lines!
+            exp_continue -continue_timer
+       }
+       eof {
+           #       unresolved "${file} died prematurely"
+           #       catch close
+           #       return "${file} died prematurely"
+       }
+       timeout {
+               fail "Test case ${file} still running after ${timeout} seconds, 
killing it (deadlock?)"
+               catch close
+               continue;
+       }
+   }
+
+       # wait for the process to coplete to
+       # check return code
+       set retcode [wait]
+
+       # debugging
+       #set i 0; foreach j $retcode { print "${file} wait($i) $j"; incr i }
+
+       if { [ llength $retcode ] > 5 } {
+               fail "${file} died prematurely ([lindex $retcode 6])"
+       }
+       if { [ lindex $retcode 3 ] != 0 } {
+               fail "${file} exited with non-zero code ([lindex $retcode 3])"
+       }
+
+
+
+    # force a close of the executable to be safe.
+    catch close
+}
+
+

Index: cygnal/testsuite/cygnal.all/Makefile.am
===================================================================
RCS file: cygnal/testsuite/cygnal.all/Makefile.am
diff -N cygnal/testsuite/cygnal.all/Makefile.am
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cygnal/testsuite/cygnal.all/Makefile.am     11 Dec 2007 03:23:03 -0000      
1.1
@@ -0,0 +1,69 @@
+# 
+#   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
+#   the Free Software Foundation; either version 3 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program; if not, write to the Free Software
+#   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+
+## Process this file with automake to generate Makefile.in
+
+AUTOMAKE_OPTIONS = dejagnu
+
+AM_CPPFLAGS = # -Wall
+
+AM_LDFLAGS = \
+       $(top_builddir)/libbase/libgnashbase.la \
+       $(top_builddir)/libamf/libgnashamf.la \
+       $(BOOST_LIBS) \
+       $(PTHREAD_LIBS)
+
+localedir = $(datadir)/locale
+
+INCLUDES = -I.. \
+        -I$(top_srcdir)        \
+        -I$(top_srcdir)/libamf \
+        -I$(top_srcdir)/libbase \
+        -I$(top_srcdir)/cygnal \
+        -DLOCALEDIR=\"$(localedir)\" \
+       $(BOOST_CFLAGS) \
+       $(PTHREAD_CFLAGS)
+
+check_PROGRAMS = test_http
+test_http_SOURCES = test_http.cpp ../../http.o
+test_http_LDADD = $(AM_LDFLAGS) ../../http.o
+test_http_DEPENDENCIES = site-update
+# Rebuild with GCC 4.x Mudflap support
+mudflap:
+       @echo "Rebuilding with GCC Mudflap support"
+       $(MAKE) CXXFLAGS="$(CXXFLAGS) $(MUDFLAP_OPT)" LIBS="$(LIBS) 
$(MUDFLAP_LIB)"
+
+TEST_DRIVERS = ../simple.exp
+
+check-DEJAGNU: site-update
+       @runtest=$(RUNTEST); \
+       if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+         $$runtest $(RUNTESTFLAGS) $(TEST_DRIVERS); true; \
+       else \
+         echo "WARNING: could not find \`runtest'" 1>&2; \
+         for i in "$(check_PROGRAMS)"; do \
+           $(SHELL) $$i; \
+         done; \
+       fi
+
+site-update: site.exp
+       @rm -fr site.exp.bak
+       @cp site.exp site.exp.bak
+       @sed -e '/testcases/d' site.exp.bak > site.exp
+       @echo "# This is a list of the pre-compiled testcases" >> site.exp
+       @echo "set testcases \"$(check_PROGRAMS)\"" >> site.exp

Index: cygnal/testsuite/cygnal.all/test_http.cpp
===================================================================
RCS file: cygnal/testsuite/cygnal.all/test_http.cpp
diff -N cygnal/testsuite/cygnal.all/test_http.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ cygnal/testsuite/cygnal.all/test_http.cpp   11 Dec 2007 03:23:03 -0000      
1.1
@@ -0,0 +1,302 @@
+ // 
+//   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
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_DEJAGNU_H
+
+#include <string>
+
+#include <unistd.h>
+#ifdef HAVE_GETOPT_H
+        #include <getopt.h>
+#endif
+
+#ifndef __GNUC__
+extern int optind, getopt(int, char *const *, const char *);
+#endif
+
+#include <sys/types.h>
+#include <iostream>
+#include <string>
+#include <regex.h>
+
+#include "log.h"
+#include "http.h"
+#include "dejagnu.h"
+
+using namespace cygnal;
+using namespace gnash;
+using namespace std;
+
+static void usage (void);
+
+static int verbosity;
+
+static TestState runtest;
+
+int
+main(int argc, char *argv[])
+{
+    int c;
+
+    while ((c = getopt (argc, argv, "hdvsm:")) != -1) {
+        switch (c) {
+          case 'h':
+            usage ();
+            break;
+            
+          case 'v':
+            verbosity++;
+            break;
+            
+          default:
+            usage ();
+            break;
+        }
+    }
+
+    HTTP http;
+
+    http.clearHeader();
+    http.formatDate();
+//    cerr << "FIXME: " << http.getHeader() << endl;
+
+    regex_t regex_pat;
+
+    // Check the Date field
+    // The date should look something like this:
+    //     Date: Mon, 10 Dec 2007  GMT
+    regcomp (&regex_pat, "[A-Z][a-z]*, [0-9]* [A-Z][a-z]* [0-9]* *GMT$",
+             REG_NOSUB|REG_NEWLINE);
+    if (regexec (&regex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0)) 
{
+        runtest.fail ("Date::formatDate()");
+    } else {
+        runtest.pass ("Date::formatDate()");
+    }
+    regfree(&regex_pat);
+
+    // Check the Content-Length field
+    http.clearHeader();
+    http.formatContentLength(12345);
+//    cerr << "FIXME: " << http.getHeader() << endl;
+    regcomp (&regex_pat, "Content-Length: [0-9]*$",
+             REG_NOSUB|REG_NEWLINE);
+    if (regexec (&regex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0)) 
{
+        runtest.fail ("Date::formatContentLength()");
+    } else {
+        runtest.pass ("Date::formatContentLength()");
+    }
+    regfree(&regex_pat);
+
+
+    // Check the Connection field
+//     bool formatConnection(const char *data);
+    http.clearHeader();
+    const char *data = "Keep-Alive";
+    http.formatConnection(data);
+//    cerr << "FIXME: " << http.getHeader() << endl;
+    regcomp (&regex_pat, "Connection: [A-za-z-]*",
+             REG_NOSUB|REG_NEWLINE);
+    if (regexec (&regex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0)) 
{
+        runtest.fail ("Date::formatConnection()");
+    } else {
+        runtest.pass ("Date::formatConnection()");
+    }
+    regfree(&regex_pat);
+
+    // Check the Host field
+//     bool formatHost(const char *data);
+    http.clearHeader();
+    data = "localhost:4080";
+    http.formatHost(data);
+//    cerr << "FIXME: " << http.getHeader() << endl;
+    regcomp (&regex_pat, "Host: [A-za-z-]*:[0-9]*$",
+             REG_NOSUB|REG_NEWLINE);
+    if (regexec (&regex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0)) 
{
+        runtest.fail ("Date::formatHost()");
+    } else {
+        runtest.pass ("Date::formatHost()");
+    }
+    regfree(&regex_pat);
+
+// Check the Language field
+//     bool formatLanguage(const char *data);
+    http.clearHeader();
+    data = "en-US,en;q=0.9";
+    http.formatLanguage(data);
+//    cerr << "FIXME: " << http.getHeader() << endl;
+    regcomp (&regex_pat, "Accept-Language: en-US,en;q=0.9$",
+             REG_NOSUB|REG_NEWLINE);
+    if (regexec (&regex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0)) 
{
+        runtest.fail ("Date::formatLanguage()");
+    } else {
+        runtest.pass ("Date::formatLanguage()");
+    }
+    regfree(&regex_pat);
+
+//     bool formatCharset(const char *data);
+// Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r
+    http.clearHeader();
+    data = "iso-8859-1, utf-8, utf-16, *;q=0.1";
+    http.formatCharset(data);
+//    cerr << "FIXME: " << http.getHeader() << endl;
+    regcomp (&regex_pat, "Accept-Charset: iso-8859-1.*$",
+             REG_NOSUB|REG_NEWLINE);
+    if (regexec (&regex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0)) 
{
+        runtest.fail ("Date::formatCharset()");
+    } else {
+        runtest.pass ("Date::formatCharset()");
+    }
+    regfree(&regex_pat);
+        
+//     bool formatEncoding(const char *data);
+    http.clearHeader();
+    data = "deflate, gzip, x-gzip, identity, *;q=0";
+    http.formatEncoding(data);
+//    cerr << "FIXME: " << http.getHeader() << endl;
+    regcomp (&regex_pat, "Accept-Encoding: deflate, gzip.*$",
+             REG_NOSUB|REG_NEWLINE);
+    if (regexec (&regex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0)) 
{
+        runtest.fail ("Date::formatEncoding()");
+    } else {
+        runtest.pass ("Date::formatEncoding()");
+    }
+    regfree(&regex_pat);
+        
+        
+//     bool formatTE(const char *data);
+    http.clearHeader();
+    data = "deflate, gzip, chunked, identity, trailers";
+    http.formatTE(data);
+//    cerr << "FIXME: " << http.getHeader() << endl;
+    regcomp (&regex_pat, "TE: deflate, gzip,.*$",
+             REG_NOSUB|REG_NEWLINE);
+    if (regexec (&regex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0)) 
{
+        runtest.fail ("Date::formatTE()");
+    } else {
+        runtest.pass ("Date::formatTE()");
+    }
+    regfree(&regex_pat);
+
+//     bool formatAgent(const char *data);
+    http.clearHeader();
+    data = "Gnash 0.8.1-cvs (X11; Linux i686; U; en)";
+    http.formatAgent(data);
+//    cerr << "FIXME: " << http.getHeader() << endl;
+    regcomp (&regex_pat, "User-Agent: Gnash 0.8.1-cvs.*$",
+             REG_NOSUB|REG_NEWLINE);
+    if (regexec (&regex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0)) 
{
+        runtest.fail ("Date::formatAgent()");
+    } else {
+        runtest.pass ("Date::formatAgent()");
+    }
+    regfree(&regex_pat);
+
+    // Check the Content Type field. First we check with a
+    // specified field, then next to see if the default works.
+//     bool formatContentType();
+    http.clearHeader();
+    http.formatContentType(HTTP::SWF);
+//    cerr << "FIXME: " << http.getHeader() << endl;
+    regcomp (&regex_pat, "Content-Type: application/futuresplash.*$",
+             REG_NOSUB|REG_NEWLINE);
+    if (regexec (&regex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0)) 
{
+        runtest.fail ("Date::formatContentType(type)");
+    } else {
+        runtest.pass ("Date::formatConetnType(type)");
+    }
+    regfree(&regex_pat);
+
+    http.clearHeader();
+    http.formatContentType();
+//    cerr << "FIXME: " << http.getHeader() << endl;
+    regcomp (&regex_pat, "Content-Type: text/html.*$",
+             REG_NOSUB|REG_NEWLINE);
+    if (regexec (&regex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0)) 
{
+        runtest.fail ("Date::formatContentType()");
+    } else {
+        runtest.pass ("Date::formatContenType()");
+    }
+    regfree(&regex_pat);
+
+//     bool formatReferer(const char *data);
+    http.clearHeader();
+    data = "http://localhost/software/gnash/tests/index.html";;
+    http.formatReferer(data);
+//    cerr << "FIXME: " << http.getHeader() << endl;
+    regcomp (&regex_pat, "Referer: http://localhost.*index.html.*$";,
+             REG_NOSUB|REG_NEWLINE);
+    if (regexec (&regex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0)) 
{
+        runtest.fail ("Date::formatReferer()");
+    } else {
+        runtest.pass ("Date::formatReferer()");
+    }
+    regfree(&regex_pat);
+
+    // Check formatHeader()
+    http.clearHeader();
+    http.formatHeader(RTMP);
+//    cerr << "FIXME: " << http.getHeader() << endl;
+    regcomp (&regex_pat, "HTTP/1.1 200 
OK.*Date:.*Connection:.*-Length.*-Type:.*$",
+             REG_NOSUB);        // note that we do want to look for NL
+    if (regexec (&regex_pat, http.getHeader().c_str(), 0, (regmatch_t *)0, 0)) 
{
+        runtest.fail ("Date::formatHeader(port)");
+    } else {
+        runtest.pass ("Date::formatheader(port)");
+    }
+    regfree(&regex_pat);
+
+
+//     http.formatHeader(666, RTMP);
+//     http.formatRequest("http://localhost:4080";, HTTP::GET);
+    
+//     bool formatMethod(const char *data);
+        
+        
+//     void *out = amf_obj.encodeNumber(*num);
+
+//     if (memcmp(out, buf, 9) == 0) {
+//         runtest.pass("Encoded AMF Number");
+//     } else {
+//         runtest.fail("Encoded AMF Number");
+//     }
+
+//    delete num;
+}
+static void
+usage (void)
+{
+    cerr << "This program tests HTTP protocol support." << endl;
+    cerr << "Usage: test_http [hv]" << endl;
+    cerr << "-h\tHelp" << endl;
+    cerr << "-v\tVerbose" << endl;
+    exit (-1);
+}
+
+#else  // no DejaGnu support
+
+int
+main(int /*argc*/, char /* *argv[]*/)
+{
+  // nop
+  return 0;  
+}
+
+#endif

Index: cygnal/Change_Log.txt
===================================================================
RCS file: cygnal/Change_Log.txt
diff -N cygnal/Change_Log.txt
--- cygnal/Change_Log.txt       10 Jul 2007 14:09:11 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,24 +0,0 @@
-Change Log for GNU Cygnal
-=========================
-
-2007-07-09 Eric Hughes <address@hidden>
-       * ACT/ACT.hpp: Changed ACT_State::Waiting to Would_Block.  Modified 
convenience methods accordingly.
-       * ACT/Pause_Service.cpp, ACT/test_support/Listening_Actions.cpp, 
HTTP/HTTP_Behavior.cpp: followed ACT.hpp changes.
-       * ACT/unit_tests/Test_ACT.cpp: Improved act_twice to ensure guard on 
run() is in effect.
-       * IO/Stream_Consumer.cpp: Removed defect that was masking failures in 
scanning.  Change causes an HTTP unit test to fail.
-
-2007-07-06 Eric Hughes <address@hidden>
-       * ACT/ACT.hpp: Converted ACT_State from an enumeration to a class.  
Removed convenience typedef.
-       * IO/Stream_Consumer.hpp: Added source_state() to assist in writing 
parsing filters.
-       * Lots and lots of files: Renamed act_state to ACT_State everywhere.  
Changed constant references to Working to either Waiting or Ready, as 
appropriate.  Changed set_working() to set_ready(), set_waiting(), or 
source_state(), as appropriate.
-       
-2007-07-06 Eric Hughes <address@hidden>
-       * doc/Doxyfile: Converted all paths to relative form.
-       * doc/mainpage.doxygen.txt: Wrote new main page.
-       * ACT/ACT.doxygen.txt: Wrote new page with overview of ACT.
-
-2007-06-28 Eric Hughes <address@hidden>
-       * doc/Doxyfile: New file.
-
-2007-06-17 Eric Hughes <address@hidden>
-       * ACT/*: Got listener wakeup working correctly in scheduler.




reply via email to

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