Eliminate extra buffer operations.
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Tue, 22 May 2007 15:33:46 +0000 (15:33 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Tue, 22 May 2007 15:33:46 +0000 (15:33 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@2258 cb58f699-b61c-0410-a6fe-9272a202ed29

apache/mod_apache.cpp

index 4b2b9c8..ccbc0c3 100644 (file)
@@ -342,13 +342,12 @@ public:
     if (m_req->remaining > 1024*1024)
         throw opensaml::SecurityPolicyException("Blocked request body larger than 1M size limit.");
     m_gotBody=true;
+    int len;
     char buff[HUGE_STRING_LEN];
     ap_hard_timeout("[mod_shib] getRequestBody", m_req);
-    memset(buff, 0, sizeof(buff));
-    while (ap_get_client_block(m_req, buff, sizeof(buff)-1) > 0) {
+    while ((len=ap_get_client_block(m_req, buff, sizeof(buff))) > 0) {
       ap_reset_timeout(m_req);
-      m_body += buff;
-      memset(buff, 0, sizeof(buff));
+      m_body.append(buff, len);
     }
     ap_kill_timeout(m_req);
     return m_body.c_str();