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-384-g3


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9-384-g3391c89
Date: Sun, 08 Nov 2009 01:31:32 +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  3391c897eab91cee315af98ca0b7390be80626af (commit)
      from  fc3226b3ee89ae7c6fd61d61fe492912dd1b9a72 (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 3391c897eab91cee315af98ca0b7390be80626af
Author: Giuseppe Scrivano <address@hidden>
Date:   Sun Nov 8 02:29:16 2009 +0100

    Fix copyright notice.

diff --git a/plugins/src/php/php.cpp b/plugins/src/php/php.cpp
index ab17b3c..1e64904 100644
--- a/plugins/src/php/php.cpp
+++ b/plugins/src/php/php.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 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.h"
 #include <include/base/thread/thread.h>
@@ -68,13 +68,14 @@ int modifyHeader(HttpResponseHeader *response, char* name, 
char* value)
        if(val)
                val->assign(value);
        else
-       {
-               string field(name);
-               string valString(value);
-               HttpResponseHeader::Entry* entry = new 
HttpResponseHeader::Entry(field, valString);
-
-               response->other.put(field, entry);
-       }
+    {
+      string field(name);
+      string valString(value);
+      HttpResponseHeader::Entry* entry =
+        new HttpResponseHeader::Entry(field, valString);
+
+      response->other.put(field, entry);
+    }
        return 0;
 }
 
@@ -106,10 +107,10 @@ int sendHeader(PhpData* data)
         *send a redirect to xxx.
         */
        if(location && location->length())
-       {
-               data->td->http->sendHTTPRedirect(location->c_str());
-               return 0;
-       }
+    {
+      data->td->http->sendHTTPRedirect(location->c_str());
+      return 0;
+    }
 
        data->headerSent = true;
        return data->td->connection->socket->send( buffer,
@@ -121,7 +122,8 @@ int sendHeader(PhpData* data)
 
 }
 
-int myphp_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct 
*sapi_headers TSRMLS_DC)
+int myphp_header_handler(sapi_header_struct *sapi_header,
+                         sapi_headers_struct *sapi_headers TSRMLS_DC)
 {
        PhpData* data = getPhpData();
        char* valInit;
@@ -229,65 +231,67 @@ void myphp_register_variables(zval *track_vars_array 
TSRMLS_DC)
        ptr = data->td->buffer->getBuffer();
 
        while(ptr)
-       {
-               char* name = ptr;
-               char* value = strchr(name, '=') + 1;
-               if(name >= value)
-                       break;
+    {
+      char* name = ptr;
+      char* value = strchr(name, '=') + 1;
+      if(name >= value)
+        break;
 
-               ptr += strlen(name) + 1;
+      ptr += strlen(name) + 1;
 
-               value[-1] = '\0';
+      value[-1] = '\0';
 
-               php_register_variable(name, value, track_vars_array TSRMLS_CC);
+      php_register_variable(name, value, track_vars_array TSRMLS_CC);
 
-               value[-1] = '=';
+      value[-1] = '=';
 
-       }
-       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(), 
track_vars_array TSRMLS_CC);
+    }
+       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(),
+                        track_vars_array TSRMLS_CC);
 }
 
 int    myphp_startup(struct _sapi_module_struct *sapi_module)
 {
        if(php_module_startup(sapi_module, entries, loadedEntries) == FAILURE)
-       {
-               return FAILURE;
-       }
+    {
+      return FAILURE;
+    }
 
        return 0;
 }
 
 static sapi_module_struct myphp_module =
-{
-       "myphp",
-       "MyServer PHP Module",
+  {
+    "myphp",
+    "MyServer PHP Module",
 
-       myphp_startup,                            /* startup */
-       php_module_shutdown_wrapper,                    /* shutdown */
-       NULL,                                           /* activate */
-       NULL,                                           /* deactivate */
+    myphp_startup,                            /* startup */
+    php_module_shutdown_wrapper,                    /* shutdown */
+    NULL,                                           /* activate */
+    NULL,                                           /* deactivate */
 
-       myphp_ub_write,                       /* unbuffered write */
-       myphp_flush,                          /* flush */
-       NULL, //myphp_get_stat,                       /* get uid */
-       NULL, //myphp_getenv,                         /* getenv */
+    myphp_ub_write,                       /* unbuffered write */
+    myphp_flush,                          /* flush */
+    NULL, //myphp_get_stat,                       /* get uid */
+    NULL, //myphp_getenv,                         /* getenv */
 
-       php_error,                                      /* error handler */
+    php_error,                                      /* error handler */
 
-       myphp_header_handler,                 /* header handler */
-       myphp_send_headers,                   /* send headers handler */
-       NULL,                                           /* send header handler 
*/
+    myphp_header_handler,                 /* header handler */
+    myphp_send_headers,                   /* send headers handler */
+    NULL,                                           /* send header handler */
 
-       myphp_read_post,                      /* read POST data */
-       myphp_read_cookies,                   /* read Cookies */
+    myphp_read_post,                      /* read POST data */
+    myphp_read_cookies,                   /* read Cookies */
 
-       myphp_register_variables,
-       myphp_log_message,                    /* Log message */
-       NULL,//myphp_sapi_get_request_time,               /* Request Time */
+    myphp_register_variables,
+    myphp_log_message,                    /* Log message */
+    NULL,//myphp_sapi_get_request_time,               /* Request Time */
 
-       STANDARD_SAPI_MODULE_PROPERTIES
-};
+    STANDARD_SAPI_MODULE_PROPERTIES
+  };
 
 int load(void* server)
 {
@@ -296,19 +300,19 @@ int load(void* server)
        data = ::server->getData("PHP_NO_REBOOT");
 
        if(!(::server->isRebooting() && !(data && !strcmpi(data, "YES"))))
-       {
-               data = ::server->getData("PHP_SAFE_MODE");
+    {
+      data = ::server->getData("PHP_SAFE_MODE");
 
-               if(data && !strcmpi(data, "YES"))
-                       singleRequest = 1;
-               else
-                       singleRequest = 0;
+      if(data && !strcmpi(data, "YES"))
+        singleRequest = 1;
+      else
+        singleRequest = 0;
 
-               loadedEntries = 0;
+      loadedEntries = 0;
 
-               if(singleRequest)
-                       requestMutex.init();
-       }
+      if(singleRequest)
+        requestMutex.init();
+    }
        return 0;
 }
 
@@ -320,14 +324,14 @@ int postLoad(void* server)
        data = ::server->getData("PHP_NO_REBOOT");
 
        if(!(::server->isRebooting() && !(data && !strcmpi(data, "YES"))))
-       {
+    {
 #ifdef ZTS
-               tsrm_startup(((Server*)server)->getMaxThreads(), 1, 0, NULL);
+      tsrm_startup(((Server*)server)->getMaxThreads(), 1, 0, NULL);
 #endif
 
-               sapi_startup(&myphp_module);
-               myphp_module.startup(&myphp_module);
-       }
+      sapi_startup(&myphp_module);
+      myphp_module.startup(&myphp_module);
+    }
        return 0;
 }
 
@@ -339,20 +343,20 @@ int unLoad(void* p)
        data = ::server->getData("PHP_NO_REBOOT");
 
        if(!(::server->isRebooting() && !(data && !strcmpi(data, "YES"))))
-       {
-               myphp_module.shutdown(&myphp_module);
+    {
+      myphp_module.shutdown(&myphp_module);
 
-               sapi_shutdown();
+      sapi_shutdown();
 
-               if(singleRequest)
-                       requestMutex.destroy();
+      if(singleRequest)
+        requestMutex.destroy();
 
 #ifdef ZTS
-    tsrm_shutdown();
+      tsrm_shutdown();
 #endif
 
-               loadedEntries = 0;
-       }
+      loadedEntries = 0;
+    }
        return 0;
 }
 
@@ -374,8 +378,9 @@ PhpManager::~PhpManager()
 }
 
 
-int PhpManager::send(HttpThreadContext*, ConnectionPtr s, const char 
*filenamePath,
-                   const char* cgi, int selfExecuted, int onlyHeader = 0)
+int
+PhpManager::send(HttpThreadContext*, ConnectionPtr s, const char *filenamePath,
+                 const char* cgi, int selfExecuted, int onlyHeader = 0)
 {
        PhpData* data;
        zend_file_handle script;
@@ -432,10 +437,12 @@ int PhpManager::send(HttpThreadContext*, ConnectionPtr s, 
const char *filenamePa
                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);
+               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, PHP_INI_STAGE_ACTIVATE);
+               zend_alter_ini_entry(name, strlen(name), "0", 1, PHP_INI_SYSTEM,
+                         PHP_INI_STAGE_ACTIVATE);
 
        }
 
@@ -447,28 +454,28 @@ int PhpManager::send(HttpThreadContext*, ConnectionPtr s, 
const char *filenamePa
        script.free_filename = 0;
 
        zend_first_try
-       {
+    {
 
-               if (php_request_startup(TSRMLS_C) == FAILURE)
-               {
-                       return FAILURE;
-               }
+      if (php_request_startup(TSRMLS_C) == FAILURE)
+        {
+          return FAILURE;
+        }
 
-               php_execute_script(&script TSRMLS_CC);
+      php_execute_script(&script TSRMLS_CC);
 
-               if(data->useChunks)
-                       HttpDataHandler::appendDataToHTTPChannel(data->td,
-                                                                               
                                                                                
                         0,
-                                                                               
                                                                                
                         0,
-                                                                               
                                                                                
                         &(data->td->outputData),
-                                                                               
                                                                                
                         &(data->chain),
-                                                                               
                                                                                
                         (bool)data->td->appendOutputs,
-                                                                               
                                                                                
                         data->useChunks);
+      if(data->useChunks)
+        HttpDataHandler::appendDataToHTTPChannel(data->td,
+                                                 0,
+                                                 0,
+                                                 &(data->td->outputData),
+                                                 &(data->chain),
+                                                 (bool)data->td->appendOutputs,
+                                                 data->useChunks);
 
-               php_request_shutdown(NULL);
+      php_request_shutdown(NULL);
 
 
-       }
+    }
        zend_end_try();
 
 
diff --git a/plugins/src/python/python.cpp b/plugins/src/python/python.cpp
index 9fc6ec7..f1db8c3 100644
--- a/plugins/src/python/python.cpp
+++ b/plugins/src/python/python.cpp
@@ -1,18 +1,18 @@
 /*
-MyServer
-Copyright (C) 2007, 2008, 2009 The MyServer Team
-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, 2009 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 "python.h"
@@ -34,12 +34,12 @@ char* name (char* name, u_long len)
 
 
 PyInterpreterState* PythonData::getInterpreter ()
-       {
-               if(interp == 0)
-                       interp = Py_NewInterpreter ();
-               PyThreadState_Swap (NULL);
-               return interp->interp;
-       }
+{
+  if(interp == 0)
+    interp = Py_NewInterpreter ();
+  PyThreadState_Swap (NULL);
+  return interp->interp;
+}
 
 PythonData::PythonData ()
 {
@@ -59,19 +59,19 @@ int load (void* server)
        const char* pathData = serverInstance->getData("PYTHON_PATH");
        PyThreadState * mainThreadState;
        if (pathData)
-       {
-               string path (pathData);
-               FilesUtility::completePath (path);
+    {
+      string path (pathData);
+      FilesUtility::completePath (path);
 
-               setenv ("PYTHONPATH", path.c_str(), 1);
-       }
+      setenv ("PYTHONPATH", path.c_str(), 1);
+    }
        else
-       {
-               string path (".");
-               FilesUtility::completePath (path);
+    {
+      string path (".");
+      FilesUtility::completePath (path);
 
-               setenv ("PYTHONPATH", path.c_str(), 1);
-       }
+      setenv ("PYTHONPATH", path.c_str(), 1);
+    }
 
   Py_SetProgramName ((char *)("python"));
        Py_Initialize ();
@@ -99,10 +99,10 @@ int unLoad (void* p)
 
        data = pythonThreadData.get (tid);
        if(data == 0)
-       {
-               data = new PythonData ();
-               pythonThreadData.put (tid, data);
-       }
+    {
+      data = new PythonData ();
+      pythonThreadData.put (tid, data);
+    }
 
        interpreter = data->getInterpreter ();
        threadState = PyThreadState_New (interpreter);
@@ -129,7 +129,8 @@ int execute (char* code, u_long length)
   return executeImpl (code, length, NULL, 1);
 }
 
-int executeImpl (char* code, u_long length, PyThreadState *threadState, int 
newThreadState)
+int executeImpl (char* code, u_long length, PyThreadState *threadState,
+                 int newThreadState)
 {
        PyInterpreterState *interpreter = NULL;
        PythonData* data = NULL;
@@ -139,10 +140,10 @@ int executeImpl (char* code, u_long length, PyThreadState 
*threadState, int newT
 
        data = pythonThreadData.get (tid);
        if (data == 0)
-       {
-               data = new PythonData();
-               pythonThreadData.put(tid, data);
-       }
+    {
+      data = new PythonData();
+      pythonThreadData.put(tid, data);
+    }
 
        interpreter = data->getInterpreter ();
 
@@ -157,10 +158,10 @@ int executeImpl (char* code, u_long length, PyThreadState 
*threadState, int newT
        PyThreadState_Swap (NULL);
 
   if (newThreadState)
-  {
-    PyThreadState_Clear (threadState);
-    PyThreadState_Delete (threadState);
-  }
+    {
+      PyThreadState_Clear (threadState);
+      PyThreadState_Delete (threadState);
+    }
 
        PyEval_ReleaseLock ();
 
@@ -174,7 +175,8 @@ int executeFromFile (char* filename)
   return executeFromFileImpl (filename, NULL, 1);
 }
 
-int executeFromFileImpl(char* filename, PyThreadState *threadState, int 
newThreadState)
+int executeFromFileImpl(char* filename, PyThreadState *threadState,
+                        int newThreadState)
 {
        PyInterpreterState *interpreter = NULL;
        int ret = 0;
@@ -186,10 +188,10 @@ int executeFromFileImpl(char* filename, PyThreadState 
*threadState, int newThrea
 
        data = pythonThreadData.get (tid);
        if(data == 0)
-       {
-               data = new PythonData ();
-               pythonThreadData.put (tid, data);
-       }
+    {
+      data = new PythonData ();
+      pythonThreadData.put (tid, data);
+    }
 
        interpreter = data->getInterpreter ();
 
@@ -201,10 +203,11 @@ int executeFromFileImpl(char* filename, PyThreadState 
*threadState, int newThrea
        file = fopen (filename, "r");
 
        if(file == 0)
-       {
-    serverInstance->log (MYSERVER_LOG_MSG_ERROR, _("Python: cannot load file 
%s"), filename);
-               ret = -1;
-       }
+    {
+      serverInstance->log (MYSERVER_LOG_MSG_ERROR,
+                           _("Python: cannot load file %s"), filename);
+      ret = -1;
+    }
        else
                ret = PyRun_AnyFileEx (file, filename, 1);
 
@@ -212,10 +215,10 @@ int executeFromFileImpl(char* filename, PyThreadState 
*threadState, int newThrea
        PyThreadState_Swap (NULL);
 
   if (newThreadState)
-  {
-    PyThreadState_Clear (threadState);
-    PyThreadState_Delete(threadState);
-  }
+    {
+      PyThreadState_Clear (threadState);
+      PyThreadState_Delete(threadState);
+    }
 
        PyEval_ReleaseLock ();
 
@@ -229,7 +232,8 @@ PyObject* callObject(PyObject *obj, PyObject *args)
 }
 
 
-PyObject* callObjectImpl(PyObject *obj, PyObject *args, PyThreadState 
*threadState, int newThreadState)
+PyObject* callObjectImpl(PyObject *obj, PyObject *args,
+                         PyThreadState *threadState, int newThreadState)
 {
        PyInterpreterState *interpreter = NULL;
        PythonData* data = NULL;
@@ -240,10 +244,10 @@ PyObject* callObjectImpl(PyObject *obj, PyObject *args, 
PyThreadState *threadSta
 
        data = pythonThreadData.get (tid);
        if(data == 0)
-       {
-               data = new PythonData ();
-               pythonThreadData.put (tid, data);
-       }
+    {
+      data = new PythonData ();
+      pythonThreadData.put (tid, data);
+    }
 
        interpreter = data->getInterpreter();
 
@@ -259,10 +263,10 @@ PyObject* callObjectImpl(PyObject *obj, PyObject *args, 
PyThreadState *threadSta
        PyThreadState_Swap (NULL);
 
   if (newThreadState)
-  {
-    PyThreadState_Clear (threadState);
-    PyThreadState_Delete (threadState);
-  }
+    {
+      PyThreadState_Clear (threadState);
+      PyThreadState_Delete (threadState);
+    }
 
        PyEval_ReleaseLock ();
 
@@ -281,10 +285,10 @@ int initModule (char* name, PyMethodDef methods[])
 
        data = pythonThreadData.get (tid);
        if (data == 0)
-       {
-               data = new PythonData ();
-               pythonThreadData.put (tid, data);
-       }
+    {
+      data = new PythonData ();
+      pythonThreadData.put (tid, data);
+    }
 
        interpreter = data->getInterpreter ();
        threadState = PyThreadState_New (interpreter);

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

Summary of changes:
 plugins/src/php/php.cpp       |  219 +++++++++++++++++++++--------------------
 plugins/src/python/python.cpp |  142 ++++++++++++++-------------
 2 files changed, 186 insertions(+), 175 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

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