gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/rtmp r10015: use the docoot to find cgi fi


From: rob
Subject: [Gnash-commit] /srv/bzr/gnash/rtmp r10015: use the docoot to find cgi files.
Date: Sat, 21 Feb 2009 17:41:45 -0700
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10015
committer: address@hidden
branch nick: rtmp
timestamp: Sat 2009-02-21 17:41:45 -0700
message:
  use the docoot to find cgi files.
modified:
  cygnal/proc.cpp
  cygnal/proc.h
=== modified file 'cygnal/proc.cpp'
--- a/cygnal/proc.cpp   2009-02-21 23:07:18 +0000
+++ b/cygnal/proc.cpp   2009-02-22 00:41:45 +0000
@@ -57,6 +57,15 @@
     return false;
 }
 
+Proc&
+Proc::getDefaultInstance()
+{
+//    GNASH_REPORT_FUNCTION;
+    static Proc c;
+    return c;
+}
+
+
 bool
 Proc::startCGI(const string &filespec, boost::uint16_t port)
 {
@@ -88,34 +97,39 @@
     
     _output[filespec] = outflag;
 
+    string path = getDocroot();
+    path += filespec;
+        
     // simple debug junk
     log_debug("Starting \"%s\"", filespec);
 
     // See if the file actually exists, otherwise we can't spawn it
-    if (stat(filespec.c_str(), &procstats) == -1) {
-        log_error("Invalid filename \"%s\"", filespec);
+    if (stat(path.c_str(), &procstats) == -1) {
+        log_error("Invalid filename \"%s\"", path);
 //        perror(filespec.c_str());
        return (false);
     }
 
     // setup a command line. By default, argv[0] is the name of the process
     cmd_line[0] = new char(filespec.size()+1);
-    strncpy(cmd_line[0], filespec.c_str(), filespec.size());
+    strcpy(cmd_line[0], filespec.c_str());
 
     // If the parent has verbosity on, chances are the child should too.
 //     if (dbglogfile.getVerbosity() > 0) {
-    cmd_line[1] = new char(4);
-    strcpy(cmd_line[1], "-vv");
-    cmd_line[2] = 0;
+    cmd_line[1] = new char(3);
+    strcpy(cmd_line[1], "-n");
+    cmd_line[2] = new char(4);
+    strcpy(cmd_line[2], "-vv");
+    cmd_line[3] = 0;
 //     }
     
     // When running multiple cgis, we prefer to specify the port it's using.
     if (port > 0) {
-        cmd_line[2] = new char(3);
-        strcpy(cmd_line[2], "-p");
-        cmd_line[3] = new char(10);
-        sprintf(cmd_line[3], "%d", port);
-        cmd_line[4] = 0;
+        cmd_line[3] = new char(3);
+        strcpy(cmd_line[3], "-p");
+        cmd_line[4] = new char(10);
+        sprintf(cmd_line[4], "%d", port);
+        cmd_line[5] = 0;
     }
 
 
@@ -147,8 +161,8 @@
            open("/dev/null", O_WRONLY);
        }
        // Start the desired executable
-       execv(filespec.c_str(), cmd_line);
-       perror(filespec.c_str());
+       execv(path.c_str(), cmd_line);
+       perror(path.c_str());
        exit(0);
     }
     

=== modified file 'cygnal/proc.h'
--- a/cygnal/proc.h     2009-02-21 18:53:46 +0000
+++ b/cygnal/proc.h     2009-02-22 00:41:45 +0000
@@ -34,6 +34,7 @@
 public:
     Proc (void);
     ~Proc (void);
+    static Proc& getDefaultInstance();
     
     // These flags control whether the stdout of the child process gets 
displayed
     bool setOutput (const std::string &output, bool outflag);
@@ -46,6 +47,9 @@
     bool startCGI (const std::string &filespec, bool output);
     bool startCGI (const std::string &filespec, bool output, boost::uint16_t 
port);
 
+    void setDocroot(const std::string &path) { _docroot = path; } ;
+    std::string &getDocroot() { return _docroot; };
+    
     // This opens a network connection to the process
     bool connectCGI (const std::string &host, boost::uint16_t port);
 
@@ -57,8 +61,9 @@
     bool stopCGI (const std::string &filespec);
 private:
     std::map<std::string, bool> _output;
-    std::map<std::string, int> _pids;
-    std::map<std::string, int> _cons;
+    std::map<std::string, int>  _pids;
+    std::map<std::string, int>  _cons;
+    std::string                 _docroot;
     
     boost::mutex       _mutex;
 };


reply via email to

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