[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9-373-g2
From: |
Giuseppe Scrivano |
Subject: |
[myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9-373-g2061dc5 |
Date: |
Sat, 07 Nov 2009 01:25:19 +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 2061dc519cc864c8da2ff425b2733b71722eaa93 (commit)
via 643175177b8348828d281cbb6268c11a0a74a122 (commit)
from b3af1c9fcee65903a7e9fda30b3c9aad9c6f2611 (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 2061dc519cc864c8da2ff425b2733b71722eaa93
Author: Giuseppe Scrivano <address@hidden>
Date: Sat Nov 7 02:11:51 2009 +0100
Rename secondaryBuffer to auxiliaryBuffer plus minor style changes.
diff --git a/myserver/include/protocol/ftp/ftp.h
b/myserver/include/protocol/ftp/ftp.h
index df4ea16..e420bbf 100644
--- a/myserver/include/protocol/ftp/ftp.h
+++ b/myserver/include/protocol/ftp/ftp.h
@@ -90,7 +90,7 @@ struct FtpThreadContext
FtpThreadContext ();
ConnectionPtr pConnection;
MemBuf *buffer;
- MemBuf *secondaryBuffer;
+ MemBuf *auxiliaryBuffer;
u_long buffersize;
u_long m_nParseLength;
u_long nBytesToRead;
diff --git a/myserver/include/protocol/http/http_thread_context.h
b/myserver/include/protocol/http/http_thread_context.h
index 7a069e4..5df3dab 100644
--- a/myserver/include/protocol/http/http_thread_context.h
+++ b/myserver/include/protocol/http/http_thread_context.h
@@ -64,7 +64,7 @@ struct HttpThreadContext
ConnectionPtr connection;
MemBuf *buffer;
- MemBuf *secondaryBuffer;
+ MemBuf *auxiliaryBuffer;
u_long buffersize;
u_long id;
u_long nBytesToRead;
diff --git a/myserver/include/server/clients_thread.h
b/myserver/include/server/clients_thread.h
index ec18093..9b44f81 100644
--- a/myserver/include/server/clients_thread.h
+++ b/myserver/include/server/clients_thread.h
@@ -85,7 +85,7 @@ private:
bool isRunning ();
bool isStopped ();
MemBuf buffer;
- MemBuf secondaryBuffer;
+ MemBuf auxiliaryBuffer;
int controlConnections ();
u_long nBytesToRead;
};
diff --git a/myserver/src/http_handler/cgi/cgi.cpp
b/myserver/src/http_handler/cgi/cgi.cpp
index 209c397..79dbe14 100644
--- a/myserver/src/http_handler/cgi/cgi.cpp
+++ b/myserver/src/http_handler/cgi/cgi.cpp
@@ -231,10 +231,10 @@ int Cgi::send (HttpThreadContext* td, const char*
scriptpath,
/*
*Build the environment string used by the CGI process.
- *Use the td->secondaryBuffer to build the environment string.
+ *Use the td->auxiliaryBuffer to build the environment string.
*/
- (td->secondaryBuffer->getBuffer ())[0] = '\0';
- Env::buildEnvironmentString (td, td->secondaryBuffer->getBuffer ());
+ (td->auxiliaryBuffer->getBuffer ())[0] = '\0';
+ Env::buildEnvironmentString (td, td->auxiliaryBuffer->getBuffer ());
spi.cmdLine = cmdLine.str ();
spi.cwd.assign (td->scriptDir);
@@ -255,7 +255,7 @@ int Cgi::send (HttpThreadContext* td, const char*
scriptpath,
spi.stdError = (FileHandle) stdOutFile.getWriteHandle ();
spi.stdIn = (FileHandle) stdInFile.getHandle ();
spi.stdOut = (FileHandle) stdOutFile.getWriteHandle ();
- spi.envString = td->secondaryBuffer->getBuffer ();
+ spi.envString = td->auxiliaryBuffer->getBuffer ();
if (spi.stdError == (FileHandle) -1 ||
spi.stdIn == (FileHandle) -1 ||
@@ -328,8 +328,8 @@ int Cgi::sendData (HttpThreadContext* td, Pipe &stdOutFile,
FiltersChain& chain,
bool keepalive = false;
int ret = 0;
- /* Reset the secondaryBuffer length counter. */
- td->secondaryBuffer->setLength (0);
+ /* Reset the auxiliaryBuffer length counter. */
+ td->auxiliaryBuffer->setLength (0);
procStartTime = getTicks ();
@@ -375,8 +375,8 @@ int Cgi::sendData (HttpThreadContext* td, Pipe &stdOutFile,
FiltersChain& chain,
aliveProcess = !stdOutFile.pipeTerminated ();
/* Read data from the process standard output file. */
- if (stdOutFile.read (td->secondaryBuffer->getBuffer (),
- td->secondaryBuffer->getRealLength (),
+ if (stdOutFile.read (td->auxiliaryBuffer->getBuffer (),
+ td->auxiliaryBuffer->getRealLength (),
&nBytesRead))
return HttpDataHandler::RET_FAILURE;
@@ -385,7 +385,7 @@ int Cgi::sendData (HttpThreadContext* td, Pipe &stdOutFile,
FiltersChain& chain,
if (nBytesRead &&
HttpDataHandler::appendDataToHTTPChannel (td,
-
td->secondaryBuffer->getBuffer (),
+
td->auxiliaryBuffer->getBuffer (),
nBytesRead,
&(td->outputData),
&chain,
@@ -432,7 +432,7 @@ int Cgi::sendHeader (HttpThreadContext* td, Pipe
&stdOutFile, FiltersChain& chai
/* Do not try to read using a small buffer as this has some
bad influence on the performances. */
- if (td->secondaryBuffer->getRealLength () - headerOffset - 1 < 512)
+ if (td->auxiliaryBuffer->getRealLength () - headerOffset - 1 < 512)
break;
term = stdOutFile.pipeTerminated ();
@@ -445,8 +445,8 @@ int Cgi::sendHeader (HttpThreadContext* td, Pipe
&stdOutFile, FiltersChain& chai
break;
}
- if (stdOutFile.read (td->secondaryBuffer->getBuffer () + headerOffset,
- td->secondaryBuffer->getRealLength () - headerOffset
- 1,
+ if (stdOutFile.read (td->auxiliaryBuffer->getBuffer () + headerOffset,
+ td->auxiliaryBuffer->getRealLength () - headerOffset
- 1,
&nBytesRead))
{
*ret = td->http->raiseHTTPError (500);
@@ -462,7 +462,7 @@ int Cgi::sendHeader (HttpThreadContext* td, Pipe
&stdOutFile, FiltersChain& chai
headerOffset += nBytesRead;
if (headerOffset > td->buffersize - 5)
- (td->secondaryBuffer->getBuffer ())[headerOffset] = '\0';
+ (td->auxiliaryBuffer->getBuffer ())[headerOffset] = '\0';
if (headerOffset == 0)
{
@@ -473,7 +473,7 @@ int Cgi::sendHeader (HttpThreadContext* td, Pipe
&stdOutFile, FiltersChain& chai
for (u_long i = std::max (0UL, headerOffset - nBytesRead - 10);
i < headerOffset; i++)
{
- char *buff = td->secondaryBuffer->getBuffer ();
+ char *buff = td->auxiliaryBuffer->getBuffer ();
if ((buff[i] == '\r') && (buff[i+1] == '\n')
&& (buff[i+2] == '\r') && (buff[i+3] == '\n'))
{
@@ -506,7 +506,7 @@ int Cgi::sendHeader (HttpThreadContext* td, Pipe
&stdOutFile, FiltersChain& chai
/* Send the header. */
if (headerSize)
- HttpHeaders::buildHTTPResponseHeaderStruct
(td->secondaryBuffer->getBuffer (),
+ HttpHeaders::buildHTTPResponseHeaderStruct
(td->auxiliaryBuffer->getBuffer (),
&td->response,
&(td->nBytesToRead));
/*
@@ -539,7 +539,7 @@ int Cgi::sendHeader (HttpThreadContext* td, Pipe
&stdOutFile, FiltersChain& chai
{
/* Flush the buffer. Data from the header parsing can be present. */
if (HttpDataHandler::appendDataToHTTPChannel (td,
- td->secondaryBuffer->getBuffer () + headerSize,
+ td->auxiliaryBuffer->getBuffer () + headerSize,
headerOffset - headerSize,
&(td->outputData),
&chain,
diff --git a/myserver/src/http_handler/fastcgi/fastcgi.cpp
b/myserver/src/http_handler/fastcgi/fastcgi.cpp
index 396ac0e..194bd71 100644
--- a/myserver/src/http_handler/fastcgi/fastcgi.cpp
+++ b/myserver/src/http_handler/fastcgi/fastcgi.cpp
@@ -114,7 +114,7 @@ int FastCgi::send (HttpThreadContext* td, const char*
scriptpath,
}
td->buffer->setLength (0);
- td->secondaryBuffer->getAt (0) = '\0';
+ td->auxiliaryBuffer->getAt (0) = '\0';
/*! Do not modify the text between " and ". */
@@ -573,7 +573,7 @@ int FastCgi::fastCgiRequest (FcgiContext* con, int id)
Env::buildEnvironmentString (td, td->buffer->getBuffer ());
sizeEnvString = buildFASTCGIEnvironmentString (td,td->buffer->getBuffer (),
- td->secondaryBuffer->getBuffer
());
+ td->auxiliaryBuffer->getBuffer
());
if (sizeEnvString == -1)
{
td->buffer->setLength (0);
@@ -594,7 +594,7 @@ int FastCgi::fastCgiRequest (FcgiContext* con, int id)
return 1;
}
- if (sendFcgiBody (con, td->secondaryBuffer->getBuffer (), sizeEnvString,
+ if (sendFcgiBody (con, td->auxiliaryBuffer->getBuffer (), sizeEnvString,
FCGIPARAMS, id))
{
td->buffer->setLength (0);
@@ -787,7 +787,7 @@ int FastCgi::handleHeader (FcgiContext* con, FiltersChain*
chain, bool* response
}
if (HttpHeaders::sendHeader (con->td->response, *con->td->connection->socket,
- *con->td->secondaryBuffer, con->td))
+ *con->td->auxiliaryBuffer, con->td))
{
*responseCompleted = true;
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 25eb7ec..9a53ee1 100644
--- a/myserver/src/http_handler/http_dir/http_dir.cpp
+++ b/myserver/src/http_handler/http_dir/http_dir.cpp
@@ -394,14 +394,14 @@ int HttpDir::send (HttpThreadContext* td,
| MYSERVER_VHOST_CONF
| MYSERVER_SERVER_CONF, NULL);
- td->secondaryBuffer->setLength (0);
- *td->secondaryBuffer << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
+ td->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"\r\n"
"\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\r\n"
"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">"
"\r\n<head>\r\n<title>" ;
- *td->secondaryBuffer << td->request.uri.c_str () ;
- *td->secondaryBuffer << "</title>\r\n";
+ *td->auxiliaryBuffer << td->request.uri.c_str () ;
+ *td->auxiliaryBuffer << "</title>\r\n";
/*
* If it is defined a CSS file for the graphic layout of
@@ -409,15 +409,15 @@ int HttpDir::send (HttpThreadContext* td,
*/
if (cssFile)
{
- *td->secondaryBuffer << "<link rel=\"stylesheet\" href=\""
+ *td->auxiliaryBuffer << "<link rel=\"stylesheet\" href=\""
<< cssFile
<< "\" type=\"text/css\" media=\"all\"/>\r\n";
}
- *td->secondaryBuffer << "</head>\r\n";
+ *td->auxiliaryBuffer << "</head>\r\n";
- ret = appendDataToHTTPChannel (td, td->secondaryBuffer->getBuffer (),
- td->secondaryBuffer->getLength (),
+ ret = appendDataToHTTPChannel (td, td->auxiliaryBuffer->getBuffer (),
+ td->auxiliaryBuffer->getLength (),
&(td->outputData), &chain,
td->appendOutputs, useChunks);
if (ret)
@@ -428,16 +428,16 @@ int HttpDir::send (HttpThreadContext* td,
return td->http->raiseHTTPError (500);
}
- sentData = td->secondaryBuffer->getLength ();
+ sentData = td->auxiliaryBuffer->getLength ();
filename = directory;
- td->secondaryBuffer->setLength (0);
- *td->secondaryBuffer << "<body>\r\n<h1>Contents of directory ";
- *td->secondaryBuffer << &td->request.uri[lastSlash] ;
- *td->secondaryBuffer << "</h1>\r\n<hr />\r\n";
+ td->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << "<body>\r\n<h1>Contents of directory ";
+ *td->auxiliaryBuffer << &td->request.uri[lastSlash] ;
+ *td->auxiliaryBuffer << "</h1>\r\n<hr />\r\n";
- ret = appendDataToHTTPChannel (td, td->secondaryBuffer->getBuffer (),
- td->secondaryBuffer->getLength (),
+ ret = appendDataToHTTPChannel (td, td->auxiliaryBuffer->getBuffer (),
+ td->auxiliaryBuffer->getLength (),
&(td->outputData), &chain,
td->appendOutputs, useChunks);
@@ -447,7 +447,7 @@ int HttpDir::send (HttpThreadContext* td,
/* Return an internal server error. */
return td->http->raiseHTTPError (500);
}
- sentData += td->secondaryBuffer->getLength ();
+ sentData += td->auxiliaryBuffer->getLength ();
ret = fd.findfirst (filename.c_str ());
@@ -461,13 +461,13 @@ int HttpDir::send (HttpThreadContext* td,
* With the current code we build the HTML TABLE to indicize the
* files in the directory.
*/
- td->secondaryBuffer->setLength (0);
- *td->secondaryBuffer << "<table width=\"100%\">\r\n" ;
+ td->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << "<table width=\"100%\">\r\n" ;
- generateHeader (*td->secondaryBuffer, sortType, sortReverse, formatString);
+ generateHeader (*td->auxiliaryBuffer, sortType, sortReverse, formatString);
- ret = appendDataToHTTPChannel (td, td->secondaryBuffer->getBuffer (),
- td->secondaryBuffer->getLength (),
+ ret = appendDataToHTTPChannel (td, td->auxiliaryBuffer->getBuffer (),
+ td->auxiliaryBuffer->getLength (),
&(td->outputData), &chain,
td->appendOutputs, useChunks);
@@ -479,9 +479,9 @@ int HttpDir::send (HttpThreadContext* td,
return td->http->raiseHTTPError (500);
}
- sentData += td->secondaryBuffer->getLength ();
+ sentData += td->auxiliaryBuffer->getLength ();
- td->secondaryBuffer->setLength (0);
+ td->auxiliaryBuffer->setLength (0);
if (FilesUtility::getPathRecursionLevel (td->request.uri) >= 1)
{
@@ -490,7 +490,7 @@ int HttpDir::send (HttpThreadContext* td,
file.assign (td->request.uri);
file.append ("/../");
- *td->secondaryBuffer << "<tr>\r\n";
+ *td->auxiliaryBuffer << "<tr>\r\n";
for (;;)
{
@@ -501,20 +501,20 @@ int HttpDir::send (HttpThreadContext* td,
break;
if (*cur == 'f')
- *td->secondaryBuffer << "<td>\n"
+ *td->auxiliaryBuffer << "<td>\n"
<< "<a href=\""
<< (td->request.uriEndsWithSlash ? ".." : ".")
<< "\">[ .. ]</a></td>\n";
else
- *td->secondaryBuffer << "<td></td>\n";
+ *td->auxiliaryBuffer << "<td></td>\n";
cur++;
}
- *td->secondaryBuffer << "</tr>\r\n";
+ *td->auxiliaryBuffer << "</tr>\r\n";
- ret = appendDataToHTTPChannel (td, td->secondaryBuffer->getBuffer (),
- td->secondaryBuffer->getLength (),
+ ret = appendDataToHTTPChannel (td, td->auxiliaryBuffer->getBuffer (),
+ td->auxiliaryBuffer->getLength (),
&(td->outputData), &chain,
td->appendOutputs, useChunks);
if (ret)
@@ -525,7 +525,7 @@ int HttpDir::send (HttpThreadContext* td,
/* Return an internal server error. */
return td->http->raiseHTTPError (500);
}
- sentData += td->secondaryBuffer->getLength ();
+ sentData += td->auxiliaryBuffer->getLength ();
}
/* Put all files in a vector. */
@@ -583,12 +583,12 @@ int HttpDir::send (HttpThreadContext* td,
{
FileStruct& file = *it;
- td->secondaryBuffer->setLength (0);
+ td->auxiliaryBuffer->setLength (0);
- generateElement (*td->secondaryBuffer, file, linkPrefix, formatString);
+ generateElement (*td->auxiliaryBuffer, file, linkPrefix, formatString);
- ret = appendDataToHTTPChannel (td, td->secondaryBuffer->getBuffer (),
- td->secondaryBuffer->getLength (),
+ ret = appendDataToHTTPChannel (td, td->auxiliaryBuffer->getBuffer (),
+ td->auxiliaryBuffer->getLength (),
&(td->outputData), &chain,
td->appendOutputs, useChunks);
if (ret)
@@ -599,31 +599,31 @@ int HttpDir::send (HttpThreadContext* td,
return td->http->raiseHTTPError (500);
}
- sentData += td->secondaryBuffer->getLength ();
+ sentData += td->auxiliaryBuffer->getLength ();
}
- td->secondaryBuffer->setLength (0);
- *td->secondaryBuffer << "</table>\r\n<hr />\r\n<address>"
+ td->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << "</table>\r\n<hr />\r\n<address>"
<< MYSERVER_VERSION;
if (host && host->value->length ())
{
ostringstream portBuff;
size_t portSeparator = host->value->find (':');
- *td->secondaryBuffer << " on ";
+ *td->auxiliaryBuffer << " on ";
if (portSeparator != string::npos)
- *td->secondaryBuffer << host->value->substr (0, portSeparator).c_str
() ;
+ *td->auxiliaryBuffer << host->value->substr (0, portSeparator).c_str
() ;
else
- *td->secondaryBuffer << host->value->c_str () ;
+ *td->auxiliaryBuffer << host->value->c_str () ;
- *td->secondaryBuffer << " Port ";
+ *td->auxiliaryBuffer << " Port ";
portBuff << td->connection->getLocalPort ();
- *td->secondaryBuffer << portBuff.str ();
+ *td->auxiliaryBuffer << portBuff.str ();
}
- *td->secondaryBuffer << "</address>\r\n</body>\r\n</html>\r\n";
- ret = appendDataToHTTPChannel (td, td->secondaryBuffer->getBuffer (),
- td->secondaryBuffer->getLength (),
+ *td->auxiliaryBuffer << "</address>\r\n</body>\r\n</html>\r\n";
+ ret = appendDataToHTTPChannel (td, td->auxiliaryBuffer->getBuffer (),
+ td->auxiliaryBuffer->getLength (),
&(td->outputData), &chain,
td->appendOutputs, useChunks);
@@ -633,11 +633,11 @@ int HttpDir::send (HttpThreadContext* td,
/* Return an internal server error. */
return td->http->raiseHTTPError (500);
}
- sentData += td->secondaryBuffer->getLength ();
+ sentData += td->auxiliaryBuffer->getLength ();
- *td->secondaryBuffer << end_str;
+ *td->auxiliaryBuffer << end_str;
/* Changes the \ character in the / character. */
- bufferloop = td->secondaryBuffer->getBuffer ();
+ bufferloop = td->auxiliaryBuffer->getBuffer ();
while (*bufferloop++)
if (*bufferloop == '\\')
*bufferloop = '/';
diff --git a/myserver/src/http_handler/http_file/http_file.cpp
b/myserver/src/http_handler/http_file/http_file.cpp
index 287b937..0488ab6 100644
--- a/myserver/src/http_handler/http_file/http_file.cpp
+++ b/myserver/src/http_handler/http_file/http_file.cpp
@@ -221,7 +221,7 @@ int HttpFile::send (HttpThreadContext* td, const char
*filenamePath,
bool keepalive = false;
bool useChunks = false;
bool useModifiers = false;
- MemoryStream memStream (td->secondaryBuffer);
+ MemoryStream memStream (td->auxiliaryBuffer);
FiltersChain chain;
u_long nbw;
u_long nbr;
diff --git a/myserver/src/http_handler/isapi/isapi.cpp
b/myserver/src/http_handler/isapi/isapi.cpp
index 9c96057..ce5f352 100644
--- a/myserver/src/http_handler/isapi/isapi.cpp
+++ b/myserver/src/http_handler/isapi/isapi.cpp
@@ -292,7 +292,7 @@ BOOL WINAPI ISAPI_WriteClientExport (HCONN hConn, LPVOID
Buffer, LPDWORD lpdwByt
if (HttpHeaders::sendHeader (ConnInfo->td->response,
*td->connection->socket,
- *ConnInfo->td->secondaryBuffer,
ConnInfo->td))
+ *ConnInfo->td->auxiliaryBuffer,
ConnInfo->td))
return HttpDataHandler::RET_FAILURE;
}
/*! Save the headerSent status. */
@@ -846,8 +846,8 @@ int Isapi::send (HttpThreadContext* td,
return td->http->raiseHTTPError (500);
}
- /* Store the environment string in the secondaryBuffer. */
- connTable[connIndex].envString=td->secondaryBuffer->getBuffer ();
+ /* Store the environment string in the auxiliaryBuffer. */
+ connTable[connIndex].envString=td->auxiliaryBuffer->getBuffer ();
/* Build the environment string. */
td->scriptPath.assign (scriptpath);
diff --git a/myserver/src/http_handler/mscgi/mscgi.cpp
b/myserver/src/http_handler/mscgi/mscgi.cpp
index d27cdde..5bfeb6f 100644
--- a/myserver/src/http_handler/mscgi/mscgi.cpp
+++ b/myserver/src/http_handler/mscgi/mscgi.cpp
@@ -118,7 +118,7 @@ int MsCgi::send (HttpThreadContext* td, const char* exec,
const char* cmdLine,
return td->http->raiseHTTPError (500);
}
- td->secondaryBuffer->getAt (0) = '\0';
+ td->auxiliaryBuffer->getAt (0) = '\0';
ProcMain = (CGIMAIN) hinstLib.getProc ( "myserver_main");
if (ProcMain)
@@ -193,7 +193,7 @@ int MsCgi::sendHeader (MsCgiData* mcd)
return 0;
if (HttpHeaders::sendHeader (td->response, *td->connection->socket,
- *td->secondaryBuffer, td))
+ *td->auxiliaryBuffer, td))
return 1;
mcd->headerSent = true;
diff --git a/myserver/src/http_handler/proxy/proxy.cpp
b/myserver/src/http_handler/proxy/proxy.cpp
index 846aaed..48a4816 100644
--- a/myserver/src/http_handler/proxy/proxy.cpp
+++ b/myserver/src/http_handler/proxy/proxy.cpp
@@ -92,14 +92,14 @@ int Proxy::send (HttpThreadContext *td,
return td->http->raiseHTTPError (500);
if (HttpHeaders::sendHeader (td->response, *td->connection->socket,
- *td->secondaryBuffer, td))
+ *td->auxiliaryBuffer, td))
{
chain.clearAllFilters ();
return HttpDataHandler::RET_FAILURE;
}
if (td->request.uriOptsPtr &&
- td->inputData.fastCopyToSocket (&sock, 0, td->secondaryBuffer, &nbw))
+ td->inputData.fastCopyToSocket (&sock, 0, td->auxiliaryBuffer, &nbw))
{
sock.close ();
return td->http->raiseHTTPError (500);
@@ -143,15 +143,15 @@ int Proxy::flushToClient (HttpThreadContext* td, Socket&
client,
do
{
- if (client.recv (td->secondaryBuffer->getBuffer () + read,
- td->secondaryBuffer->getRealLength () - read,
+ if (client.recv (td->auxiliaryBuffer->getBuffer () + read,
+ td->auxiliaryBuffer->getRealLength () - read,
0,
td->http->getTimeout () == 0))
return td->http->raiseHTTPError (500);
read += ret;
- if (HttpHeaders::buildHTTPResponseHeaderStruct
(td->secondaryBuffer->getBuffer (),
+ if (HttpHeaders::buildHTTPResponseHeaderStruct
(td->auxiliaryBuffer->getBuffer (),
&td->response,
&headerLength))
ret = HttpDataHandler::RET_FAILURE;
@@ -202,7 +202,7 @@ int Proxy::flushToClient (HttpThreadContext* td, Socket&
client,
&td->response,
&out,
&client,
- td->secondaryBuffer->getBuffer () + headerLength,
+ td->auxiliaryBuffer->getBuffer () + headerLength,
read - headerLength,
td->http->getTimeout (),
useChunks,
diff --git a/myserver/src/http_handler/scgi/scgi.cpp
b/myserver/src/http_handler/scgi/scgi.cpp
index 5fe64a4..0a14904 100644
--- a/myserver/src/http_handler/scgi/scgi.cpp
+++ b/myserver/src/http_handler/scgi/scgi.cpp
@@ -89,7 +89,7 @@ int Scgi::send (HttpThreadContext* td, const char* scriptpath,
}
td->buffer->setLength (0);
- td->secondaryBuffer->getAt (0) = '\0';
+ td->auxiliaryBuffer->getAt (0) = '\0';
{
/* Do not modify the text between " and ". */
@@ -168,7 +168,7 @@ int Scgi::send (HttpThreadContext* td, const char*
scriptpath,
Env::buildEnvironmentString (td, td->buffer->getBuffer ());
sizeEnvString = buildScgiEnvironmentString (td,td->buffer->getBuffer (),
- td->secondaryBuffer->getBuffer
());
+ td->auxiliaryBuffer->getBuffer
());
if (sizeEnvString == -1)
{
td->connection->host->warningsLogWrite (_("SCGI: internal error"));
@@ -194,7 +194,7 @@ int Scgi::send (HttpThreadContext* td, const char*
scriptpath,
chain.clearAllFilters ();
return td->http->raiseHTTPError (500);
}
- ret = sendNetString (&con, td->secondaryBuffer->getBuffer (), sizeEnvString);
+ ret = sendNetString (&con, td->auxiliaryBuffer->getBuffer (), sizeEnvString);
if (td->request.contentLength.size () &&
!td->request.contentLength.compare ("0"))
@@ -246,8 +246,8 @@ int Scgi::sendResponse (ScgiContext* ctx, int onlyHeader,
FiltersChain* chain)
if (!ctx->sock.bytesToRead ())
return HttpDataHandler::RET_FAILURE;
- nbr = ctx->sock.recv (td->secondaryBuffer->getBuffer () + read,
- td->secondaryBuffer->getRealLength () - read,
+ nbr = ctx->sock.recv (td->auxiliaryBuffer->getBuffer () + read,
+ td->auxiliaryBuffer->getRealLength () - read,
td->http->getTimeout ());
read += nbr;
@@ -255,10 +255,10 @@ int Scgi::sendResponse (ScgiContext* ctx, int onlyHeader,
FiltersChain* chain)
for (tmpHeaderSize = (tmpHeaderSize > 3)
? tmpHeaderSize - 4 : tmpHeaderSize;
tmpHeaderSize < read - 4; tmpHeaderSize++)
- if ((td->secondaryBuffer->getBuffer ()[tmpHeaderSize] == '\r')
- && (td->secondaryBuffer->getBuffer ()[tmpHeaderSize + 1] == '\n')
- && (td->secondaryBuffer->getBuffer ()[tmpHeaderSize + 2] == '\r')
- && (td->secondaryBuffer->getBuffer ()[tmpHeaderSize + 3] == '\n'))
+ if ((td->auxiliaryBuffer->getBuffer ()[tmpHeaderSize] == '\r')
+ && (td->auxiliaryBuffer->getBuffer ()[tmpHeaderSize + 1] == '\n')
+ && (td->auxiliaryBuffer->getBuffer ()[tmpHeaderSize + 2] == '\r')
+ && (td->auxiliaryBuffer->getBuffer ()[tmpHeaderSize + 3] == '\n'))
{
headerSize = tmpHeaderSize + 4;
break;
@@ -269,19 +269,19 @@ int Scgi::sendResponse (ScgiContext* ctx, int onlyHeader,
FiltersChain* chain)
}
if (headerSize)
- HttpHeaders::buildHTTPResponseHeaderStruct (td->secondaryBuffer->getBuffer
(),
+ HttpHeaders::buildHTTPResponseHeaderStruct (td->auxiliaryBuffer->getBuffer
(),
&td->response,
&(td->nBytesToRead));
if (HttpHeaders::sendHeader (td->response, *td->connection->socket,
- *td->secondaryBuffer, td))
+ *td->auxiliaryBuffer, td))
return HttpDataHandler::RET_FAILURE;
if (onlyHeader)
return HttpDataHandler::RET_OK;
if (read - headerSize)
- if (appendDataToHTTPChannel (td, td->secondaryBuffer->getBuffer () +
headerSize,
+ if (appendDataToHTTPChannel (td, td->auxiliaryBuffer->getBuffer () +
headerSize,
read - headerSize,
&(td->outputData),
chain,
@@ -295,14 +295,14 @@ int Scgi::sendResponse (ScgiContext* ctx, int onlyHeader,
FiltersChain* chain)
{
for (;;)
{
- nbr = ctx->sock.recv (td->secondaryBuffer->getBuffer (),
- td->secondaryBuffer->getRealLength (),
+ nbr = ctx->sock.recv (td->auxiliaryBuffer->getBuffer (),
+ td->auxiliaryBuffer->getRealLength (),
0);
if (!nbr || (nbr == (u_long)-1))
break;
- if (appendDataToHTTPChannel (td, td->secondaryBuffer->getBuffer (),
+ if (appendDataToHTTPChannel (td, td->auxiliaryBuffer->getBuffer (),
nbr,
&(td->outputData),
chain,
@@ -353,12 +353,12 @@ int Scgi::sendPostData (ScgiContext* ctx)
u_long nbr;
do
{
- if (ctx->td->inputData.read (ctx->td->secondaryBuffer->getBuffer (),
- ctx->td->secondaryBuffer->getRealLength (),
+ if (ctx->td->inputData.read (ctx->td->auxiliaryBuffer->getBuffer (),
+ ctx->td->auxiliaryBuffer->getRealLength (),
&nbr))
return -1;
- if (nbr && (ctx->sock.send (ctx->td->secondaryBuffer->getBuffer (), nbr,
0) == -1))
+ if (nbr && (ctx->sock.send (ctx->td->auxiliaryBuffer->getBuffer (), nbr,
0) == -1))
return -1;
}
while (nbr);
diff --git a/myserver/src/http_handler/wincgi/wincgi.cpp
b/myserver/src/http_handler/wincgi/wincgi.cpp
index cac7388..972add5 100644
--- a/myserver/src/http_handler/wincgi/wincgi.cpp
+++ b/myserver/src/http_handler/wincgi/wincgi.cpp
@@ -127,8 +127,8 @@ int WinCgi::send (HttpThreadContext* td, const char*
scriptpath,
return td->http->raiseHTTPError (500);
}
- td->secondaryBuffer->setLength (0);
- buffer = td->secondaryBuffer->getBuffer ();
+ td->auxiliaryBuffer->setLength (0);
+ buffer = td->auxiliaryBuffer->getBuffer ();
strcpy (buffer, "[CGI]\r\n");
DataFileHandle.writeToFile (buffer,7,&nbr);
@@ -136,10 +136,10 @@ int WinCgi::send (HttpThreadContext* td, const char*
scriptpath,
strcpy (buffer, "CGI Version=CGI/1.3a WIN\r\n");
DataFileHandle.writeToFile (buffer,26,&nbr);
- *td->secondaryBuffer << "Server Admin=" <<
+ *td->auxiliaryBuffer << "Server Admin=" <<
td->securityToken.getData ("server.admin", MYSERVER_VHOST_CONF |
MYSERVER_SERVER_CONF, "")<< "\r\n";
- DataFileHandle.writeToFile (buffer,td->secondaryBuffer->getLength (),&nbr);
+ DataFileHandle.writeToFile (buffer,td->auxiliaryBuffer->getLength (),&nbr);
{
if (td->request.isKeepAlive ())
@@ -154,17 +154,17 @@ int WinCgi::send (HttpThreadContext* td, const char*
scriptpath,
}
}
- td->secondaryBuffer->setLength (0);
- *td->secondaryBuffer << "Request Method=" << td->request.cmd << "\r\n";
- DataFileHandle.writeToFile (buffer, td->secondaryBuffer->getLength (), &nbr);
+ td->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << "Request Method=" << td->request.cmd << "\r\n";
+ DataFileHandle.writeToFile (buffer, td->auxiliaryBuffer->getLength (), &nbr);
- td->secondaryBuffer->setLength (0);
- *td->secondaryBuffer << "Request Protocol=HTTP/" << td->request.ver <<
"\r\n";
- DataFileHandle.writeToFile (buffer, td->secondaryBuffer->getLength (), &nbr);
+ td->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << "Request Protocol=HTTP/" << td->request.ver <<
"\r\n";
+ DataFileHandle.writeToFile (buffer, td->auxiliaryBuffer->getLength (), &nbr);
- td->secondaryBuffer->setLength (0);
- *td->secondaryBuffer << "Executable Path=" << execname << "\r\n";
- DataFileHandle.writeToFile (buffer,td->secondaryBuffer->getLength (),&nbr);
+ td->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << "Executable Path=" << execname << "\r\n";
+ DataFileHandle.writeToFile (buffer,td->auxiliaryBuffer->getLength (),&nbr);
if (td->request.uriOpts[0])
{
@@ -302,7 +302,7 @@ int WinCgi::send (HttpThreadContext* td, const char*
scriptpath,
chain.clearAllFilters ();
return td->http->raiseHTTPError (500);
}
- OutFileHandle.read (buffer,td->secondaryBuffer->getRealLength
(),&nBytesRead);
+ OutFileHandle.read (buffer,td->auxiliaryBuffer->getRealLength
(),&nBytesRead);
if (!nBytesRead)
{
ostringstream msg;
@@ -388,7 +388,7 @@ int WinCgi::send (HttpThreadContext* td, const char*
scriptpath,
/* Flush the rest of the file. */
do
{
- OutFileHandle.read (buffer, td->secondaryBuffer->getLength (),
+ OutFileHandle.read (buffer, td->auxiliaryBuffer->getLength (),
&nBytesRead);
if (nBytesRead)
{
diff --git a/myserver/src/protocol/ftp/ftp.cpp
b/myserver/src/protocol/ftp/ftp.cpp
index 99ac809..a4572eb 100644
--- a/myserver/src/protocol/ftp/ftp.cpp
+++ b/myserver/src/protocol/ftp/ftp.cpp
@@ -186,7 +186,7 @@ FtpThreadContext::FtpThreadContext ()
{
pConnection = NULL;
buffer = NULL;
- secondaryBuffer = NULL;
+ auxiliaryBuffer = NULL;
buffersize = 0;
m_nParseLength = 0;
pProtocolInterpreter = NULL;
@@ -348,7 +348,7 @@ int Ftp::controlConnection (ConnectionPtr pConnection, char
*request,
td.pConnection = pConnection;
td.buffer = pConnection->getActiveThread ()->getBuffer ();
- td.secondaryBuffer = pConnection->getActiveThread ()->getSecondaryBuffer ();
+ td.auxiliaryBuffer = pConnection->getActiveThread ()->getSecondaryBuffer ();
td.buffersize = pConnection->getActiveThread ()->getBufferSize ();
td.nBytesToRead = reqLen;
td.pProtocolInterpreter = this;
@@ -418,13 +418,13 @@ void Ftp::logAccess (int nReplyCode, const std::string &
sCustomText)
sprintf (msgCode, "%i", nReplyCode);
getLocalLogFormatDate (time, 32);
- td.secondaryBuffer->setLength (0);
- *td.secondaryBuffer << time
+ td.auxiliaryBuffer->setLength (0);
+ *td.auxiliaryBuffer << time
<< " " << td.pConnection->getIpAddr ()
<< " " << msgCode << " " << sCustomText << end_str;
if (td.pConnection->host)
- td.pConnection->host->accessesLogWrite ("%s",
td.secondaryBuffer->getBuffer ());
+ td.pConnection->host->accessesLogWrite ("%s",
td.auxiliaryBuffer->getBuffer ());
}
int Ftp::closeDataConnection ()
@@ -742,7 +742,7 @@ DEFINE_THREAD (SendAsciiFile, pParam)
char *pLine = NULL;
int nLineLength = 0;
std::string sLine;
- MemBuf buffer, secondaryBuffer;
+ MemBuf buffer, auxiliaryBuffer;
buffer.setRealLength (1024);
while (filesize != 0)
{
@@ -767,7 +767,7 @@ DEFINE_THREAD (SendAsciiFile, pParam)
filesize -= nbr;
pFtpuserData->m_nBytesSent += nbr;
- secondaryBuffer.setLength (0);
+ auxiliaryBuffer.setLength (0);
pLine = buffer.getBuffer ();
if (pLine == NULL)
{
@@ -790,13 +790,13 @@ DEFINE_THREAD (SendAsciiFile, pParam)
{
sLine.assign (pLine, strlen (pLine));
if (!sLine.empty ())
- secondaryBuffer << sLine;
+ auxiliaryBuffer << sLine;
pLine += strlen (pLine);
}
else
{
sLine.assign (pLine, nLineLength);
- secondaryBuffer << sLine << "\r\n";
+ auxiliaryBuffer << sLine << "\r\n";
if (*(pLine + nLineLength) == '\r')
nLineLength++;
if (*(pLine + nLineLength) == '\n')
@@ -805,8 +805,8 @@ DEFINE_THREAD (SendAsciiFile, pParam)
}
}
if (pFtpuserData->m_pDataConnection->socket->
- send (secondaryBuffer.getBuffer (),
- (u_long) secondaryBuffer.getLength (), 0) == SOCKET_ERROR)
+ send (auxiliaryBuffer.getBuffer (),
+ (u_long) auxiliaryBuffer.getLength (), 0) == SOCKET_ERROR)
{
ftpReply (pConnection, 451);
file->close ();
@@ -978,17 +978,17 @@ DEFINE_THREAD (SendImageFile, pParam)
pFtpuserData->m_sCurrentFileName = pWt->m_sFilePath;
pFtpuserData->m_nFileSize = filesize;
- MemBuf secondaryBuffer;
- secondaryBuffer.setRealLength (1024);
+ MemBuf auxiliaryBuffer;
+ auxiliaryBuffer.setRealLength (1024);
while (filesize != 0)
{
nBufferSize =
std::min (static_cast < u_long > (filesize),
static_cast < u_long >
- (secondaryBuffer.getRealLength () / 2));
+ (auxiliaryBuffer.getRealLength () / 2));
- if (file->read (secondaryBuffer.getBuffer (), nBufferSize, &nbr)
- || pFtpuserData->m_pDataConnection->socket->send
(secondaryBuffer.getBuffer (),
+ if (file->read (auxiliaryBuffer.getBuffer (), nBufferSize, &nbr)
+ || pFtpuserData->m_pDataConnection->socket->send
(auxiliaryBuffer.getBuffer (),
(u_long)nBufferSize, 0)
== SOCKET_ERROR)
{
@@ -1155,7 +1155,7 @@ DEFINE_THREAD (ReceiveAsciiFile, pParam)
#endif
}
- MemBuf buffer, secondaryBuffer;
+ MemBuf buffer, auxiliaryBuffer;
buffer.setRealLength (1024);
memset (buffer.getBuffer (), 0, buffer.getRealLength ());
char *pLine = NULL;
@@ -1166,9 +1166,9 @@ DEFINE_THREAD (ReceiveAsciiFile, pParam)
(u_long)
buffer.getRealLength () - 1, &nbr)
!= SOCKET_ERROR && nbr != 0)
{
- memset (secondaryBuffer.getBuffer (), 0,
- secondaryBuffer.getRealLength ());
- secondaryBuffer.setLength (0);
+ memset (auxiliaryBuffer.getBuffer (), 0,
+ auxiliaryBuffer.getRealLength ());
+ auxiliaryBuffer.setLength (0);
pLine = buffer.getBuffer ();
if (pLine == NULL)
{
@@ -1190,16 +1190,16 @@ DEFINE_THREAD (ReceiveAsciiFile, pParam)
{
sLine.assign (pLine, strlen (pLine));
if (!sLine.empty ())
- secondaryBuffer << sLine;
+ auxiliaryBuffer << sLine;
pLine += strlen (pLine);
}
else
{
sLine.assign (pLine, nLineLength);
#ifdef WIN32
- secondaryBuffer << sLine << "\r\n";
+ auxiliaryBuffer << sLine << "\r\n";
#else
- secondaryBuffer << sLine << "\n";
+ auxiliaryBuffer << sLine << "\n";
#endif
if (*(pLine + nLineLength) == '\r')
nLineLength++;
@@ -1208,8 +1208,8 @@ DEFINE_THREAD (ReceiveAsciiFile, pParam)
pLine += nLineLength;
}
}
- file.write (secondaryBuffer.getBuffer (),
- (u_long) secondaryBuffer.getLength (), &nbr);
+ file.write (auxiliaryBuffer.getBuffer (),
+ (u_long) auxiliaryBuffer.getLength (), &nbr);
if (pFtpuserData->m_bBreakDataConnection)
{
@@ -1695,8 +1695,8 @@ Ftp::list (const std::string & sParam /*= ""*/ )
time_t now;
time (&now);
- MemBuf & secondaryBuffer = *td.secondaryBuffer;
- secondaryBuffer.setLength (0);
+ MemBuf & auxiliaryBuffer = *td.auxiliaryBuffer;
+ auxiliaryBuffer.setLength (0);
char perm[11];
if (FilesUtility::isDirectory (sPath))
@@ -1782,7 +1782,7 @@ Ftp::list (const std::string & sParam /*= ""*/ )
char fdSizeStr[12];
sprintf (fdSizeStr, "%li", fd.size);
- secondaryBuffer << (const char *) perm << " " << nlinkStr << " "
+ auxiliaryBuffer << (const char *) perm << " " << nlinkStr << " "
<< username << " " << username << " " << fdSizeStr
<< " " << (const char *) dateFtpFormat << " "
<< fd.name << "\r\n";
@@ -1873,7 +1873,7 @@ Ftp::list (const std::string & sParam /*= ""*/ )
char fdSizeStr[12];
sprintf (fdSizeStr, "%li", fd.size);
- secondaryBuffer << (const char *) perm << " " << nlinkStr << " "
+ auxiliaryBuffer << (const char *) perm << " " << nlinkStr << " "
<< username << " " << username << " " << fdSizeStr
<< " " << (const char *) dateFtpFormat << " "
<< fd.name << "\r\n";
@@ -1883,8 +1883,8 @@ Ftp::list (const std::string & sParam /*= ""*/ )
}
if (pFtpuserData->m_pDataConnection->socket->
- send (td.secondaryBuffer->getBuffer (),
- (u_long) td.secondaryBuffer->getLength (), 0) == SOCKET_ERROR)
+ send (td.auxiliaryBuffer->getBuffer (),
+ (u_long) td.auxiliaryBuffer->getLength (), 0) == SOCKET_ERROR)
{
ftpReply (451);
}
@@ -1934,8 +1934,8 @@ Ftp::nlst (const std::string & sParam /* = "" */ )
return;
}
- MemBuf & secondaryBuffer = *td.secondaryBuffer;
- secondaryBuffer.setLength (0);
+ MemBuf & auxiliaryBuffer = *td.auxiliaryBuffer;
+ auxiliaryBuffer.setLength (0);
const char *secName = td.st.getData ("security.filename",
MYSERVER_VHOST_CONF |
@@ -1947,15 +1947,15 @@ Ftp::nlst (const std::string & sParam /* = "" */ )
continue;
if (!sParam.empty ())
- secondaryBuffer << sParam << "/";
- secondaryBuffer << fd.name << "\r\n";
+ auxiliaryBuffer << sParam << "/";
+ auxiliaryBuffer << fd.name << "\r\n";
}
while (!fd.findnext ());
fd.findclose ();
if (pFtpuserData->m_pDataConnection->socket->
- send (td.secondaryBuffer->getBuffer (),
- (u_long) td.secondaryBuffer->getLength (), 0) == SOCKET_ERROR)
+ send (td.auxiliaryBuffer->getBuffer (),
+ (u_long) td.auxiliaryBuffer->getLength (), 0) == SOCKET_ERROR)
{
ftpReply (451);
}
diff --git a/myserver/src/protocol/http/env/env.cpp
b/myserver/src/protocol/http/env/env.cpp
index dc15dc1..c5c155f 100644
--- a/myserver/src/protocol/http/env/env.cpp
+++ b/myserver/src/protocol/http/env/env.cpp
@@ -53,7 +53,7 @@ void Env::buildEnvironmentString (HttpThreadContext* td, char
*cgiEnv,
char strTmp[32];
HttpRequestHeader::Entry* reqEntry = NULL;
- memCgi.setExternalBuffer (cgiEnv, td->secondaryBuffer->getRealLength ());
+ memCgi.setExternalBuffer (cgiEnv, td->auxiliaryBuffer->getRealLength ());
memCgi << "SERVER_SOFTWARE=GNU MyServer " << MYSERVER_VERSION;
#ifdef WIN32
diff --git a/myserver/src/protocol/http/http.cpp
b/myserver/src/protocol/http/http.cpp
index cf0423c..d704f8a 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -132,18 +132,18 @@ int Http::optionsHTTPRESOURCE (string& filename, int
yetmapped)
return raiseHTTPError (ret);
getRFC822GMTTime (time, 32);
- td->secondaryBuffer->setLength (0);
- *td->secondaryBuffer << "HTTP/1.1 200 OK\r\n";
- *td->secondaryBuffer << "Date: " << time;
- *td->secondaryBuffer << "\r\nServer: GNU MyServer " << MYSERVER_VERSION;
+ td->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << "HTTP/1.1 200 OK\r\n";
+ *td->auxiliaryBuffer << "Date: " << time;
+ *td->auxiliaryBuffer << "\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 << "Allow: " << methods << "\r\n\r\n";
+ *td->auxiliaryBuffer << "\r\nConnection:" << connection->value->c_str
() << "\r\n";
+ *td->auxiliaryBuffer << "Content-length: 0\r\nAccept-Ranges: bytes\r\n";
+ *td->auxiliaryBuffer << "Allow: " << methods << "\r\n\r\n";
/* Send the HTTP header. */
- ret = td->connection->socket->send (td->secondaryBuffer->getBuffer (),
- td->secondaryBuffer->getLength (),
0);
+ ret = td->connection->socket->send (td->auxiliaryBuffer->getBuffer (),
+ td->auxiliaryBuffer->getLength (),
0);
if (ret == SOCKET_ERROR)
{
td->connection->host->warningsLogWrite (_("HTTP: socket error"));
@@ -180,21 +180,21 @@ int Http::traceHTTPRESOURCE (string& filename, int
yetmapped)
tmp.intToStr (contentLength, tmpStr, 12);
getRFC822GMTTime (time, 32);
- td->secondaryBuffer->setLength (0);
- *td->secondaryBuffer << "HTTP/1.1 200 OK\r\n";
- *td->secondaryBuffer << "Date: " << time << "\r\n";
- *td->secondaryBuffer << "Server: GNU MyServer " << MYSERVER_VERSION <<
"\r\n";
+ td->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << "HTTP/1.1 200 OK\r\n";
+ *td->auxiliaryBuffer << "Date: " << time << "\r\n";
+ *td->auxiliaryBuffer << "Server: GNU MyServer " << MYSERVER_VERSION <<
"\r\n";
connection = td->request.other.get ("Connection");
if (connection && connection->value->length ())
- *td->secondaryBuffer << "Connection:" << connection->value->c_str ()
<< "\r\n";
+ *td->auxiliaryBuffer << "Connection:" << connection->value->c_str ()
<< "\r\n";
- *td->secondaryBuffer << "Content-length:" << tmp << "\r\n"
+ *td->auxiliaryBuffer << "Content-length:" << tmp << "\r\n"
<< "Content-type: message/http\r\n"
<< "Accept-Ranges: bytes\r\n\r\n";
/* Send our HTTP header. */
- ret = td->connection->socket->send (td->secondaryBuffer->getBuffer (),
- (u_long)
td->secondaryBuffer->getLength (), 0);
+ ret = td->connection->socket->send (td->auxiliaryBuffer->getBuffer (),
+ (u_long)
td->auxiliaryBuffer->getLength (), 0);
if (ret == SOCKET_ERROR)
{
td->connection->host->warningsLogWrite (_("HTTP: socket error"));
@@ -569,13 +569,13 @@ u_long Http::checkDigest ()
((HttpUserData*) td->connection->protocolBuffer)->nc++;
md5.init ();
- td->secondaryBuffer->setLength (0);
- *td->secondaryBuffer << td->request.digestUsername << ":"
+ td->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << td->request.digestUsername << ":"
<< td->request.digestRealm
<< ":" << td->securityToken.getNeededPassword ();
- md5.update ((char const*) td->secondaryBuffer->getBuffer (),
- (unsigned int) td->secondaryBuffer->getLength ());
+ md5.update ((char const*) td->auxiliaryBuffer->getBuffer (),
+ (unsigned int) td->auxiliaryBuffer->getLength ());
md5.end (A1);
md5.init ();
@@ -585,20 +585,20 @@ u_long Http::checkDigest ()
else
uri = (char*) td->request.uriOpts.c_str ();
- td->secondaryBuffer->setLength (0);
- *td->secondaryBuffer << td->request.cmd.c_str () << ":" << uri;
- md5.update ((char const*) td->secondaryBuffer->getBuffer (),
- (unsigned int) td->secondaryBuffer->getLength ());
+ td->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << td->request.cmd.c_str () << ":" << uri;
+ md5.update ((char const*) td->auxiliaryBuffer->getBuffer (),
+ (unsigned int) td->auxiliaryBuffer->getLength ());
md5.end (A2);
md5.init ();
- td->secondaryBuffer->setLength (0);
- *td->secondaryBuffer << A1 << ":"
+ td->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << A1 << ":"
<< ((HttpUserData*) td->connection->protocolBuffer)->nonce << ":"
<< td->request.digestNc << ":" << td->request.digestCnonce << ":"
<< td->request.digestQop << ":" << A2;
- md5.update ((char const*) td->secondaryBuffer->getBuffer (),
- (unsigned int) td->secondaryBuffer->getLength ());
+ md5.update ((char const*) td->auxiliaryBuffer->getBuffer (),
+ (unsigned int) td->auxiliaryBuffer->getLength ());
md5.end (response);
return strcmp (response, td->request.digestResponse) ? 0 : 1;
@@ -715,50 +715,50 @@ int Http::logHTTPaccess ()
try
{
- td->secondaryBuffer->setLength (0);
- *td->secondaryBuffer << td->connection->getIpAddr ();
- *td->secondaryBuffer << " ";
+ td->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << td->connection->getIpAddr ();
+ *td->auxiliaryBuffer << " ";
if (td->connection->getLogin ()[0])
- *td->secondaryBuffer << td->connection->getLogin ();
+ *td->auxiliaryBuffer << td->connection->getLogin ();
else
- *td->secondaryBuffer << "-";
+ *td->auxiliaryBuffer << "-";
- *td->secondaryBuffer << " ";
+ *td->auxiliaryBuffer << " ";
if (td->connection->getLogin ()[0])
- *td->secondaryBuffer << td->connection->getLogin ();
+ *td->auxiliaryBuffer << td->connection->getLogin ();
else
- *td->secondaryBuffer << "-";
+ *td->auxiliaryBuffer << "-";
- *td->secondaryBuffer << " [";
+ *td->auxiliaryBuffer << " [";
getLocalLogFormatDate (time, 32);
- *td->secondaryBuffer << time << "] \"";
+ *td->auxiliaryBuffer << time << "] \"";
if (td->request.cmd.length ())
- *td->secondaryBuffer << td->request.cmd.c_str () << "";
+ *td->auxiliaryBuffer << td->request.cmd.c_str () << "";
if (td->request.cmd.length () || td->request.uri.length ())
- *td->secondaryBuffer << " ";
+ *td->auxiliaryBuffer << " ";
if (td->request.uri.length () == '\0')
- *td->secondaryBuffer << "/";
+ *td->auxiliaryBuffer << "/";
else
- *td->secondaryBuffer << td->request.uri.c_str ();
+ *td->auxiliaryBuffer << td->request.uri.c_str ();
if (td->request.uriOpts.length ())
- *td->secondaryBuffer << "?" << td->request.uriOpts.c_str ();
+ *td->auxiliaryBuffer << "?" << td->request.uriOpts.c_str ();
sprintf (tmpStrInt, "%u ", td->response.httpStatus);
if (td->request.ver.length ())
- *td->secondaryBuffer << " " << td->request.ver.c_str ();
+ *td->auxiliaryBuffer << " " << td->request.ver.c_str ();
- *td->secondaryBuffer << "\" " << tmpStrInt << " ";
+ *td->auxiliaryBuffer << "\" " << tmpStrInt << " ";
sprintf (tmpStrInt, "%u", td->sentData);
- *td->secondaryBuffer << tmpStrInt;
+ *td->auxiliaryBuffer << tmpStrInt;
if (td->connection->host)
{
@@ -766,19 +766,19 @@ int Http::logHTTPaccess ()
HttpRequestHeader::Entry *referer = td->request.other.get ("Refer");
if (strstr ((td->connection->host)->getAccessLogOpt (),
"type=combined"))
- *td->secondaryBuffer << " " << (referer ? referer->value->c_str ()
: "")
+ *td->auxiliaryBuffer << " " << (referer ? referer->value->c_str ()
: "")
<< " " << (userAgent ? userAgent->value->c_str () : "");
}
- *td->secondaryBuffer << end_str;
+ *td->auxiliaryBuffer << end_str;
/*
* Request the access to the log file then append the message.
*/
if (td->connection->host)
- td->connection->host->accessesLogWrite ("%s",
td->secondaryBuffer->getBuffer ());
+ td->connection->host->accessesLogWrite ("%s",
td->auxiliaryBuffer->getBuffer ());
- td->secondaryBuffer->setLength (0);
+ td->auxiliaryBuffer->setLength (0);
}
catch (...)
{
@@ -803,7 +803,7 @@ int Http::controlConnection (ConnectionPtr a, char*, char*,
u_long, u_long,
try
{
td->buffer = a->getActiveThread ()->getBuffer ();
- td->secondaryBuffer = a->getActiveThread ()->getSecondaryBuffer ();
+ td->auxiliaryBuffer = a->getActiveThread ()->getSecondaryBuffer ();
td->buffersize = a->getActiveThread ()->getBufferSize ();
td->nBytesToRead = nbtr;
td->connection = a;
@@ -1227,18 +1227,18 @@ int Http::requestAuthorization ()
HttpRequestHeader::Entry *connection = td->request.other.get ("Connection");
HttpRequestHeader::Entry *host = td->request.other.get ("Host");
td->response.httpStatus = 401;
- td->secondaryBuffer->setLength (0);
- *td->secondaryBuffer << "HTTP/1.1 401 Unauthorized\r\n"
+ td->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << "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->auxiliaryBuffer << "Server: GNU MyServer " << MYSERVER_VERSION <<
"\r\n";
+ *td->auxiliaryBuffer << "Content-type: text/html\r\n"
<< "Connection: ";
- *td->secondaryBuffer << (connection ? connection->value->c_str () : "");
- *td->secondaryBuffer << "\r\nContent-length: 0\r\n";
+ *td->auxiliaryBuffer << (connection ? connection->value->c_str () : "");
+ *td->auxiliaryBuffer << "\r\nContent-length: 0\r\n";
if (td->authScheme == HTTP_AUTH_SCHEME_BASIC)
{
- *td->secondaryBuffer << "WWW-Authenticate: Basic realm=\""
+ *td->auxiliaryBuffer << "WWW-Authenticate: Basic realm=\""
<< (host ? host->value->c_str () : "")
<< "\"\r\n";
}
@@ -1277,15 +1277,15 @@ int Http::requestAuthorization ()
hud->nc = 0;
}
- *td->secondaryBuffer << "WWW-Authenticate: digest "
+ *td->auxiliaryBuffer << "WWW-Authenticate: digest "
<< " qop=\"auth\", algorithm =\"MD5\", realm =\""
<< hud->realm << "\", opaque =\"" << hud->opaque
<< "\", nonce =\"" << hud->nonce << "\" ";
if (hud->cnonce[0])
- *td->secondaryBuffer << ", cnonce =\"" << hud->cnonce << "\" ";
+ *td->auxiliaryBuffer << ", cnonce =\"" << hud->cnonce << "\" ";
- *td->secondaryBuffer << "\r\n";
+ *td->auxiliaryBuffer << "\r\n";
}
else
{
@@ -1293,12 +1293,12 @@ int Http::requestAuthorization ()
return raiseHTTPError (501);
}
- *td->secondaryBuffer << "Date: ";
+ *td->auxiliaryBuffer << "Date: ";
getRFC822GMTTime (time, 32);
- *td->secondaryBuffer << time << "\r\n\r\n";
+ *td->auxiliaryBuffer << time << "\r\n\r\n";
- if (td->connection->socket->send (td->secondaryBuffer->getBuffer (),
- td->secondaryBuffer->getLength (), 0) < 0)
+ if (td->connection->socket->send (td->auxiliaryBuffer->getBuffer (),
+ td->auxiliaryBuffer->getLength (), 0) < 0)
{
td->connection->host->warningsLogWrite (_("HTTP: socket error"));
return HttpDataHandler::RET_FAILURE;
@@ -1484,20 +1484,20 @@ Internal Server Error\n\
*td->buffer << " from: ";
*td->buffer << td->connection->getIpAddr ();
*td->buffer << "\r\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->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << "HTTP/1.1 500 System Error\r\n";
+ *td->auxiliaryBuffer << "Server: GNU MyServer " << MYSERVER_VERSION <<
"\r\n";
+ *td->auxiliaryBuffer << " Content-type: text/html\r\nContent-length: ";
tmp.intToStr ((int) strlen (hardHTML), tmpStr, 12);
- *td->secondaryBuffer << tmp;
- *td->secondaryBuffer << "\r\n";
- *td->secondaryBuffer << "Date: ";
+ *td->auxiliaryBuffer << tmp;
+ *td->auxiliaryBuffer << "\r\n";
+ *td->auxiliaryBuffer << "Date: ";
getRFC822GMTTime (time, 32);
- *td->secondaryBuffer << time;
- *td->secondaryBuffer << "\r\n\r\n";
+ *td->auxiliaryBuffer << time;
+ *td->auxiliaryBuffer << "\r\n\r\n";
- if (td->connection->socket->send (td->secondaryBuffer->getBuffer (),
- (u_long) td->secondaryBuffer->getLength (),
+ if (td->connection->socket->send (td->auxiliaryBuffer->getBuffer (),
+ (u_long) td->auxiliaryBuffer->getLength (),
0) < 0)
return HttpDataHandler::RET_FAILURE;
@@ -1666,24 +1666,24 @@ int Http::sendHTTPRedirect (const char *newURL)
HttpRequestHeader::Entry *connection = td->request.other.get ("Connection");
td->response.httpStatus = 302;
- td->secondaryBuffer->setLength (0);
- *td->secondaryBuffer << "HTTP/1.1 302 Moved\r\nAccept-Ranges: bytes\r\n"
+ td->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << "HTTP/1.1 302 Moved\r\nAccept-Ranges: bytes\r\n"
<< "Server: GNU MyServer " << MYSERVER_VERSION << "\r\n"
<< "Content-type: text/html\r\n"
<< "Location: " << newURL << "\r\n"
<< "Content-length: 0\r\n";
if (connection && !stringcmpi (connection->value->c_str (), "keep-alive"))
- *td->secondaryBuffer << "Connection: keep-alive\r\n";
+ *td->auxiliaryBuffer << "Connection: keep-alive\r\n";
else
- *td->secondaryBuffer << "Connection: close\r\n";
+ *td->auxiliaryBuffer << "Connection: close\r\n";
- *td->secondaryBuffer << "Date: ";
+ *td->auxiliaryBuffer << "Date: ";
getRFC822GMTTime (time, 32);
- *td->secondaryBuffer << time
+ *td->auxiliaryBuffer << time
<< "\r\n\r\n";
- if (td->connection->socket->send (td->secondaryBuffer->getBuffer (),
- (int) td->secondaryBuffer->getLength (),
0) < 0)
+ if (td->connection->socket->send (td->auxiliaryBuffer->getBuffer (),
+ (int) td->auxiliaryBuffer->getLength (),
0) < 0)
{
td->connection->host->warningsLogWrite (_("HTTP: socket error"));
return HttpDataHandler::RET_FAILURE;
@@ -1701,21 +1701,21 @@ int Http::sendHTTPNonModified ()
HttpRequestHeader::Entry *connection = td->request.other.get ("Connection");
td->response.httpStatus = 304;
- td->secondaryBuffer->setLength (0);
- *td->secondaryBuffer << "HTTP/1.1 304 Not Modified\r\nAccept-Ranges:
bytes\r\n"
+ td->auxiliaryBuffer->setLength (0);
+ *td->auxiliaryBuffer << "HTTP/1.1 304 Not Modified\r\nAccept-Ranges:
bytes\r\n"
<< "Server: GNU MyServer " << MYSERVER_VERSION << "\r\n";
if (connection && !stringcmpi (connection->value->c_str (), "keep-alive"))
- *td->secondaryBuffer << "Connection: keep-alive\r\n";
+ *td->auxiliaryBuffer << "Connection: keep-alive\r\n";
else
- *td->secondaryBuffer << "Connection: close\r\n";
+ *td->auxiliaryBuffer << "Connection: close\r\n";
getRFC822GMTTime (time, 32);
- *td->secondaryBuffer << "Date: " << time << "\r\n\r\n";
+ *td->auxiliaryBuffer << "Date: " << time << "\r\n\r\n";
- if (td->connection->socket->send (td->secondaryBuffer->getBuffer (),
- (int) td->secondaryBuffer->getLength (),
0) < 0)
+ if (td->connection->socket->send (td->auxiliaryBuffer->getBuffer (),
+ (int) td->auxiliaryBuffer->getLength (),
0) < 0)
{
td->connection->host->warningsLogWrite (_("HTTP: socket error"));
return HttpDataHandler::RET_FAILURE;
diff --git a/myserver/src/protocol/http/http_data_read.cpp
b/myserver/src/protocol/http/http_data_read.cpp
index ad406c0..be8a52f 100644
--- a/myserver/src/protocol/http/http_data_read.cpp
+++ b/myserver/src/protocol/http/http_data_read.cpp
@@ -320,8 +320,8 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int*
httpRetCode)
&inPos,
bufferDataSize,
td->connection->socket,
- td->secondaryBuffer->getBuffer (),
- td->secondaryBuffer->getRealLength () - 1,
+ td->auxiliaryBuffer->getBuffer (),
+ td->auxiliaryBuffer->getRealLength () - 1,
&nbr,
timeout,
&(td->inputData),
@@ -360,14 +360,14 @@ int HttpDataRead::readPostData (HttpThreadContext* td,
int* httpRetCode)
{
/* Do not try to read more than what we expect. */
- u_long dimBuffer = std::min (td->secondaryBuffer->getRealLength () -
1ul,
+ u_long dimBuffer = std::min (td->auxiliaryBuffer->getRealLength () -
1ul,
length);
if (readContiguousPrimitivePostData (td->request.uriOptsPtr,
&inPos,
bufferDataSize,
td->connection->socket,
- td->secondaryBuffer->getBuffer
(),
+ td->auxiliaryBuffer->getBuffer
(),
dimBuffer,
&nbr,
timeout))
@@ -388,9 +388,9 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int*
httpRetCode)
return 1;
}
- td->secondaryBuffer->getBuffer ()[nbr] = '\0';
+ td->auxiliaryBuffer->getBuffer ()[nbr] = '\0';
- if (nbr && td->inputData.writeToFile (td->secondaryBuffer->getBuffer
(),
+ if (nbr && td->inputData.writeToFile (td->auxiliaryBuffer->getBuffer
(),
nbr, &nbw))
{
td->inputDataPath.assign ("");
diff --git a/myserver/src/protocol/http/http_headers.cpp
b/myserver/src/protocol/http/http_headers.cpp
index c1031b6..3b13868 100644
--- a/myserver/src/protocol/http/http_headers.cpp
+++ b/myserver/src/protocol/http/http_headers.cpp
@@ -78,9 +78,10 @@ u_long HttpHeaders::buildHTTPResponseHeader (char *str,
if (!e || (e && e->value->find ("chunked", 0) == string::npos ))
{
- 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));
+ 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));
}
}
@@ -89,15 +90,16 @@ u_long HttpHeaders::buildHTTPResponseHeader (char *str,
for (; it != response->other.end (); it++)
{
HttpResponseHeader::Entry *e = *it;
- pos += myserver_strlcpy (pos, e->name->c_str (), MAX-(long)(pos-str));
- pos += myserver_strlcpy (pos, ": ", MAX-(long)(pos-str));
- pos += myserver_strlcpy (pos, e->value->c_str (), MAX-(long)(pos-str));
- pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
+ pos += myserver_strlcpy (pos, e->name->c_str (), MAX - (long)(pos -
str));
+ pos += myserver_strlcpy (pos, ": ", MAX - (long)(pos - str));
+ pos += myserver_strlcpy (pos, e->value->c_str (), MAX - (long)(pos -
str));
+ pos += myserver_strlcpy (pos, "\r\n", MAX - (long)(pos - str));
}
- pos += myserver_strlcpy (pos, "Accept-Ranges: bytes\r\n",
MAX-(long)(pos-str));
+ pos += myserver_strlcpy (pos, "Accept-Ranges: bytes\r\n",
+ MAX - (long)(pos - str));
- pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
+ pos += myserver_strlcpy (pos, "\r\n", MAX - (long)(pos - str));
return (pos - str);
}
@@ -109,60 +111,65 @@ u_long HttpHeaders::buildHTTPResponseHeader (char *str,
*
* \return The number of bytes written to STR.
*/
-u_long HttpHeaders::buildHTTPRequestHeader (char * str,HttpRequestHeader*
request)
+u_long HttpHeaders::buildHTTPRequestHeader (char * str,
+ HttpRequestHeader* request)
{
char *pos = str;
const int MAX = MYSERVER_KB (8);
/* First line. */
- pos += myserver_strlcpy (pos, request->cmd.c_str (), MAX-(long)(pos-str));
- pos += myserver_strlcpy (pos, " ", MAX-(long)(pos-str));
- pos += myserver_strlcpy (pos, request->uri.c_str (), MAX-(long)(pos-str));
- pos += myserver_strlcpy (pos, " ", MAX-(long)(pos-str));
+ pos += myserver_strlcpy (pos, request->cmd.c_str (), MAX - (long)(pos -
str));
+ pos += myserver_strlcpy (pos, " ", MAX - (long)(pos - str));
+ pos += myserver_strlcpy (pos, request->uri.c_str (), MAX - (long)(pos -
str));
+ pos += myserver_strlcpy (pos, " ", MAX - (long)(pos - str));
if (request->uriOpts.length () > 0)
{
- pos += myserver_strlcpy (pos, "?", MAX-(long)(pos-str));
- pos += myserver_strlcpy (pos, request->uriOpts.c_str (),
MAX-(long)(pos-str));
- pos += myserver_strlcpy (pos, " ", MAX-(long)(pos-str));
+ pos += myserver_strlcpy (pos, "?", MAX - (long)(pos - str));
+ pos += myserver_strlcpy (pos, request->uriOpts.c_str (),
+ MAX - (long)(pos - str));
+ pos += myserver_strlcpy (pos, " ", MAX - (long)(pos - str));
}
- pos += myserver_strlcpy (pos, request->ver.c_str (), MAX-(long)(pos-str));
- pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
+ pos += myserver_strlcpy (pos, request->ver.c_str (), MAX - (long)(pos -
str));
+ pos += myserver_strlcpy (pos, "\r\n", MAX - (long)(pos - str));
if (request->auth.length () > 0)
{
- pos += myserver_strlcpy (pos, "Authorization: ", MAX-(long)(pos-str));
- pos += myserver_strlcpy (pos, request->auth.c_str (),
MAX-(long)(pos-str));
- pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
+ pos += myserver_strlcpy (pos, "Authorization: ", MAX - (long)(pos -
str));
+ pos += myserver_strlcpy (pos, request->auth.c_str (),
+ MAX - (long)(pos - str));
+ pos += myserver_strlcpy (pos, "\r\n", MAX - (long)(pos - str));
}
if (request->contentLength.length () > 0)
{
- 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));
+ 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));
}
if (request->rangeType.length () > 0)
{
char buffer[12];
- pos += myserver_strlcpy (pos, "Range: ", MAX-(long)(pos-str));
- pos += myserver_strlcpy (pos, request->rangeType.c_str (),
MAX-(long)(pos-str));
- pos += myserver_strlcpy (pos, " ", MAX-(long)(pos-str));
+ pos += myserver_strlcpy (pos, "Range: ", MAX - (long)(pos - str));
+ pos += myserver_strlcpy (pos, request->rangeType.c_str (),
+ MAX - (long)(pos - str));
+ pos += myserver_strlcpy (pos, " ", MAX - (long)(pos - str));
if (request->rangeByteBegin != (u_long)-1)
{
sprintf (buffer, "%lu", request->rangeByteBegin);
- pos += myserver_strlcpy (pos, buffer, MAX-(long)(pos-str));
+ pos += myserver_strlcpy (pos, buffer, MAX - (long)(pos - str));
}
- pos += myserver_strlcpy (pos, "-", MAX-(long)(pos-str));
+ pos += myserver_strlcpy (pos, "-", MAX - (long)(pos - str));
if (request->rangeByteEnd != (u_long)-1)
{
sprintf (buffer, "%lu", request->rangeByteEnd);
- pos += myserver_strlcpy (pos, buffer, MAX-(long)(pos-str));
+ pos += myserver_strlcpy (pos, buffer, MAX - (long)(pos - str));
}
- pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
+ pos += myserver_strlcpy (pos, "\r\n", MAX - (long)(pos - str));
}
if (request->other.size ())
@@ -175,14 +182,16 @@ u_long HttpHeaders::buildHTTPRequestHeader (char *
str,HttpRequestHeader* reques
HttpRequestHeader::Entry *e = *it;
if (e)
{
- pos += myserver_strlcpy (pos, e->name->c_str (),
MAX-(long)(pos-str));
- pos += myserver_strlcpy (pos, ": ", MAX-(long)(pos-str));
- pos += myserver_strlcpy (pos, e->value->c_str (),
MAX-(long)(pos-str));
- pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
+ pos += myserver_strlcpy (pos, e->name->c_str (),
+ MAX - (long)(pos - str));
+ pos += myserver_strlcpy (pos, ": ", MAX - (long)(pos - str));
+ pos += myserver_strlcpy (pos, e->value->c_str (),
+ MAX - (long)(pos - str));
+ pos += myserver_strlcpy (pos, "\r\n", MAX - (long)(pos - str));
}
}
}
- pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
+ pos += myserver_strlcpy (pos, "\r\n", MAX - (long)(pos - str));
return (pos - str);
}
@@ -243,7 +252,8 @@ void HttpHeaders::resetHTTPResponse (HttpResponseHeader
*response)
* \param nLinesptr is a value of the lines number in the HEADER.
* \param ncharsptr is a value of the characters number in the HEADER.
*/
-int HttpHeaders::validHTTPResponse (const char *res, u_long* nLinesptr,
u_long* ncharsptr)
+int HttpHeaders::validHTTPResponse (const char *res, u_long *nLinesptr,
+ u_long *ncharsptr)
{
u_long i;
u_long nLinechars = 0;
@@ -299,11 +309,11 @@ int HttpHeaders::validHTTPResponse (const char *res,
u_long* nLinesptr, u_long*
* \param request HTTP request structure to fullfill with data.
* \param connection The current connection.
*/
-int HttpHeaders::buildHTTPRequestHeaderStruct (const char* input,
+int HttpHeaders::buildHTTPRequestHeaderStruct (const char *input,
u_long inputSize,
- u_long* nHeaderChars,
+ u_long *nHeaderChars,
HttpRequestHeader *request,
- Connection* connection)
+ Connection *connection)
{
/*
*In this function there is the HTTP protocol parse.
@@ -374,8 +384,8 @@ int HttpHeaders::buildHTTPRequestHeaderStruct (const char*
input,
if (tokenOff== -1 )
return 400;
- /* Copy the HTTP field (this is the command if we are on the first
line). */
- myserver_strlcpy (command, token, min (commandSize, tokenOff + 1) );
+ /* Copy the HTTP command (it is on the first line). */
+ myserver_strlcpy (command, token, min (commandSize, tokenOff + 1));
token += tokenOff;
@@ -460,7 +470,8 @@ int HttpHeaders::buildHTTPRequestHeaderStruct (const char*
input,
if (containOpts)
{
j = getEndLine (&token[i], HTTP_REQUEST_URI_DIM);
- for (j = 0; ((int)(i + j + 1) < max) && (j <
HTTP_REQUEST_URI_OPTS_DIM-1); j++)
+ for (j = 0; ((int)(i + j + 1) < max)
+ && (j < HTTP_REQUEST_URI_OPTS_DIM-1); j++)
++j;
}
@@ -492,7 +503,7 @@ int HttpHeaders::buildHTTPRequestHeaderStruct (const char*
input,
request->cmd.clear ();
tokenOff = getEndLine (input, HTTP_REQUEST_URI_DIM);
if (tokenOff > 0)
- request->uri.assign (input, min (HTTP_REQUEST_URI_DIM,
tokenOff) );
+ request->uri.assign (input, min (HTTP_REQUEST_URI_DIM,
tokenOff));
else
request->uri.assign (input, HTTP_REQUEST_URI_DIM);
return 400;
@@ -518,14 +529,16 @@ int HttpHeaders::buildHTTPRequestHeaderStruct (const
char* input,
request->cmd.clear ();
tokenOff = getEndLine (input, HTTP_REQUEST_URI_DIM);
if (tokenOff > 0)
- request->uri.assign (input, min (HTTP_REQUEST_URI_DIM,
tokenOff) );
+ request->uri.assign (input,
+ min (HTTP_REQUEST_URI_DIM, tokenOff));
else
request->uri.assign (input, HTTP_REQUEST_URI_DIM );
return 400;
}
/* Store if the requested uri terminates with a slash character. */
- request->uriEndsWithSlash = request->uri[(request->uri.length ())-1]
== '/';
+ request->uriEndsWithSlash =
+ request->uri[(request->uri.length ())-1] == '/';
/*
* Do not maintain any slash character if the uri has them at
@@ -568,9 +581,9 @@ int HttpHeaders::buildHTTPRequestHeaderStruct (const char*
input,
{
old->value->append (", ");
old->value->append (token,
- std::min
(static_cast<int>(HTTP_RESPONSE_OTHER_DIM
- -
old->value->length ()),
- static_cast<int>(tokenOff)));
+ std::min (static_cast<int>(HTTP_RESPONSE_OTHER_DIM
+ - old->value->length
()),
+ static_cast<int>(tokenOff)));
}
else
{
@@ -579,7 +592,7 @@ int HttpHeaders::buildHTTPRequestHeaderStruct (const char*
input,
{
e->name->assign (command, HTTP_RESPONSE_OTHER_DIM);
e->value->assign (token,
- std::min (HTTP_RESPONSE_OTHER_DIM,
tokenOff));
+ std::min (HTTP_RESPONSE_OTHER_DIM, tokenOff));
request->other.put (cmdStr, e);
}
}
@@ -705,8 +718,8 @@ int HttpHeaders::readReqAuthLine (HttpRequestHeader
*request,
const char *base64 = &token[6];
int len = getEndLine (base64, 64);
const char *tmp = base64 + len - 1;
- const char* lsecondaryBuffer;
- const char* lsecondaryBufferOr;
+ const char* decodedPw;
+ const char* decodedPwBuf;
char login[32];
char password[32];
CBase64Utils base64Utils;
@@ -724,22 +737,21 @@ int HttpHeaders::readReqAuthLine (HttpRequestHeader
*request,
if (len <= 1)
return 400;
- lsecondaryBuffer = base64Utils.decode (base64, &len);
- lsecondaryBufferOr = lsecondaryBuffer;
+ decodedPwBuf = decodedPw = base64Utils.decode (base64, &len);
- for (i = 0; (*lsecondaryBuffer != ':') && (i < 32);i++)
- login[i] = *lsecondaryBuffer++;
+ for (i = 0; (*decodedPw != ':') && (i < 32);i++)
+ login[i] = *decodedPw++;
login[i] = '\0';
- lsecondaryBuffer++;
- for (i = 0; (*lsecondaryBuffer) && (i < 31); i++)
- password[i] = *lsecondaryBuffer++;
+ decodedPw++;
+ for (i = 0; (*decodedPw) && (i < 31); i++)
+ password[i] = *decodedPw++;
password[i] = '\0';
connection->setLogin (login);
connection->setPassword (password);
- delete lsecondaryBufferOr;
+ delete decodedPwBuf;
*lenOut = tokenOff = getEndLine (token, 100);
}
else if (!request->auth.compare ("Digest"))
@@ -1032,7 +1044,7 @@ int HttpHeaders::buildHTTPResponseHeaderStruct (const
char *input,
if (token)
{
-
+
if (strlen (command) > HTTP_RESPONSE_OTHER_DIM ||
strlen (token) > HTTP_RESPONSE_OTHER_DIM)
{
diff --git a/myserver/src/server/clients_thread.cpp
b/myserver/src/server/clients_thread.cpp
index 0ba0b08..fb07752 100644
--- a/myserver/src/server/clients_thread.cpp
+++ b/myserver/src/server/clients_thread.cpp
@@ -71,7 +71,7 @@ ClientsThread::~ClientsThread ()
threadIsRunning = false;
buffer.free ();
- secondaryBuffer.free ();
+ auxiliaryBuffer.free ();
}
/*!
@@ -125,8 +125,8 @@ DEFINE_THREAD (clients_thread, pParam)
ct->buffer.setRealLength (ct->bufferSize);
ct->buffer.setSizeLimit (ct->bufferSize);
- ct->secondaryBuffer.setRealLength (ct->bufferSize);
- ct->secondaryBuffer.setSizeLimit (ct->bufferSize);
+ ct->auxiliaryBuffer.setRealLength (ct->bufferSize);
+ ct->auxiliaryBuffer.setSizeLimit (ct->bufferSize);
/* Built-in protocols will be initialized at the first use. */
ct->initialized = true;
@@ -297,9 +297,9 @@ int ClientsThread::controlConnections ()
if (c->hasContinuation ())
{
retcode = c->getContinuation ()(c, (char*)buffer.getBuffer (),
- (char*)secondaryBuffer.getBuffer (),
+ (char*)auxiliaryBuffer.getBuffer (),
buffer.getRealLength (),
- secondaryBuffer.getRealLength (),
+ auxiliaryBuffer.getRealLength (),
nBytesToRead, id);
c->setContinuation (NULL);
}
@@ -308,9 +308,9 @@ int ClientsThread::controlConnections ()
protocol = server->getProtocol (c->host->getProtocolName ());
if (protocol)
retcode = protocol->controlConnection (c, (char*)buffer.getBuffer (),
- (char*)secondaryBuffer.getBuffer (),
+ (char*)auxiliaryBuffer.getBuffer (),
buffer.getRealLength (),
- secondaryBuffer.getRealLength (),
+ auxiliaryBuffer.getRealLength (),
nBytesToRead, id);
else
retcode = ClientsThread::DELETE_CONNECTION;
@@ -398,7 +398,7 @@ MemBuf* ClientsThread::getBuffer ()
*/
MemBuf *ClientsThread::getSecondaryBuffer ()
{
- return &secondaryBuffer;
+ return &auxiliaryBuffer;
}
/*!
commit 643175177b8348828d281cbb6268c11a0a74a122
Author: Giuseppe Scrivano <address@hidden>
Date: Sat Nov 7 02:00:39 2009 +0100
Avoid several casts using directly an object of the desired type.
diff --git a/myserver/src/protocol/http/http.cpp
b/myserver/src/protocol/http/http.cpp
index a098074..cf0423c 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -1237,12 +1237,15 @@ int Http::requestAuthorization ()
*td->secondaryBuffer << "\r\nContent-length: 0\r\n";
if (td->authScheme == HTTP_AUTH_SCHEME_BASIC)
- *td->secondaryBuffer << "WWW-Authenticate: Basic realm=\""
- << (host ? host->value->c_str () : "")
- << "\"\r\n";
+ {
+ *td->secondaryBuffer << "WWW-Authenticate: Basic realm=\""
+ << (host ? host->value->c_str () : "")
+ << "\"\r\n";
+ }
else if (td->authScheme == HTTP_AUTH_SCHEME_DIGEST)
{
char md5Str[256];
+ HttpUserData *hud = (HttpUserData*) td->connection->protocolBuffer;
if (td->connection->protocolBuffer == 0)
{
td->connection->protocolBuffer = new HttpUserData;
@@ -1251,11 +1254,10 @@ int Http::requestAuthorization ()
sendHTTPhardError500 ();
return HttpDataHandler::RET_FAILURE;
}
- ((HttpUserData*) (td->connection->protocolBuffer))->reset ();
+ hud->reset ();
}
- myserver_strlcpy (((HttpUserData*)
td->connection->protocolBuffer)->realm,
- host ? host->value->c_str () : "", 48);
+ myserver_strlcpy (hud->realm, host ? host->value->c_str () : "", 48);
/* Just a random string. */
md5Str[0] = (char) td->id;
@@ -1265,34 +1267,24 @@ int Http::requestAuthorization ()
md5Str[4] = (char) (clock () & 0xFF);
strncpy (&(md5Str[5]), td->request.uri.c_str (), 256 - 5);
md5.init ();
- md5.update ((char const*) md5Str,
- (unsigned int) strlen (md5Str));
- md5.end (((HttpUserData*) td->connection->protocolBuffer)->opaque);
+ md5.update (md5Str, strlen (md5Str));
+ md5.end (hud->opaque);
if (td->connection->protocolBuffer &&
- ((!(((HttpUserData*) td->connection->protocolBuffer)->digest)) ||
- (((HttpUserData*) td->connection->protocolBuffer)->nonce[0] ==
'\0')))
+ ((!(hud->digest)) || (hud->nonce[0] == '\0')))
{
- computeDigest (((HttpUserData*)
td->connection->protocolBuffer)->nonce,
- md5Str);
- ((HttpUserData*) td->connection->protocolBuffer)->nc = 0;
+ computeDigest (hud->nonce, md5Str);
+ hud->nc = 0;
}
*td->secondaryBuffer << "WWW-Authenticate: digest "
- << " qop=\"auth\", algorithm =\"MD5\", realm =\""
- << ((HttpUserData*) td->connection->protocolBuffer)->realm
- << "\", opaque =\""
- << ((HttpUserData*) td->connection->protocolBuffer)->opaque
- << "\", nonce =\""
- << ((HttpUserData*) td->connection->protocolBuffer)->nonce
- << "\" ";
-
- if (((HttpUserData*) td->connection->protocolBuffer)->cnonce[0])
- {
- *td->secondaryBuffer << ", cnonce =\""
- << ((HttpUserData*) td->connection->protocolBuffer)->cnonce
- << "\" ";
- }
+ << " qop=\"auth\", algorithm =\"MD5\", realm =\""
+ << hud->realm << "\", opaque =\"" << hud->opaque
+ << "\", nonce =\"" << hud->nonce << "\" ";
+
+ if (hud->cnonce[0])
+ *td->secondaryBuffer << ", cnonce =\"" << hud->cnonce << "\" ";
+
*td->secondaryBuffer << "\r\n";
}
else
@@ -1300,12 +1292,13 @@ int Http::requestAuthorization ()
/* Send a non implemented error page if the auth scheme is not known. */
return raiseHTTPError (501);
}
+
*td->secondaryBuffer << "Date: ";
getRFC822GMTTime (time, 32);
- *td->secondaryBuffer << time
- << "\r\n\r\n";
+ *td->secondaryBuffer << time << "\r\n\r\n";
+
if (td->connection->socket->send (td->secondaryBuffer->getBuffer (),
- td->secondaryBuffer->getLength (), 0) ==
-1)
+ td->secondaryBuffer->getLength (), 0) < 0)
{
td->connection->host->warningsLogWrite (_("HTTP: socket error"));
return HttpDataHandler::RET_FAILURE;
-----------------------------------------------------------------------
Summary of changes:
myserver/include/protocol/ftp/ftp.h | 2 +-
.../include/protocol/http/http_thread_context.h | 2 +-
myserver/include/server/clients_thread.h | 2 +-
myserver/src/http_handler/cgi/cgi.cpp | 32 ++--
myserver/src/http_handler/fastcgi/fastcgi.cpp | 8 +-
myserver/src/http_handler/http_dir/http_dir.cpp | 96 ++++----
myserver/src/http_handler/http_file/http_file.cpp | 2 +-
myserver/src/http_handler/isapi/isapi.cpp | 6 +-
myserver/src/http_handler/mscgi/mscgi.cpp | 4 +-
myserver/src/http_handler/proxy/proxy.cpp | 12 +-
myserver/src/http_handler/scgi/scgi.cpp | 36 ++--
myserver/src/http_handler/wincgi/wincgi.cpp | 30 ++--
myserver/src/protocol/ftp/ftp.cpp | 74 ++++----
myserver/src/protocol/http/env/env.cpp | 2 +-
myserver/src/protocol/http/http.cpp | 229 ++++++++++----------
myserver/src/protocol/http/http_data_read.cpp | 12 +-
myserver/src/protocol/http/http_headers.cpp | 136 +++++++------
myserver/src/server/clients_thread.cpp | 16 +-
18 files changed, 353 insertions(+), 348 deletions(-)
hooks/post-receive
--
GNU MyServer
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9-373-g2061dc5,
Giuseppe Scrivano <=