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. v0.9.2-494


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. v0.9.2-494-gf7801e9
Date: Tue, 26 Apr 2011 12:41:01 +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  f7801e95bd7809d5dc9f9f7282be8078253e5fbc (commit)
       via  360513f720c194038fa946c2b518e3c693cbbc98 (commit)
      from  b1508982b8ed2deeb8ae3250ea230e5458925803 (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 f7801e95bd7809d5dc9f9f7282be8078253e5fbc
Author: Giuseppe Scrivano <address@hidden>
Date:   Tue Apr 26 14:40:51 2011 +0200

    HttpDataHandler: reset the content-length field if a transfer encoding is 
specified.

diff --git a/myserver/src/conf/vhost/xml_vhost_handler.cpp 
b/myserver/src/conf/vhost/xml_vhost_handler.cpp
index 3e96b10..ddba181 100644
--- a/myserver/src/conf/vhost/xml_vhost_handler.cpp
+++ b/myserver/src/conf/vhost/xml_vhost_handler.cpp
@@ -272,12 +272,9 @@ XmlVhostHandler::loadXMLlogData (string name, Vhost *vh, 
xmlNode *lcur)
             }
         }
 
-      int err = 1;
-      string str ("XmlVhostHandler::loadXMLlogData : Unrecognized log type");
-
       if (! name.compare ("ACCESSLOG"))
         {
-          err = vh->openAccessLog (location, filters, cycle);
+          int err = vh->openAccessLog (location, filters, cycle);
           vh->setAccessLogOpt (opt.c_str ());
           if (err)
             Server::getInstance ()->log (MYSERVER_LOG_MSG_ERROR,
@@ -285,7 +282,7 @@ XmlVhostHandler::loadXMLlogData (string name, Vhost *vh, 
xmlNode *lcur)
         }
       else if (! name.compare ("WARNINGLOG"))
         {
-          err = vh->openWarningLog (location, filters, cycle);
+          int err = vh->openWarningLog (location, filters, cycle);
           vh->setWarningLogOpt (opt.c_str ());
           if (err)
             Server::getInstance ()->log (MYSERVER_LOG_MSG_ERROR,
diff --git a/myserver/src/protocol/http/http_data_handler.cpp 
b/myserver/src/protocol/http/http_data_handler.cpp
index 2409da0..fdc0875 100644
--- a/myserver/src/protocol/http/http_data_handler.cpp
+++ b/myserver/src/protocol/http/http_data_handler.cpp
@@ -175,6 +175,7 @@ HttpDataHandler::chooseEncoding (HttpThreadContext *td, 
bool disableEncoding)
     {
       td->response.setValue ("transfer-encoding", "chunked");
       td->transferEncoding = HttpThreadContext::TRANSFER_ENCODING_CHUNKED;
+      td->response.contentLength.assign ("");
     }
 }
 
@@ -275,6 +276,7 @@ HttpDataHandler::generateFiltersChain (HttpThreadContext 
*td,
       string filters;
       td->outputChain.getName (filters);
       td->response.setValue ("content-encoding", filters.c_str ());
+      td->response.contentLength.assign ("");
     }
 
   td->outputChain.setStream (td->connection->socket);



commit 360513f720c194038fa946c2b518e3c693cbbc98
Author: Giuseppe Scrivano <address@hidden>
Date:   Tue Apr 26 14:40:16 2011 +0200

    Proxy: don't assume the content-length remains the same.

diff --git a/myserver/include/http_handler/proxy/proxy.h 
b/myserver/include/http_handler/proxy/proxy.h
index 2a02ffc..e15d1a3 100644
--- a/myserver/include/http_handler/proxy/proxy.h
+++ b/myserver/include/http_handler/proxy/proxy.h
@@ -57,6 +57,7 @@ protected:
                    const char *initBuffer,
                    u_long initBufferSize,
                    int timeout,
+                   size_t contentLength,
                    string *serverTransferEncoding = NULL);
 
   static void proxySchedulerHandler (void *p, Connection *c, int event);
diff --git a/myserver/src/http_handler/proxy/proxy.cpp 
b/myserver/src/http_handler/proxy/proxy.cpp
index 1bb6a4b..0852b78 100644
--- a/myserver/src/http_handler/proxy/proxy.cpp
+++ b/myserver/src/http_handler/proxy/proxy.cpp
@@ -155,6 +155,9 @@ int Proxy::flushToClient (HttpThreadContext* td, Socket 
&client,
   int ret;
   size_t nbw;
   bool validResponse = false;
+  size_t contentLength = (size_t) - 1;
+
+
   td->response.free ();
 
   for (;;)
@@ -181,6 +184,9 @@ int Proxy::flushToClient (HttpThreadContext* td, Socket 
&client,
   if (read == 0)
     return td->http->raiseHTTPError (500);
 
+  if (td->response.contentLength.length ())
+    contentLength = atoll (td->response.contentLength.c_str ());
+
   string *tmp = td->request.getValue ("Host", NULL);
   const char *via = tmp ? tmp->c_str () : td->connection->getLocalIpAddr ();
 
@@ -225,7 +231,7 @@ int Proxy::flushToClient (HttpThreadContext* td, Socket 
&client,
 
   readPayLoad (td, &td->response, &client,
                td->auxiliaryBuffer->getBuffer () + headerLength,
-               read - headerLength, td->http->getTimeout (),
+               read - headerLength, td->http->getTimeout (), contentLength,
                hasTransferEncoding ? &transferEncoding : NULL);
 
   return HttpDataHandler::RET_OK;
@@ -240,6 +246,8 @@ int Proxy::flushToClient (HttpThreadContext* td, Socket 
&client,
   \param initBufferSize Size of initial data.
   \param timeout Connection timeout.
   with the client.
+  \param contentLength The Content-Length specified by
+  the client, if any.
   \param serverTransferEncoding Transfer-encoding
   used by the server.
 
@@ -252,23 +260,15 @@ int Proxy::readPayLoad (HttpThreadContext* td,
                         const char *initBuffer,
                         u_long initBufferSize,
                         int timeout,
+                        size_t contentLength,
                         string *serverTransferEncoding)
 {
-  size_t contentLength = ((size_t) -1);
-
   size_t nbr = 0, nbw = 0, inPos = 0;
 
   /* Only the chunked transfer encoding is supported.  */
   if (serverTransferEncoding && serverTransferEncoding->compare ("chunked"))
     return HttpDataHandler::RET_FAILURE;
 
-  if (res->contentLength.length ())
-    {
-      contentLength = atoll (res->contentLength.c_str ());
-      if (contentLength < 0)
-        return HttpDataHandler::RET_FAILURE;
-    }
-
   /* If it is specified a transfer encoding read data using it.  */
   if (serverTransferEncoding)
     {
@@ -324,7 +324,7 @@ int Proxy::readPayLoad (HttpThreadContext* td,
           td->sentData +=
             HttpDataHandler::appendDataToHTTPChannel (td,
                                              td->buffer->getBuffer (), nbr);
-          if (timedOut || contentLength && length == 0)
+          if (timedOut || contentLength != ((size_t) -1) && length == 0)
             break;
         }
     }

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

Summary of changes:
 myserver/include/http_handler/proxy/proxy.h      |    1 +
 myserver/src/conf/vhost/xml_vhost_handler.cpp    |    7 ++-----
 myserver/src/http_handler/proxy/proxy.cpp        |   22 +++++++++++-----------
 myserver/src/protocol/http/http_data_handler.cpp |    2 ++
 4 files changed, 16 insertions(+), 16 deletions(-)


hooks/post-receive
-- 
GNU MyServer



reply via email to

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