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. 2888db8833


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 2888db883335358e639aaebe14c268e8a50a9c58
Date: Mon, 26 Oct 2009 21:13:18 +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  2888db883335358e639aaebe14c268e8a50a9c58 (commit)
       via  0b5f954d6571efb0b969e5dec78149295679303f (commit)
       via  99476ac6e98d0e48ca7c423200b0ea6a7bc7a5b6 (commit)
       via  f0ae6edcea3762b0c9bfa99e58445ccdbf800bff (commit)
      from  c903deb50c664dabc9f4242065aa455789c6d270 (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 2888db883335358e639aaebe14c268e8a50a9c58
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon Oct 26 22:08:19 2009 +0100

    Allocate Server::xmlMimeHandler dinamically, it is freed by the MimeManager.

diff --git a/myserver/include/server/server.h b/myserver/include/server/server.h
index 99d6de5..6cb8e4b 100644
--- a/myserver/include/server/server.h
+++ b/myserver/include/server/server.h
@@ -171,7 +171,7 @@ public:
 private:
   friend class ClientsThread;
   XmlValidator *xmlValidator;
-  XmlMimeHandler xmlMimeHandler;
+  XmlMimeHandler *xmlMimeHandler;
   XmlVhostHandler *vhostHandler;
 
   MainConfiguration *configurationFileManager;
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 37c72c2..3b0c29a 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -281,13 +281,14 @@ int Server::postLoad ()
   /* Load the MIME types.  */
   log (MYSERVER_LOG_MSG_INFO, _("Loading MIME types..."));
 
-  if (int nMIMEtypes = xmlMimeHandler.load (mimeConfigurationFile.c_str ()))
+  xmlMimeHandler = new XmlMimeHandler ();
+  if (int nMIMEtypes = xmlMimeHandler->load (mimeConfigurationFile.c_str ()))
     log (MYSERVER_LOG_MSG_INFO, _("Using %i MIME types"), nMIMEtypes);
   else
     log (MYSERVER_LOG_MSG_ERROR, _("Error while loading MIME types"));
 
   string xml ("xml");
-  mimeManager.registerHandler (xml, &xmlMimeHandler);
+  mimeManager.registerHandler (xml, xmlMimeHandler);
   mimeManager.setDefaultHandler (xml);
 
   log (MYSERVER_LOG_MSG_INFO, _("Detected %i CPUs"), (int) getCPUCount ());



commit 0b5f954d6571efb0b969e5dec78149295679303f
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon Oct 26 21:56:29 2009 +0100

    Minor aesthetic changes.

diff --git a/myserver/src/http_handler/cgi/cgi.cpp 
b/myserver/src/http_handler/cgi/cgi.cpp
index 2c1f911..57a011b 100644
--- a/myserver/src/http_handler/cgi/cgi.cpp
+++ b/myserver/src/http_handler/cgi/cgi.cpp
@@ -398,7 +398,7 @@ int Cgi::sendData (HttpThreadContext* td, Pipe &stdOutFile, 
FiltersChain& chain,
       return 0;
   }
 
-  /* Update the Content-Length field for logging activity.  */
+  /* Update the Content-length field for logging activity.  */
   td->sentData += nbw;
   return 1;
 }
diff --git a/myserver/src/http_handler/http_dir/http_dir.cpp 
b/myserver/src/http_handler/http_dir/http_dir.cpp
index f597f2b..a94e903 100644
--- a/myserver/src/http_handler/http_dir/http_dir.cpp
+++ b/myserver/src/http_handler/http_dir/http_dir.cpp
@@ -335,7 +335,7 @@ int HttpDir::send (HttpThreadContext* td,
 
   checkDataChunks (td, &keepalive, &useChunks);
 
-  td->response.setValue ("Content-Type", "text/html");
+  td->response.setValue ("Content-type", "text/html");
 
   if (!td->appendOutputs)
   {
diff --git a/myserver/src/http_handler/http_file/http_file.cpp 
b/myserver/src/http_handler/http_file/http_file.cpp
index cfd9dd5..f92aff3 100644
--- a/myserver/src/http_handler/http_file/http_file.cpp
+++ b/myserver/src/http_handler/http_file/http_file.cpp
@@ -84,7 +84,7 @@ int HttpFile::putFile (HttpThreadContext* td,
                 if (file.writeToFile (td->buffer->getBuffer (), nbr, &nbw))
                   {
                     file.close ();
-                  return td->http->raiseHTTPError (500);
+                    return td->http->raiseHTTPError (500);
                   }
               }
             else
@@ -108,10 +108,7 @@ int HttpFile::putFile (HttpThreadContext* td,
         if (file.openFile (td->filenamePath.c_str (),
                          File::FILE_CREATE_ALWAYS |
                          File::WRITE))
-          {
-            /* Internal server error. */
-            return td->http->raiseHTTPError (500);
-          }
+          return td->http->raiseHTTPError (500);
 
         for (;;)
           {
@@ -122,6 +119,7 @@ int HttpFile::putFile (HttpThreadContext* td,
                 file.close ();
                 return td->http->raiseHTTPError (500);
               }
+
             if (nbr)
               {
                 if (file.writeToFile (td->buffer->getBuffer (), nbr, &nbw))
@@ -132,7 +130,8 @@ int HttpFile::putFile (HttpThreadContext* td,
               }
             else
               break;
-            if ( nbw != nbr )
+
+            if (nbw != nbr)
               {
                 file.close ();
                 return td->http->raiseHTTPError (500);
@@ -161,18 +160,18 @@ int HttpFile::deleteFile (HttpThreadContext* td,
   string file;
   int ret;
   try
-  {
-    if (!(td->permissions & MYSERVER_PERMISSION_DELETE))
-      return td->http->sendAuth ();
+    {
+      if (!(td->permissions & MYSERVER_PERMISSION_DELETE))
+        return td->http->sendAuth ();
 
-    if (FilesUtility::fileExists (td->filenamePath))
-      {
-        FilesUtility::deleteFile (td->filenamePath.c_str ());
-        return td->http->raiseHTTPError (202);
-      }
-    else
-      return td->http->raiseHTTPError (204);
-  }
+      if (FilesUtility::fileExists (td->filenamePath))
+        {
+          FilesUtility::deleteFile (td->filenamePath.c_str ());
+          return td->http->raiseHTTPError (202);
+        }
+      else
+        return td->http->raiseHTTPError (204);
+    }
   catch (...)
     {
       return td->http->raiseHTTPError (500);
@@ -327,10 +326,10 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
      * Use GZIP compression to send files bigger than GZIP threshold.
      */
     const char *val = td->securityToken.getData ("gzip.threshold",
-                                                       MYSERVER_SECURITY_CONF
-                                                       | MYSERVER_VHOST_CONF
-                                                       | MYSERVER_MIME_CONF
-                                                       | MYSERVER_SERVER_CONF, 
"0");
+                                                 MYSERVER_SECURITY_CONF
+                                                 | MYSERVER_VHOST_CONF
+                                                 | MYSERVER_MIME_CONF
+                                                 | MYSERVER_SERVER_CONF, "0");
 
     useGzip = false;
     if (val)
@@ -348,7 +347,7 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
      */
     if (useGzip)
       {
-        HttpRequestHeader::Entry* e = td->request.other.get 
("Accept-Encoding");
+        HttpRequestHeader::Entry* e = td->request.other.get 
("Accept-encoding");
         if (e)
           useGzip &= (e->value->find ("gzip") != string::npos);
         else
@@ -372,19 +371,19 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
         buffer << "bytes "<< (u_long)firstByte << "-"
                << (u_long) (lastByte - 1) << "/" << (u_long)filesize;
 
-        e = td->response.other.get ("Content-Range");
+        e = td->response.other.get ("Content-range");
         if (e)
           e->value->assign (buffer.str ());
-       else
-         {
-           e = new HttpResponseHeader::Entry ();
-           e->name->assign ("Content-Range");
-           e->value->assign (buffer.str ());
-           td->response.other.put (*(e->name), e);
-         }
+        else
+          {
+            e = new HttpResponseHeader::Entry ();
+            e->name->assign ("Content-range");
+            e->value->assign (buffer.str ());
+            td->response.other.put (*(e->name), e);
+          }
 
-       useChunks = true;
-       useGzip = false;
+        useChunks = true;
+        useGzip = false;
       }
     chain.setProtocol (td->http);
     chain.setProtocolData (td);
@@ -402,9 +401,9 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
             chain.clearAllFilters ();
             return 0;
           }
-      memStream.refresh ();
-      dataSent += nbw;
-    }
+        memStream.refresh ();
+        dataSent += nbw;
+      }
 
     if (useGzip && !chain.isFilterPresent ("gzip"))
       {
@@ -448,14 +447,14 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
         string s;
         HttpResponseHeader::Entry *e;
         chain.getName (s);
-        e = td->response.other.get ("Content-Encoding");
+        e = td->response.other.get ("Content-encoding");
 
         if (e)
           e->value->assign (s);
         else
           {
             e = new HttpResponseHeader::Entry ();
-            e->name->assign ("Content-Encoding");
+            e->name->assign ("Content-encoding");
             e->value->assign (s);
             td->response.other.put (*(e->name), e);
           }
@@ -467,20 +466,20 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
     if (useChunks)
       {
        HttpResponseHeader::Entry *e;
-       e = td->response.other.get ("Transfer-Encoding");
+       e = td->response.other.get ("Transfer-encoding");
        if (e)
          e->value->assign ("chunked");
        else
          {
            e = new HttpResponseHeader::Entry ();
-           e->name->assign ("Transfer-Encoding");
+           e->name->assign ("Transfer-encoding");
            e->value->assign ("chunked");
            td->response.other.put (*(e->name), e);
          }
       }
     else
       {        HttpResponseHeader::Entry *e;
-       e = td->response.other.remove ("Transfer-Encoding");
+       e = td->response.other.remove ("Transfer-encoding");
        if (e)
          delete e;
       }
diff --git a/myserver/src/http_handler/isapi/isapi.cpp 
b/myserver/src/http_handler/isapi/isapi.cpp
index d6eee57..a1f010f 100644
--- a/myserver/src/http_handler/isapi/isapi.cpp
+++ b/myserver/src/http_handler/isapi/isapi.cpp
@@ -887,7 +887,7 @@ int Isapi::send (HttpThreadContext* td,
   ExtCtrlBlk.lpbData = 0;
   {
     HttpRequestHeader::Entry *content =
-      td->request.other.get ("Content-Type");
+      td->request.other.get ("Content-type");
     ExtCtrlBlk.lpszContentType = content ? (char*)content->value->c_str ()
                                          : 0;
   }
diff --git a/myserver/src/http_handler/mscgi/mscgi_manager.cpp 
b/myserver/src/http_handler/mscgi/mscgi_manager.cpp
index 6f10b0b..96b8de9 100644
--- a/myserver/src/http_handler/mscgi/mscgi_manager.cpp
+++ b/myserver/src/http_handler/mscgi/mscgi_manager.cpp
@@ -250,7 +250,7 @@ MsCgiData* MscgiManager::getCgiData ()
  */
 void MscgiManager::setContentType (const char * type)
 {
-  td->response.setValue ("Content-Type", type);
+  td->response.setValue ("Content-type", type);
 }
 
 /*!
diff --git a/myserver/src/http_handler/wincgi/wincgi.cpp 
b/myserver/src/http_handler/wincgi/wincgi.cpp
index bd07a5f..d4a0d2b 100644
--- a/myserver/src/http_handler/wincgi/wincgi.cpp
+++ b/myserver/src/http_handler/wincgi/wincgi.cpp
@@ -185,7 +185,7 @@ int WinCgi::send (HttpThreadContext* td, const char* 
scriptpath,
   }
 
   {
-    HttpRequestHeader::Entry *contentType = td->request.other.get 
("Content-Type");
+    HttpRequestHeader::Entry *contentType = td->request.other.get 
("Content-type");
 
     if (contentType && contentType->value->length ())
       {
diff --git a/myserver/src/protocol/http/env/env.cpp 
b/myserver/src/protocol/http/env/env.cpp
index 9cc48fa..469925c 100644
--- a/myserver/src/protocol/http/env/env.cpp
+++ b/myserver/src/protocol/http/env/env.cpp
@@ -203,7 +203,7 @@ void Env::buildEnvironmentString (HttpThreadContext* td, 
char *cgiEnv,
   memCgi << td->request.auth.c_str ();
 
 
-  reqEntry = td->request.other.get ("Content-Type");
+  reqEntry = td->request.other.get ("Content-type");
 
   if (reqEntry)
   {
diff --git a/myserver/src/protocol/http/http.cpp 
b/myserver/src/protocol/http/http.cpp
index b65d2e8..10149bd 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -109,7 +109,7 @@ int Http::optionsHTTPRESOURCE (string& filename, int 
yetmapped)
       *td->secondaryBuffer << "\r\nServer: GNU MyServer " << MYSERVER_VERSION;
       if (connection && connection->value->length ())
         *td->secondaryBuffer << "\r\nConnection:" << connection->value->c_str 
() << "\r\n";
-      *td->secondaryBuffer << "Content-Length: 0\r\nAccept-Ranges: bytes\r\n";
+      *td->secondaryBuffer << "Content-length: 0\r\nAccept-Ranges: bytes\r\n";
       *td->secondaryBuffer << "Allow: " << methods << "\r\n\r\n";
 
       /* Send the HTTP header. */
@@ -159,8 +159,8 @@ int Http::traceHTTPRESOURCE (string& filename, int 
yetmapped)
       if (connection && connection->value->length ())
         *td->secondaryBuffer << "Connection:" << connection->value->c_str () 
<< "\r\n";
 
-      *td->secondaryBuffer << "Content-Length:" << tmp << "\r\n"
-              << "Content-Type: message/http\r\n"
+      *td->secondaryBuffer << "Content-length:" << tmp << "\r\n"
+              << "Content-type: message/http\r\n"
               << "Accept-Ranges: bytes\r\n\r\n";
 
       /* Send our HTTP header.  */
@@ -638,12 +638,12 @@ Http::sendHTTPResource (string& uri, int systemrequest, 
int onlyHeader,
       /* If not specified differently, set the default content type to 
text/html.  */
       if (td->mime)
         {
-          td->response.setValue ("Content-Type", td->mime->mimeType.c_str ());
+          td->response.setValue ("Content-type", td->mime->mimeType.c_str ());
           cgiManager = td->mime->cgiManager.c_str ();
         }
       else
         {
-          td->response.setValue ("Content-Type", "text/html");
+          td->response.setValue ("Content-type", "text/html");
           cgiManager = "";
         }
 
@@ -1234,10 +1234,10 @@ int Http::requestAuthorization ()
   *td->secondaryBuffer << "HTTP/1.1 401 Unauthorized\r\n"
           << "Accept-Ranges: bytes\r\n";
   *td->secondaryBuffer << "Server: GNU MyServer " << MYSERVER_VERSION << 
"\r\n";
-  *td->secondaryBuffer << "Content-Type: text/html\r\n"
+  *td->secondaryBuffer << "Content-type: text/html\r\n"
           << "Connection: ";
   *td->secondaryBuffer << (connection ? connection->value->c_str () : "");
-  *td->secondaryBuffer << "\r\nContent-Length: 0\r\n";
+  *td->secondaryBuffer << "\r\nContent-length: 0\r\n";
 
   if (td->authScheme == HTTP_AUTH_SCHEME_BASIC)
     *td->secondaryBuffer << "WWW-Authenticate: Basic realm=\""
@@ -1499,7 +1499,7 @@ Internal Server Error\n\
   td->secondaryBuffer->setLength (0);
   *td->secondaryBuffer << "HTTP/1.1 500 System Error\r\n";
   *td->secondaryBuffer << "Server: GNU MyServer " << MYSERVER_VERSION << 
"\r\n";
-  *td->secondaryBuffer << " Content-Type: text/html\r\nContent-Length: ";
+  *td->secondaryBuffer << " Content-type: text/html\r\nContent-length: ";
   tmp.intToStr ((int) strlen (hardHTML), tmpStr, 12);
   *td->secondaryBuffer << tmp;
   *td->secondaryBuffer << "\r\n";
@@ -1683,9 +1683,9 @@ int Http::sendHTTPRedirect (const char *newURL)
   td->secondaryBuffer->setLength (0);
   *td->secondaryBuffer << "HTTP/1.1 302 Moved\r\nAccept-Ranges: bytes\r\n"
           << "Server: GNU MyServer " << MYSERVER_VERSION << "\r\n"
-          << "Content-Type: text/html\r\n"
+          << "Content-type: text/html\r\n"
           << "Location: " << newURL << "\r\n"
-          << "Content-Length: 0\r\n";
+          << "Content-length: 0\r\n";
 
   if (connection && !stringcmpi (connection->value->c_str (), "keep-alive"))
     *td->secondaryBuffer << "Connection: keep-alive\r\n";
diff --git a/myserver/src/protocol/http/http_data_read.cpp 
b/myserver/src/protocol/http/http_data_read.cpp
index 19b0fa4..5d4c25a 100644
--- a/myserver/src/protocol/http/http_data_read.cpp
+++ b/myserver/src/protocol/http/http_data_read.cpp
@@ -241,7 +241,7 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* 
httpRetCode)
   u_long length;
 
   HttpRequestHeader::Entry *contentType =
-    td->request.other.get ("Content-Type");
+    td->request.other.get ("Content-type");
 
   HttpRequestHeader::Entry *encoding =
     td->request.other.get ("Transfer-Encoding");
@@ -250,7 +250,7 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* 
httpRetCode)
   if (contentType == 0)
   {
     contentType = new HttpRequestHeader::Entry ();
-    contentType->name->assign ("Content-Type");
+    contentType->name->assign ("Content-type");
     contentType->value->assign ("application/x-www-form-urlencoded");
   }
   else if (contentType->value->length () == 0)
diff --git a/myserver/src/protocol/http/http_request.cpp 
b/myserver/src/protocol/http/http_request.cpp
index 6b28825..e94437a 100644
--- a/myserver/src/protocol/http/http_request.cpp
+++ b/myserver/src/protocol/http/http_request.cpp
@@ -132,7 +132,7 @@ string* HttpRequestHeader::getValue (const char* name, 
string* out)
    return &auth;
  }
 
- if (!strcmpi (name, "Content-Length"))
+ if (!strcmpi (name, "Content-length"))
  {
    if (out)
      out->assign (contentLength.c_str ());
@@ -214,7 +214,7 @@ string* HttpRequestHeader::setValue (const char* name, 
const char* in)
    return &auth;
  }
 
- if (!strcmpi (name, "Content-Length"))
+ if (!strcmpi (name, "Content-length"))
  {
    contentLength.assign (in);
    return &contentLength;
diff --git a/myserver/src/protocol/http/http_response.cpp 
b/myserver/src/protocol/http/http_response.cpp
index 797751d..4a6c7ce 100644
--- a/myserver/src/protocol/http/http_response.cpp
+++ b/myserver/src/protocol/http/http_response.cpp
@@ -69,7 +69,7 @@ string* HttpResponseHeader::getValue (const char* name, 
string* out)
       return &ver;
     }
 
-  if (!strcmpi (name, "Content-Length"))
+  if (!strcmpi (name, "Content-length"))
     {
       if (out)
         out->assign (contentLength.c_str ());
@@ -97,7 +97,7 @@ string* HttpResponseHeader::setValue (const char* name, const 
char* in)
       return &ver;
     }
 
-  if (!strcmpi (name, "Content-Length"))
+  if (!strcmpi (name, "Content-length"))
     {
       contentLength.assign (in);
       return &contentLength;



commit 99476ac6e98d0e48ca7c423200b0ea6a7bc7a5b6
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon Oct 26 21:56:07 2009 +0100

    Content-type header value is replaced if it is already defined, not 
appended as it was before.

diff --git a/myserver/src/protocol/http/http_headers.cpp 
b/myserver/src/protocol/http/http_headers.cpp
index 4f8493b..b8173fc 100644
--- a/myserver/src/protocol/http/http_headers.cpp
+++ b/myserver/src/protocol/http/http_headers.cpp
@@ -71,14 +71,14 @@ u_long HttpHeaders::buildHTTPResponseHeader (char *str,
   if (response->contentLength.length ())
     {
       /*
-       * Do not specify the Content-Length field if it is used
+       * Do not specify the Content-length field if it is used
        * the chunked Transfer-Encoding.
        */
       HttpResponseHeader::Entry *e = response->other.get ("Transfer-Encoding");
 
       if (!e || (e && e->value->find ("chunked", 0) == string::npos ))
         {
-          pos += myserver_strlcpy (pos, "Content-Length: ", 
MAX-(long)(pos-str));
+          pos += myserver_strlcpy (pos, "Content-length: ", 
MAX-(long)(pos-str));
           pos += myserver_strlcpy (pos, response->contentLength.c_str (), 
MAX-(long)(pos-str));
           pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
         }
@@ -138,7 +138,7 @@ u_long HttpHeaders::buildHTTPRequestHeader (char * 
str,HttpRequestHeader* reques
 
   if (request->contentLength.length () > 0)
     {
-      pos += myserver_strlcpy (pos, "Content-Length: ", MAX-(long)(pos-str));
+      pos += myserver_strlcpy (pos, "Content-length: ", MAX-(long)(pos-str));
       pos += myserver_strlcpy (pos, request->contentLength.c_str (), 
MAX-(long)(pos-str));
       pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
     }
@@ -196,7 +196,7 @@ void HttpHeaders::buildDefaultHTTPResponseHeader 
(HttpResponseHeader* response)
 {
   resetHTTPResponse (response);
 
-  response->setValue ("Content-Type", "text/html");
+  response->setValue ("Content-type", "text/html");
   response->ver.assign ("HTTP/1.1");
   response->setValue ("Server", "GNU MyServer " MYSERVER_VERSION);
 }
@@ -541,7 +541,7 @@ int HttpHeaders::buildHTTPRequestHeaderStruct (const char* 
input,
             return ret;
           lineControlled = 1;
         }
-      else if (!strcmpi (command, (char*)"Content-Length"))
+      else if (!strcmpi (command, (char*)"Content-length"))
         {
           tokenOff = getEndLine (token, HTTP_REQUEST_CONTENT_LENGTH_DIM);
           if (tokenOff == -1)
@@ -979,7 +979,7 @@ int HttpHeaders::buildHTTPResponseHeaderStruct (const char 
*input,
           if (token)
             response->httpStatus = atoi (token);
       }
-    else if (!strcmpi (command, "Content-Length"))
+    else if (!strcmpi (command, "Content-length"))
       {
         token = strtok (NULL, "\r\n\0" );
         lineControlled = 1;
@@ -996,6 +996,7 @@ int HttpHeaders::buildHTTPResponseHeaderStruct (const char 
*input,
      */
     if ( (!lineControlled) &&  ((!containStatusLine) || (nLineControlled != 
1)))
       {
+        bool append = true;
         token = strtok (NULL, "\r\n");
 
         while (token && *token == ' ')
@@ -1011,6 +1012,9 @@ int HttpHeaders::buildHTTPResponseHeaderStruct (const 
char *input,
                 break;
               }
 
+            if (!strcmpi (command, "Content-type"))
+              append = false;
+
             HttpResponseHeader::Entry *old = NULL;
             HttpResponseHeader::Entry *e = new HttpResponseHeader::Entry ();
             e->name->assign (command);
@@ -1018,8 +1022,12 @@ int HttpHeaders::buildHTTPResponseHeaderStruct (const 
char *input,
             old = response->other.put (cmdString, e);
             if (old)
               {
-                e->value->assign (*old->value);
-                e->value->append (", ");
+                if (append)
+                  {
+                    e->value->assign (*old->value);
+                    e->value->append (", ");
+                  }
+
                 e->value->append (token);
                 delete old;
               }



commit f0ae6edcea3762b0c9bfa99e58445ccdbf800bff
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon Oct 26 20:45:41 2009 +0100

    By default do not use X-Sendfile.

diff --git a/myserver/documentation/process_security.texi 
b/myserver/documentation/process_security.texi
index fb89869..b6aad2d 100644
--- a/myserver/documentation/process_security.texi
+++ b/myserver/documentation/process_security.texi
@@ -106,7 +106,8 @@ registers it on the @code{fcgi} extension:
 
 @example
 <DEFINE name="process_servers.list">
-  <DEFINE server="a_remote_server" domain="fastcgi" host="foo" port="2010" 
local="no"/>
+  <DEFINE server="a_remote_server" domain="fastcgi" host="foo" port="2010"
+          local="no"/>
 </DEFINE>
 
 <!-- Inside MIMEtypes.xml.  -->
@@ -114,3 +115,17 @@ registers it on the @code{fcgi} extension:
       <EXTENSION value="fcgi"/>
 </MIME>
 @end example
+
+
address@hidden FastCGI X-Sendfile directive
+The X-Sendfile directive can be used by FastCGI servers to instruct
+the web server to ignore any content but send the file specified in
+the X-Sendfile header.  It is much faster to transfer static contents
+and avoid an additional step from the FastCGI server to the web
+server.
+
+Since the FastCGI X-Sendfile can ask any file to be accessed
+statically, this feature is not considered safe you must force it
+manually, in can be done on a virtual hosts basis.
+It is done trough the @code{fastcgi.sendfile.allow} variable, to
+enable X-Sendfile set its value to @code{YES}.
diff --git a/myserver/src/http_handler/fastcgi/fastcgi.cpp 
b/myserver/src/http_handler/fastcgi/fastcgi.cpp
index e05f79d..580b8be 100644
--- a/myserver/src/http_handler/fastcgi/fastcgi.cpp
+++ b/myserver/src/http_handler/fastcgi/fastcgi.cpp
@@ -748,23 +748,31 @@ int FastCgi::handleHeader (FcgiContext* con, 
FiltersChain* chain, bool* response
                                               &con->td->response,
                                               &(con->td->nBytesToRead));
 
-  string *sendfile = con->td->response.getValue ("X-Sendfile", NULL);
-  if (sendfile)
+  bool allowSendfile =
+    !strcmpi (con->td->securityToken.getData ("fastcgi.sendfile.allow",
+                                              MYSERVER_VHOST_CONF
+                                              | MYSERVER_SERVER_CONF, "NO"),
+              "YES");
+  if (allowSendfile)
     {
-      HttpStaticData *staticData = con->td->http->getStaticData ();
-      HttpDataHandler *handler = staticData->dynManagerList.getHttpManager 
("SEND");
-      if (!handler)
+      string *sendfile = con->td->response.getValue ("X-Sendfile", NULL);
+      if (sendfile)
         {
-          con->td->connection->host->warningsLogWrite
-            (_("FastCGI: cannot find handler for SEND"));
-          return con->td->http->raiseHTTPError (500);
-        }
+          HttpStaticData *staticData = con->td->http->getStaticData ();
+          HttpDataHandler *handler = staticData->dynManagerList.getHttpManager 
("SEND");
+          if (!handler)
+            {
+              con->td->connection->host->warningsLogWrite
+                (_("FastCGI: cannot find handler for SEND"));
+              return con->td->http->raiseHTTPError (500);
+            }
 
-      string url (*sendfile);
-      delete con->td->response.other.remove ("X-Sendfile");
-      *responseCompleted = true;
-      handler->send (con->td, url.c_str (), NULL, false, onlyHeader);
-      return 1;
+          string url (*sendfile);
+          delete con->td->response.other.remove ("X-Sendfile");
+          *responseCompleted = true;
+          handler->send (con->td, url.c_str (), NULL, false, onlyHeader);
+          return 1;
+        }
     }
 
   if (!con->td->appendOutputs)

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

Summary of changes:
 myserver/documentation/process_security.texi      |   17 ++++-
 myserver/include/server/server.h                  |    2 +-
 myserver/src/http_handler/cgi/cgi.cpp             |    2 +-
 myserver/src/http_handler/fastcgi/fastcgi.cpp     |   36 ++++++----
 myserver/src/http_handler/http_dir/http_dir.cpp   |    2 +-
 myserver/src/http_handler/http_file/http_file.cpp |   79 ++++++++++-----------
 myserver/src/http_handler/isapi/isapi.cpp         |    2 +-
 myserver/src/http_handler/mscgi/mscgi_manager.cpp |    2 +-
 myserver/src/http_handler/wincgi/wincgi.cpp       |    2 +-
 myserver/src/protocol/http/env/env.cpp            |    2 +-
 myserver/src/protocol/http/http.cpp               |   20 +++---
 myserver/src/protocol/http/http_data_read.cpp     |    4 +-
 myserver/src/protocol/http/http_headers.cpp       |   24 ++++--
 myserver/src/protocol/http/http_request.cpp       |    4 +-
 myserver/src/protocol/http/http_response.cpp      |    4 +-
 myserver/src/server/server.cpp                    |    5 +-
 16 files changed, 119 insertions(+), 88 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

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