myserver-commit
[Top][All Lists]
Advanced

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

[myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-40-g


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-40-g26881c4
Date: Wed, 24 Feb 2010 09:57:51 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  26881c43ea7825c70b4d4fc63fe52bcdd1d7c20a (commit)
       via  2190c0f3fbafb79ace2d9b74cf88e92d8c31e1a0 (commit)
       via  eef335db6c37ccda072d402f7c9f4d3c3a08f65e (commit)
       via  c9a4497f2ca4bdf58b461eb92bd7a22f7e22c4db (commit)
      from  a696600be1a0362983b50bfe89ac9130996c6431 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit 26881c43ea7825c70b4d4fc63fe52bcdd1d7c20a
Author: Giuseppe Scrivano <address@hidden>
Date:   Wed Feb 24 10:57:01 2010 +0100

    Make `genMainConf' a function pointer.

diff --git a/myserver/src/myserver.cpp b/myserver/src/myserver.cpp
index 8d0e957..bc8d5ab 100644
--- a/myserver/src/myserver.cpp
+++ b/myserver/src/myserver.cpp
@@ -349,7 +349,7 @@ int loadConfFilesLocation (string &mainConfigurationFile,
   return 0;
 }
 
-static MainConfiguration *genMainConf (Server *server, const char *arg)
+static MainConfiguration *_genMainConf (Server *server, const char *arg)
 {
   XmlMainConfiguration *conf = new XmlMainConfiguration ();
   if (conf->open (arg))
@@ -360,6 +360,8 @@ static MainConfiguration *genMainConf (Server *server, 
const char *arg)
   return conf;
 }
 
+MainConfiguration* (*genMainConf) (Server *server, const char *arg) = 
&_genMainConf;
+
 const char *program_name = NULL;
 
 int main (int argn, char **argv)
@@ -525,7 +527,7 @@ int main (int argn, char **argv)
             return 1;
 #endif
         case MYSERVER_RUNAS_CONSOLE:
-          consoleService (mainConf, mimeConf, vhostConf, externPath, 
&genMainConf);
+          consoleService (mainConf, mimeConf, vhostConf, externPath, 
genMainConf);
         }
     }
   catch (...)



commit 2190c0f3fbafb79ace2d9b74cf88e92d8c31e1a0
Author: Giuseppe Scrivano <address@hidden>
Date:   Wed Feb 24 10:56:39 2010 +0100

    The `PluginsManager' class invokes `load' and `unLoad' for active plugins.

diff --git a/myserver/src/plugin/plugin.cpp b/myserver/src/plugin/plugin.cpp
index 0c4310a..19f96dd 100644
--- a/myserver/src/plugin/plugin.cpp
+++ b/myserver/src/plugin/plugin.cpp
@@ -80,7 +80,7 @@ int Plugin::postLoad (Server* server)
 {
   if (hinstLib.validHandle ())
     {
-      postLoadPROC proc = (postLoadPROC)hinstLib.getProc ("postLoad");
+      postLoadPROC proc = (postLoadPROC) hinstLib.getProc ("postLoad");
       if (proc)
         return proc (server);
     }
@@ -97,7 +97,7 @@ int Plugin::unLoad ()
 {
   if (hinstLib.validHandle ())
     {
-      unLoadPROC proc = (unLoadPROC)hinstLib.getProc ("unLoad");
+      unLoadPROC proc = (unLoadPROC) hinstLib.getProc ("unLoad");
       if (proc)
         return proc ();
     }
diff --git a/myserver/src/plugin/plugins_manager.cpp 
b/myserver/src/plugin/plugins_manager.cpp
index 6da2ebb..55a6e63 100644
--- a/myserver/src/plugin/plugins_manager.cpp
+++ b/myserver/src/plugin/plugins_manager.cpp
@@ -644,8 +644,13 @@ PluginsManager::load (Server *server)
       if (*rIt)
         removePlugin (name);
     }
-  return 0;
 
+  for (it = pluginsInfos.begin (); it != pluginsInfos.end (); it++)
+    {
+      (*it)->getPlugin ()->load (server);
+    }
+
+  return 0;
 }
 
 /*!
@@ -682,6 +687,7 @@ PluginsManager::unLoad ()
 
   while (poit != pluginsInfos.end ())
     {
+      (*poit)->getPlugin ()->unLoad ();
       delete *poit;
       poit++;
     }



commit eef335db6c37ccda072d402f7c9f4d3c3a08f65e
Author: Giuseppe Scrivano <address@hidden>
Date:   Wed Feb 24 10:47:13 2010 +0100

    unLoad does not accept any argument, update plugins accordingly

diff --git a/plugins/src/guile/guile.cpp b/plugins/src/guile/guile.cpp
index ffc897a..74a5789 100644
--- a/plugins/src/guile/guile.cpp
+++ b/plugins/src/guile/guile.cpp
@@ -38,7 +38,7 @@ EXPORTABLE(int) postLoad (void* server, void* parser)
   return 0;
 }
 
-EXPORTABLE(int) unLoad (void* parser)
+EXPORTABLE(int) unLoad ()
 {
   return 0;
 }
diff --git a/plugins/src/hello/hello.cpp b/plugins/src/hello/hello.cpp
index e2e4dc4..702bcf4 100644
--- a/plugins/src/hello/hello.cpp
+++ b/plugins/src/hello/hello.cpp
@@ -1,6 +1,6 @@
 /*
   MyServer
-  Copyright (C) 2009, 2010 The Free Software Foundation Inc.
+  Copyright (C) 2010 The 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
@@ -18,7 +18,6 @@
 
 #include <include/plugin/plugin.h>
 
-
 PLUGIN_NAME ("hello");
 
 EXPORTABLE(int) load (void* server, void* parser)
@@ -33,7 +32,7 @@ EXPORTABLE(int) postLoad (void* server, void* parser)
   return 0;
 }
 
-EXPORTABLE(int) unLoad (void* parser)
+EXPORTABLE(int) unLoad ()
 {
   printf ("unLoad: bye world!\n");
   return 0;
diff --git a/plugins/src/http_checker/http_checker.cpp 
b/plugins/src/http_checker/http_checker.cpp
index 915907f..b3d1710 100644
--- a/plugins/src/http_checker/http_checker.cpp
+++ b/plugins/src/http_checker/http_checker.cpp
@@ -1,18 +1,18 @@
 /*
-MyServer
-Copyright (C) 2007, 2009 The 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, see <http://www.gnu.org/licenses/>.
+  MyServer
+  Copyright (C) 2007, 2009, 2010 The 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, see <http://www.gnu.org/licenses/>.
 */
 #include <myserver.h>
 
@@ -120,7 +120,7 @@ static PyObject *raise_error(PyObject *self, PyObject *args)
 
   ThreadData* data = getThreadData();
 
-  if(data->ret)
+  if (data->ret)
     return NULL;
 
   data->td->http->raiseHTTPError(error);
@@ -138,7 +138,7 @@ static PyObject *send_redirect(PyObject *self, PyObject 
*args)
 
   ThreadData* data = getThreadData();
 
-  if(data->ret)
+  if (data->ret)
     return NULL;
 
   data->td->http->sendHTTPRedirect(dest);
@@ -182,9 +182,9 @@ public:
 
     init((char*)"http_checker", httpCheckerMethods);
 
-    for(it = rules.begin(); it != rules.end(); it++)
+    for (it = rules.begin(); it != rules.end(); it++)
       {
-       if((*it).file) 
+       if ((*it).file) 
          {
            executeFromFilePROC execute = 
((executeFromFilePROC)python->getDirectMethod((char*)"executeFromFile"));
            if (execute)
@@ -200,7 +200,7 @@ public:
     return threadData.ret;
   }
 
-  void addRule(const char* rule, bool file)
+  void addRule (const char* rule, bool file)
   {
     Item it;
     it.data.assign(rule);
@@ -220,7 +220,7 @@ static HttpObserver observer;
 EXPORTABLE(char*) name(char* name, u_long len)
 {
   char* str = (char*)"http_checker";
-  if(name)
+  if (name)
     strncpy(name, str, len);
   return str;
 }
@@ -235,7 +235,7 @@ EXPORTABLE(int) load(void* server,void* parser)
   xmlDocPtr xmlDoc;
 
   python = serverInstance->getPluginsManager()->getPlugin(pythonName);
-  if(!python)
+  if (!python)
     {
       serverInstance->log (MYSERVER_LOG_MSG_ERROR, _("HttpChecker: cannot find 
executors::python"));
       return -1;
@@ -248,30 +248,30 @@ EXPORTABLE(int) load(void* server,void* parser)
 
   init = (INIT_MODULE) python->getDirectMethod((char*)"initModule");
 
-  if(!init)
+  if (!init)
     {
       serverInstance->log (MYSERVER_LOG_MSG_ERROR,
-         _("HttpChecker: cannot find method initModule in executors::python"));
+                           _("HttpChecker: cannot find method initModule in 
executors::python"));
       return -1;
     }
 
   configuration = serverInstance->getConfiguration ();
 
   /* FIXME: DON'T DO THIS.  */
-  xmlDoc = ((XmlMainConfiguration*)configuration)->getDoc ();
+  xmlDoc = ((XmlMainConfiguration *) configuration)->getDoc ();
 
-  for(xmlNodePtr ptr = xmlDoc->children->next->children; ptr; ptr = ptr->next)
+  for (xmlNodePtr ptr = xmlDoc->children->next->children; ptr; ptr = ptr->next)
     {
-      if(!xmlStrcmp(ptr->name, (const xmlChar *)"HTTP_CHECKER_RULE"))
+      if (!xmlStrcmp (ptr->name, (const xmlChar *)"HTTP_CHECKER_RULE"))
        {
          bool file = false;
          xmlAttrPtr properties = ptr->properties;
          char* data = 0;
-         while(properties)
+         while (properties)
            {
-             if(!xmlStrcmp(properties->name, (const xmlChar *)"file"))
+             if (!xmlStrcmp (properties->name, (const xmlChar *)"file"))
                {
-                 if(properties->children && properties->children->content)
+                 if (properties->children && properties->children->content)
                    data = (char*)properties->children->content;
 
                  file = true;
@@ -279,16 +279,16 @@ EXPORTABLE(int) load(void* server,void* parser)
              properties = properties->next;
            }
 
-         if(!file && ptr->children && ptr->children->next && 
ptr->children->next->content)
+         if (!file && ptr->children && ptr->children->next && 
ptr->children->next->content)
            data = (char*)ptr->children->next->content;
 
-         if(!data)
+         if (!data)
            {
-        serverInstance->log (MYSERVER_LOG_MSG_ERROR, _("HttpChecker: invalid 
rule"));
+              serverInstance->log (MYSERVER_LOG_MSG_ERROR, _("HttpChecker: 
invalid rule"));
              return -1;
            }
 
-         observer.addRule(data, file);
+         observer.addRule (data, file);
        }
 
     }
@@ -297,11 +297,11 @@ EXPORTABLE(int) load(void* server,void* parser)
 
   return 0;
 }
-EXPORTABLE(int) postLoad(void* server,void* parser)
+EXPORTABLE(int) postLoad (void* server,void* parser)
 {
   return 0;
 }
-EXPORTABLE(int) unLoad(void* parser)
+EXPORTABLE(int) unLoad ()
 {
   mutex.destroy();
   return 0;
diff --git a/plugins/src/php/php.cpp b/plugins/src/php/php.cpp
index 1e64904..d47514c 100644
--- a/plugins/src/php/php.cpp
+++ b/plugins/src/php/php.cpp
@@ -1,6 +1,6 @@
 /*
   MyServer
-  Copyright (C) 2007, 2009 The Free Software Foundation Inc.
+  Copyright (C) 2007, 2009, 2010 The 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
@@ -14,6 +14,7 @@
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
+
 #include "php.h"
 #include <include/base/thread/thread.h>
 #include <include/base/sync/mutex.h>
@@ -40,16 +41,16 @@ int singleRequest;
 
 struct PhpData
 {
-       HttpThreadContext* td;
-       bool keepalive;
-       bool useChunks;
-       bool headerSent;
-       FiltersChain chain;
+  HttpThreadContext* td;
+  bool keepalive;
+  bool useChunks;
+  bool headerSent;
+  FiltersChain chain;
 };
 
 extern "C" void addModule(zend_module_entry entry)
 {
-       entries[loadedEntries++] = entry;
+  entries[loadedEntries++] = entry;
 }
 
 
@@ -58,16 +59,16 @@ static PhpData* getPhpData()
 #ifdef ZTS
   void*** tsrm_ls = (void***)ts_resource(0);
 #endif
-       return (PhpData*)SG(server_context);
+  return (PhpData*)SG(server_context);
 }
 
 int modifyHeader(HttpResponseHeader *response, char* name, char* value)
 {
-       string* val = response->getValue(name, NULL);
+  string* val = response->getValue(name, NULL);
 
-       if(val)
-               val->assign(value);
-       else
+  if(val)
+    val->assign(value);
+  else
     {
       string field(name);
       string valString(value);
@@ -76,46 +77,46 @@ int modifyHeader(HttpResponseHeader *response, char* name, 
char* value)
 
       response->other.put(field, entry);
     }
-       return 0;
+  return 0;
 }
 
 int sendHeader(PhpData* data)
 {
-       char* buffer;
-       string* location = 0;
-       if(data->headerSent || data->td->appendOutputs)
-               return 0;
-       buffer = data->td->buffer2->getBuffer();
+  char* buffer;
+  string* location = 0;
+  if(data->headerSent || data->td->appendOutputs)
+    return 0;
+  buffer = data->td->buffer2->getBuffer();
 
-       if(data->keepalive)
-               modifyHeader(&(data->td->response), "Connection", "keep-alive");
-       else
-               modifyHeader(&(data->td->response), "Connection", "closed");
+  if(data->keepalive)
+    modifyHeader(&(data->td->response), "Connection", "keep-alive");
+  else
+    modifyHeader(&(data->td->response), "Connection", "closed");
 
-       if(data->useChunks)
-               modifyHeader(&(data->td->response), "Transfer-Encoding", 
"chunked");
+  if(data->useChunks)
+    modifyHeader(&(data->td->response), "Transfer-Encoding", "chunked");
 
-       HttpHeaders::buildHTTPResponseHeader(buffer,
-                                                                               
                                                                         
&data->td->response);
+  HttpHeaders::buildHTTPResponseHeader(buffer,
+                                       &data->td->response);
 
 
 
-       location = data->td->response.getValue("Location", 0);
+  location = data->td->response.getValue("Location", 0);
 
-       /*
-        *If it is present Location: xxx in the header
-        *send a redirect to xxx.
-        */
-       if(location && location->length())
+  /*
+   *If it is present Location: xxx in the header
+   *send a redirect to xxx.
+   */
+  if(location && location->length())
     {
       data->td->http->sendHTTPRedirect(location->c_str());
       return 0;
     }
 
-       data->headerSent = true;
-       return data->td->connection->socket->send( buffer,
-                                                                               
                                                                                
                 static_cast<int>(strlen(buffer)),
-                                                                               
                                                                                
                 0) != SOCKET_ERROR;
+  data->headerSent = true;
+  return data->td->connection->socket->send( buffer,
+                                             static_cast<int>(strlen(buffer)),
+                                             0) != SOCKET_ERROR;
 
 
 
@@ -125,82 +126,82 @@ int sendHeader(PhpData* data)
 int myphp_header_handler(sapi_header_struct *sapi_header,
                          sapi_headers_struct *sapi_headers TSRMLS_DC)
 {
-       PhpData* data = getPhpData();
-       char* valInit;
-       int sep;
-       for(sep = 0; sapi_header->header[sep] != ':'; sep++)
-               if(!sapi_header->header[sep])
-                       return 1;
+  PhpData* data = getPhpData();
+  char* valInit;
+  int sep;
+  for(sep = 0; sapi_header->header[sep] != ':'; sep++)
+    if(!sapi_header->header[sep])
+      return 1;
 
-       sapi_header->header[sep] = 0;
+  sapi_header->header[sep] = 0;
 
-       valInit = sapi_header->header + sep + 1;
-       if(*valInit == ' ')
-               valInit++;
+  valInit = sapi_header->header + sep + 1;
+  if(*valInit == ' ')
+    valInit++;
 
-       modifyHeader(&(data->td->response), sapi_header->header, valInit);
+  modifyHeader(&(data->td->response), sapi_header->header, valInit);
 
-       sapi_header->header[sep] = ':';
+  sapi_header->header[sep] = ':';
 
-       return 0;
+  return 0;
 }
 
 int myphp_read_post(char *buffer, uint count_bytes TSRMLS_DC)
 {
-       PhpData* data = getPhpData();
-       u_long nbr = 0;
+  PhpData* data = getPhpData();
+  u_long nbr = 0;
 
-       if(data->td->inputData.getHandle() != -1 && 
data->td->inputData.getFileSize())
-               if(data->td->inputData.readFromFile(buffer, count_bytes, &nbr))
-                       nbr = 0;
+  if(data->td->inputData.getHandle() != -1 && 
data->td->inputData.getFileSize())
+    if(data->td->inputData.readFromFile(buffer, count_bytes, &nbr))
+      nbr = 0;
 
-       return nbr;
+  return nbr;
 
 }
 
 int myphp_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
 {
-       return sendHeader(getPhpData());
+  return sendHeader(getPhpData());
 }
 
 char *myphp_read_cookies(TSRMLS_D)
 {
-       PhpData* data = getPhpData();
-       string *cookies = data->td->request.getValue("Cookie", NULL);
+  PhpData* data = getPhpData();
+  string *cookies = data->td->request.getValue("Cookie", NULL);
 
-       if(cookies)
-               return (char*)cookies->c_str();
+  if(cookies)
+    return (char*)cookies->c_str();
 
-       return 0;
+  return 0;
 }
 
 void myphp_log_message(char* message)
 {
-       PhpData* data = getPhpData();
-       data->td->connection->host->warningsLogRequestAccess(data->td->id);
-       data->td->connection->host->warningsLogWrite(message);
-       data->td->connection->host->warningsLogRequestAccess(data->td->id);
+  PhpData* data = getPhpData();
+  data->td->connection->host->warningsLogRequestAccess(data->td->id);
+  data->td->connection->host->warningsLogWrite(message);
+  data->td->connection->host->warningsLogRequestAccess(data->td->id);
 
 }
 
 int myphp_ub_write(const char *str, unsigned int str_length TSRMLS_DC)
 {
-       PhpData* data = getPhpData();
+  PhpData* data = getPhpData();
 
-       if(!data->headerSent)
-               if(sendHeader(data))
-                       return 1;
+  if(!data->headerSent)
+    if(sendHeader(data))
+      return 1;
 
 
-       data->chain.setStream(data->td->connection->socket);
-       data->td->sentData += (u_long)str_length;
-       return HttpDataHandler::appendDataToHTTPChannel(data->td,
-                                                                               
                                                                                
                                        (char*)str,
-                                                                               
                                                                                
                                        (u_long)str_length,
-                                                                               
                                                                                
                                        &(data->td->outputData),
-                                                                               
                                                                                
                                        &(data->chain),
-                                                                               
                                                                                
                                        (bool)data->td->appendOutputs,
-                                                                               
                                                                                
                                        data->useChunks);
+  data->chain.setStream(data->td->connection->socket);
+  data->td->sentData += (u_long)str_length;
+  return HttpDataHandler::appendDataToHTTPChannel(data->td,
+                                                  (char*)str,
+                                                  (u_long)str_length,
+                                                  &(data->td->outputData),
+                                                  &(data->chain),
+                                                  
(bool)data->td->appendOutputs,
+                                                  data->useChunks);
 
 
 }
@@ -214,23 +215,23 @@ void myphp_flush(void *server_context)
 extern "C"
 char* name(char* name, u_long len)
 {
-       char* str = "php";
+  char* str = "php";
 
-       if(name)
-               strncpy(name, str, len);
+  if(name)
+    strncpy(name, str, len);
 
-       return str;
+  return str;
 }
 
 void myphp_register_variables(zval *track_vars_array TSRMLS_DC)
 {
-       PhpData* data = getPhpData();
-       char* ptr;
-       Cgi::buildCGIEnvironmentString(data->td, data->td->buffer->getBuffer());
+  PhpData* data = getPhpData();
+  char* ptr;
+  Cgi::buildCGIEnvironmentString(data->td, data->td->buffer->getBuffer());
 
-       ptr = data->td->buffer->getBuffer();
+  ptr = data->td->buffer->getBuffer();
 
-       while(ptr)
+  while(ptr)
     {
       char* name = ptr;
       char* value = strchr(name, '=') + 1;
@@ -246,20 +247,20 @@ void myphp_register_variables(zval *track_vars_array 
TSRMLS_DC)
       value[-1] = '=';
 
     }
-       php_register_variable("env", (char*)data->td->request.uriOpts.c_str(),
+  php_register_variable("env", (char*)data->td->request.uriOpts.c_str(),
                         track_vars_array TSRMLS_CC);
-       php_register_variable("PHP_SELF", (char*)data->td->request.uri.c_str(),
+  php_register_variable("PHP_SELF", (char*)data->td->request.uri.c_str(),
                         track_vars_array TSRMLS_CC);
 }
 
 int    myphp_startup(struct _sapi_module_struct *sapi_module)
 {
-       if(php_module_startup(sapi_module, entries, loadedEntries) == FAILURE)
+  if(php_module_startup(sapi_module, entries, loadedEntries) == FAILURE)
     {
       return FAILURE;
     }
 
-       return 0;
+  return 0;
 }
 
 static sapi_module_struct myphp_module =
@@ -293,13 +294,14 @@ static sapi_module_struct myphp_module =
     STANDARD_SAPI_MODULE_PROPERTIES
   };
 
-int load(void* server)
+EXPORTABLE(int)
+load(void* server)
 {
-       ::server = (Server*)server;
-       const char *data;
-       data = ::server->getData("PHP_NO_REBOOT");
+  ::server = (Server*)server;
+  const char *data;
+  data = ::server->getData("PHP_NO_REBOOT");
 
-       if(!(::server->isRebooting() && !(data && !strcmpi(data, "YES"))))
+  if(!(::server->isRebooting() && !(data && !strcmpi(data, "YES"))))
     {
       data = ::server->getData("PHP_SAFE_MODE");
 
@@ -313,17 +315,17 @@ int load(void* server)
       if(singleRequest)
         requestMutex.init();
     }
-       return 0;
+  return 0;
 }
 
 /*! Postload phase for the plugin.  */
-extern "C"
-int postLoad(void* server)
+EXPORTABLE(int)
+postLoad(void* server)
 {
-       const char *data;
-       data = ::server->getData("PHP_NO_REBOOT");
+  const char *data;
+  data = ::server->getData("PHP_NO_REBOOT");
 
-       if(!(::server->isRebooting() && !(data && !strcmpi(data, "YES"))))
+  if(!(::server->isRebooting() && !(data && !strcmpi(data, "YES"))))
     {
 #ifdef ZTS
       tsrm_startup(((Server*)server)->getMaxThreads(), 1, 0, NULL);
@@ -332,17 +334,17 @@ int postLoad(void* server)
       sapi_startup(&myphp_module);
       myphp_module.startup(&myphp_module);
     }
-       return 0;
+  return 0;
 }
 
 /*! Unload the plugin.  Called once.  Returns 0 on success.  */
-extern "C"
-int unLoad(void* p)
+EXPORTABLE(int)
+unLoad()
 {
-       const char *data;
-       data = ::server->getData("PHP_NO_REBOOT");
+  const char *data;
+  data = ::server->getData("PHP_NO_REBOOT");
 
-       if(!(::server->isRebooting() && !(data && !strcmpi(data, "YES"))))
+  if(!(::server->isRebooting() && !(data && !strcmpi(data, "YES"))))
     {
       myphp_module.shutdown(&myphp_module);
 
@@ -357,7 +359,7 @@ int unLoad(void* p)
 
       loadedEntries = 0;
     }
-       return 0;
+  return 0;
 }
 
 
@@ -382,78 +384,78 @@ int
 PhpManager::send(HttpThreadContext*, ConnectionPtr s, const char *filenamePath,
                  const char* cgi, int selfExecuted, int onlyHeader = 0)
 {
-       PhpData* data;
-       zend_file_handle script;
-       int ret = SUCCESS;
-       HttpRequestHeader *req = &(td->request);
+  PhpData* data;
+  zend_file_handle script;
+  int ret = SUCCESS;
+  HttpRequestHeader *req = &(td->request);
 
-       if(singleRequest)
-               requestMutex.lock();
+  if(singleRequest)
+    requestMutex.lock();
 
-       TSRMLS_FETCH();
+  TSRMLS_FETCH();
 
-       td->inputData.setFilePointer(0);
+  td->inputData.setFilePointer(0);
 
 
-       SG(headers_sent) = 0;
-       SG(request_info).no_headers = 1;
-       SG(request_info).headers_only = onlyHeader;
+  SG(headers_sent) = 0;
+  SG(request_info).no_headers = 1;
+  SG(request_info).headers_only = onlyHeader;
 
-       SG(request_info).request_uri = (char*)req->uri.c_str();
-       SG(request_info).request_method = req->cmd.c_str();
+  SG(request_info).request_uri = (char*)req->uri.c_str();
+  SG(request_info).request_method = req->cmd.c_str();
 
-       if(!req->ver.compare("HTTP/1.1") || !req->ver.compare("HTTPS/1.1"))
-               SG(request_info).proto_num = 1001;
-       else
-               SG(request_info).proto_num = 1000;
+  if(!req->ver.compare("HTTP/1.1") || !req->ver.compare("HTTPS/1.1"))
+    SG(request_info).proto_num = 1001;
+  else
+    SG(request_info).proto_num = 1000;
 
-       SG(server_context) = data = new PhpData();
+  SG(server_context) = data = new PhpData();
 
-       data->td = td;
-       HttpDataHandler::checkDataChunks(td, &data->keepalive, 
&data->useChunks);
-       data->headerSent = false;
+  data->td = td;
+  HttpDataHandler::checkDataChunks(td, &data->keepalive, &data->useChunks);
+  data->headerSent = false;
 
 
-       SG(sapi_headers).http_response_code = 200;
+  SG(sapi_headers).http_response_code = 200;
 
-       SG(request_info).query_string =  (char*)req->uriOpts.c_str();
+  SG(request_info).query_string =  (char*)req->uriOpts.c_str();
 
-       SG(request_info).path_translated = (char*)filenamePath;
+  SG(request_info).path_translated = (char*)filenamePath;
 
-       if(td->connection->getLogin()[0])
-               SG(request_info).auth_user = (char*)td->connection->getLogin();
+  if(td->connection->getLogin()[0])
+    SG(request_info).auth_user = (char*)td->connection->getLogin();
 
-       if(td->connection->getPassword()[0])
-               SG(request_info).auth_password = 
(char*)td->connection->getPassword();
+  if(td->connection->getPassword()[0])
+    SG(request_info).auth_password = (char*)td->connection->getPassword();
 
-       if(req->getValue("Content-Type", NULL))
-               SG(request_info).content_type = req->getValue("Content-Type", 
NULL)->c_str();
+  if(req->getValue("Content-Type", NULL))
+    SG(request_info).content_type = req->getValue("Content-Type", 
NULL)->c_str();
 
-       SG(request_info).content_length = atoi(req->contentLength.c_str());
+  SG(request_info).content_length = atoi(req->contentLength.c_str());
 
-       //SG(options) |= SAPI_OPTION_NO_CHDIR;
+  //SG(options) |= SAPI_OPTION_NO_CHDIR;
 
-       {
-               char limit[15];
-               char *name = "memory_limit";
-               sprintf(limit, "%d", 1 << 30);
-               zend_alter_ini_entry(name, strlen(name), limit, strlen(limit),
+  {
+    char limit[15];
+    char *name = "memory_limit";
+    sprintf(limit, "%d", 1 << 30);
+    zend_alter_ini_entry(name, strlen(name), limit, strlen(limit),
                          PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
 
-               name = "html_errors";
-               zend_alter_ini_entry(name, strlen(name), "0", 1, PHP_INI_SYSTEM,
+    name = "html_errors";
+    zend_alter_ini_entry(name, strlen(name), "0", 1, PHP_INI_SYSTEM,
                          PHP_INI_STAGE_ACTIVATE);
 
-       }
+  }
 
-       SG(request_info).post_data_length = SG(request_info).content_length;
+  SG(request_info).post_data_length = SG(request_info).content_length;
 
-       script.type = ZEND_HANDLE_FILENAME;
-       script.filename = (char*)filenamePath;
-       script.opened_path = NULL;
-       script.free_filename = 0;
+  script.type = ZEND_HANDLE_FILENAME;
+  script.filename = (char*)filenamePath;
+  script.opened_path = NULL;
+  script.free_filename = 0;
 
-       zend_first_try
+  zend_first_try
     {
 
       if (php_request_startup(TSRMLS_C) == FAILURE)
@@ -464,9 +466,7 @@ PhpManager::send(HttpThreadContext*, ConnectionPtr s, const 
char *filenamePath,
       php_execute_script(&script TSRMLS_CC);
 
       if(data->useChunks)
-        HttpDataHandler::appendDataToHTTPChannel(data->td,
-                                                 0,
-                                                 0,
+        HttpDataHandler::appendDataToHTTPChannel(data->td, 0, 0,
                                                  &(data->td->outputData),
                                                  &(data->chain),
                                                  (bool)data->td->appendOutputs,
@@ -476,14 +476,14 @@ PhpManager::send(HttpThreadContext*, ConnectionPtr s, 
const char *filenamePath,
 
 
     }
-       zend_end_try();
+  zend_end_try();
 
 
-       if(singleRequest)
-               requestMutex.unlock();
+  if(singleRequest)
+    requestMutex.unlock();
 
 
-       delete data;
+  delete data;
 
-       return ret;
+  return ret;
 }
diff --git a/plugins/src/php/php.h b/plugins/src/php/php.h
index ab9753f..07e2b0e 100644
--- a/plugins/src/php/php.h
+++ b/plugins/src/php/php.h
@@ -1,18 +1,18 @@
 /*
-MyServer
-Copyright (C) 2007, 2008 The 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, see <http://www.gnu.org/licenses/>.
+  MyServer
+  Copyright (C) 2007, 2008, 2010 The 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, see <http://www.gnu.org/licenses/>.
 */
 #include <php_embed.h>
 
@@ -35,19 +35,19 @@ EXPORTABLE(int) load(void* server, void* parser);
 
 EXPORTABLE(int) postLoad(void* server,void* parser)
 
-EXPORTABLE(int) unload(void* p);
+EXPORTABLE(int) unLoad();
 
 class PhpManager 
 {
-public:
-       PhpManager();
-       virtual ~PhpManager();
-       virtual int send(HttpThreadContext*, ConnectionPtr s, const char 
*filenamePath,
+ public:
+  PhpManager();
+  virtual ~PhpManager();
+  virtual int send(HttpThreadContext*, ConnectionPtr s, const char 
*filenamePath,
                    const char* cgi, int selfExecuted, int onlyHeader = 0);
 
 };
 
 EXPORTABLE(int) sendManager(HttpThreadContext* td, ConnectionPtr s, const char 
*filenamePath,
-                                                                               
                         const char* cgi, int onlyHeader);
+                            const char* cgi, int onlyHeader);
 
 
diff --git a/plugins/src/python/python.cpp b/plugins/src/python/python.cpp
index 84b71d0..7e37ac4 100644
--- a/plugins/src/python/python.cpp
+++ b/plugins/src/python/python.cpp
@@ -78,7 +78,7 @@ int load (void* server)
 }
 
 /*! Unload the plugin.  Called once.  Returns 0 on success.  */
-int unLoad (void* p)
+int unLoad ()
 {
   PyInterpreterState *interpreter = NULL;
   PyThreadState *threadState = NULL;
@@ -100,13 +100,10 @@ int unLoad (void* p)
 
   PyThreadState_Swap (threadState);
 
-
   Py_Finalize ();
 
-
   PyThreadState_Swap (NULL);
 
-
   PyEval_ReleaseLock ();
 
   HashMap<ThreadID, PythonData*>::Iterator it = pythonThreadData.begin ();
diff --git a/plugins/src/python/python.h b/plugins/src/python/python.h
index 7c98348..2b7237b 100644
--- a/plugins/src/python/python.h
+++ b/plugins/src/python/python.h
@@ -37,7 +37,7 @@ struct PythonData
 extern HashMap<ThreadID, PythonData*> pythonThreadData;
 
 EXPORTABLE(int) load (void* server,void* parser);
-EXPORTABLE(int) unLoad (void* p);
+EXPORTABLE(int) unLoad ();
 
 
 EXPORTABLE(int) execute (char* code, u_long length);



commit c9a4497f2ca4bdf58b461eb92bd7a22f7e22c4db
Author: Giuseppe Scrivano <address@hidden>
Date:   Wed Feb 24 10:27:37 2010 +0100

    Add a new `hello' plugin.

diff --git a/plugins/src/hello/SConscript b/plugins/src/hello/SConscript
new file mode 100644
index 0000000..11a4f8f
--- /dev/null
+++ b/plugins/src/hello/SConscript
@@ -0,0 +1,25 @@
+#-*- mode: python -*-
+Import('dest_dir','listinc')
+
+local_listinc=[
+      GetLaunchDir(),
+      '../../../',
+      '/usr/local/include',
+      '/usr/include/',
+      '/usr/local/include/guile',
+      '/usr/local/include/libxml2',
+      '/usr/include/libxml2',
+      '.'
+      ]
+
+local_listinc.extend(listinc)
+
+env = Environment(CPPPATH=local_listinc)
+
+conf = Configure(env, config_h="config.h")
+
+env = conf.Finish()
+
+env.SharedLibrary(GetLaunchDir() + "/" + dest_dir + "/hello", ["hello.cpp" ], 
SHLIBPREFIX="")
+
+
diff --git a/plugins/src/hello/hello.cpp b/plugins/src/hello/hello.cpp
new file mode 100644
index 0000000..e2e4dc4
--- /dev/null
+++ b/plugins/src/hello/hello.cpp
@@ -0,0 +1,40 @@
+/*
+  MyServer
+  Copyright (C) 2009, 2010 The 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, see <http://www.gnu.org/licenses/>.
+*/
+#include <myserver.h>
+
+#include <include/plugin/plugin.h>
+
+
+PLUGIN_NAME ("hello");
+
+EXPORTABLE(int) load (void* server, void* parser)
+{
+  printf ("load: hello world!\n");
+  return 0;
+}
+
+EXPORTABLE(int) postLoad (void* server, void* parser)
+{
+  printf ("postLoad: hello world!\n");
+  return 0;
+}
+
+EXPORTABLE(int) unLoad (void* parser)
+{
+  printf ("unLoad: bye world!\n");
+  return 0;
+}
diff --git a/plugins/src/hello/plugin.xml b/plugins/src/hello/plugin.xml
new file mode 100644
index 0000000..34fb9c6
--- /dev/null
+++ b/plugins/src/hello/plugin.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<PLUGIN min-version="0.9" max-version="0.10">
+  <NAME>hello</NAME>
+  <VERSION>0.1</VERSION>
+  <AUTHOR>The Free Software Foundation Inc.</AUTHOR>
+  <MAINTAINER>The Free Software Foundation Inc.</MAINTAINER>
+  <DESCRIPTION>This plugin produces a familiar greeting.  It can be used as a 
base for new plugins.</DESCRIPTION>
+</PLUGIN>

-----------------------------------------------------------------------

Summary of changes:
 myserver/src/myserver.cpp                        |    6 +-
 myserver/src/plugin/plugin.cpp                   |    4 +-
 myserver/src/plugin/plugins_manager.cpp          |    8 +-
 plugins/src/guile/guile.cpp                      |    2 +-
 plugins/src/{guile => hello}/SConscript          |    6 +-
 plugins/src/{guile/guile.cpp => hello/hello.cpp} |   17 +-
 plugins/src/{guile => hello}/plugin.xml          |    4 +-
 plugins/src/http_checker/http_checker.cpp        |   70 +++---
 plugins/src/php/php.cpp                          |  326 +++++++++++-----------
 plugins/src/php/php.h                            |   40 ++--
 plugins/src/python/python.cpp                    |    5 +-
 plugins/src/python/python.h                      |    2 +-
 12 files changed, 243 insertions(+), 247 deletions(-)
 copy plugins/src/{guile => hello}/SConscript (69%)
 copy plugins/src/{guile/guile.cpp => hello/hello.cpp} (78%)
 copy plugins/src/{guile => hello}/plugin.xml (61%)


hooks/post-receive
-- 
GNU MyServer




reply via email to

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