[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_2-25-g
From: |
Giuseppe Scrivano |
Subject: |
[myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-25-g95371ab |
Date: |
Mon, 22 Feb 2010 16:05:28 +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 95371abb2377a4c70503531d45a548dc0a678925 (commit)
via c8ee22bdb1ee47ef23a8553dc0903aaf4a6ddb5a (commit)
via 30c2526c69c05471358299c04a44d0a129c4fb0c (commit)
via b9c635f390604b98846c410e95eed74f887b3feb (commit)
from 34fa5e73198b1f438024676e3e78a8adf59a6d4b (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 95371abb2377a4c70503531d45a548dc0a678925
Author: Giuseppe Scrivano <address@hidden>
Date: Mon Feb 22 16:31:34 2010 +0100
Use lowercase Http headers as key for the `other' hashmap.
diff --git a/myserver/include/protocol/http/http_header.h
b/myserver/include/protocol/http/http_header.h
index 3cb5f66..b088d47 100644
--- a/myserver/include/protocol/http/http_header.h
+++ b/myserver/include/protocol/http/http_header.h
@@ -28,9 +28,40 @@ using namespace std;
struct HttpHeader
{
- virtual string* getValue (const char* name, string* out) = 0;
- virtual string* setValue (const char* name, const char* in) = 0;
+ struct Entry
+ {
+ string *name;
+ string *value;
+ Entry ()
+ {
+ name = new string ();
+ value = new string ();
+ }
+
+ Entry (string& n, string& v)
+ {
+ name = new string ();
+ value = new string ();
+
+ name->assign (n);
+ value->assign (v);
+ }
+
+ ~Entry ()
+ {
+ delete name;
+ delete value;
+
+ }
+
+ };
+
+ virtual string* getValue (const char *name, string *out);
+ virtual string* setValue (const char *name, const char *in);
virtual ~HttpHeader (){}
+
+ /* Key are stored lower-case. */
+ HashMap<string, struct Entry *> other;
};
#endif
diff --git a/myserver/include/protocol/http/http_request.h
b/myserver/include/protocol/http/http_request.h
index 4b82e45..8835b91 100644
--- a/myserver/include/protocol/http/http_request.h
+++ b/myserver/include/protocol/http/http_request.h
@@ -44,33 +44,6 @@ using namespace std;
*/
struct HttpRequestHeader : public HttpHeader
{
- struct Entry
- {
- string *name;
- string *value;
- Entry ()
- {
- name = new string ();
- value = new string ();
- }
-
- Entry (string& n, string& v)
- {
- name = new string ();
- value = new string ();
-
- name->assign (n);
- value->assign (v);
- }
-
- ~Entry ()
- {
- delete name;
- delete value;
-
- }
-
- };
string cmd;
string ver;
string auth;
@@ -95,8 +68,6 @@ struct HttpRequestHeader : public HttpHeader
char digestQop[16+1];
char digestNc[10+1];
-
- HashMap<string, HttpRequestHeader::Entry*> other;
virtual string* getValue (const char* name, string* out);
virtual string* setValue (const char* name, const char* in);
diff --git a/myserver/include/protocol/http/http_response.h
b/myserver/include/protocol/http/http_response.h
index 209d1b9..19d2895 100644
--- a/myserver/include/protocol/http/http_response.h
+++ b/myserver/include/protocol/http/http_response.h
@@ -44,37 +44,11 @@ struct HttpResponseHeader : public HttpHeader
const static int CLIENT_ERROR = 400;
const static int SERVER_ERROR = 500;
- struct Entry
- {
- string *name;
- string *value;
- Entry ()
- {
- name = new string ();
- value = new string ();
- }
-
- Entry (string& n, string& v)
- {
- name = new string ();
- value = new string ();
-
- name->assign (n);
- value->assign (v);
- }
- ~Entry ()
- {
- delete name;
- delete value;
-
- }
- };
int httpStatus;
string ver;
string contentLength;
string errorType;
- HashMap<string,HttpResponseHeader::Entry*> other;
HttpResponseHeader ();
~HttpResponseHeader ();
diff --git a/myserver/src/http_handler/http_dir/http_dir.cpp
b/myserver/src/http_handler/http_dir/http_dir.cpp
index 25ab040..7742053 100644
--- a/myserver/src/http_handler/http_dir/http_dir.cpp
+++ b/myserver/src/http_handler/http_dir/http_dir.cpp
@@ -316,7 +316,7 @@ int HttpDir::send (HttpThreadContext* td,
"%f%t%s");
- HttpRequestHeader::Entry *host = td->request.other.get ("Host");
+ HttpRequestHeader::Entry *host = td->request.other.get ("host");
chain.setStream (td->connection->socket);
if ( !(td->permissions & MYSERVER_PERMISSION_BROWSE))
@@ -337,7 +337,7 @@ int HttpDir::send (HttpThreadContext* td,
checkDataChunks (td, &keepalive, &useChunks);
- td->response.setValue ("Content-type", "text/html");
+ td->response.setValue ("content-type", "text/html");
ignPattern = td->securityToken.getData ("http.dir.ignore",
MYSERVER_SECURITY_CONF
diff --git a/myserver/src/http_handler/http_file/http_file.cpp
b/myserver/src/http_handler/http_file/http_file.cpp
index e59ca9d..8f99b96 100644
--- a/myserver/src/http_handler/http_file/http_file.cpp
+++ b/myserver/src/http_handler/http_file/http_file.cpp
@@ -49,7 +49,7 @@ int HttpFile::putFile (HttpThreadContext* td, string&
filename)
try
{
if (td->request.isKeepAlive ())
- td->response.setValue ("Connection", "keep-alive");
+ td->response.setValue ("connection", "keep-alive");
if (!(td->permissions & MYSERVER_PERMISSION_WRITE))
return td->http->sendAuth ();
@@ -241,10 +241,10 @@ int HttpFile::send (HttpThreadContext* td, const char
*filenamePath,
return td->http->raiseHTTPError (500);
getRFC822GMTTime (lastMT, tmpTime, 32);
- td->response.setValue ("Last-Modified", tmpTime.c_str ());
+ td->response.setValue ("last-modified", tmpTime.c_str ());
HttpRequestHeader::Entry *ifModifiedSince =
- td->request.other.get ("Last-Modified");
+ td->request.other.get ("last-modified");
if (ifModifiedSince && ifModifiedSince->value->length () &&
!ifModifiedSince->value->compare (tmpTime))
@@ -262,18 +262,18 @@ int HttpFile::send (HttpThreadContext* td, const char
*filenamePath,
string etag;
generateEtag (etag, lastMT, filesize);
- HttpRequestHeader::Entry *etagHeader = td->request.other.get ("ETag");
+ HttpRequestHeader::Entry *etagHeader = td->request.other.get ("etag");
if (etagHeader && !etagHeader->value->compare (etag))
return td->http->sendHTTPNonModified ();
else
{
- HttpResponseHeader::Entry *e = td->response.other.get ("Etag");
+ HttpResponseHeader::Entry *e = td->response.other.get ("etag");
if (e)
e->value->assign (etag);
else
{
e = new HttpResponseHeader::Entry ();
- e->name->assign ("Etag");
+ e->name->assign ("etag");
e->value->assign (etag);
td->response.other.put (*(e->name), e);
}
@@ -320,13 +320,13 @@ 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->name->assign ("content-range");
e->value->assign (buffer.str ());
td->response.other.put (*(e->name), e);
}
@@ -336,7 +336,7 @@ int HttpFile::send (HttpThreadContext* td, const char
*filenamePath,
chain.setStream (&memStream);
if (td->mime)
{
- HttpRequestHeader::Entry* e = td->request.other.get
("Accept-encoding");
+ HttpRequestHeader::Entry* e = td->request.other.get
("accept-encoding");
if (td->mime &&
Server::getInstance ()->getFiltersFactory ()->chain (&chain,
td->mime->filters,
@@ -363,23 +363,23 @@ int HttpFile::send (HttpThreadContext* td, const char
*filenamePath,
}
if (keepalive)
- td->response.setValue ("Connection", "keep-alive");
+ td->response.setValue ("connection", "keep-alive");
else
- td->response.setValue ("Connection", "close");
+ td->response.setValue ("connection", "close");
if (useModifiers)
{
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);
}
@@ -391,20 +391,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 9724871..e2adc2b 100644
--- a/myserver/src/http_handler/isapi/isapi.cpp
+++ b/myserver/src/http_handler/isapi/isapi.cpp
@@ -215,7 +215,7 @@ BOOL WINAPI ISAPI_WriteClientExport (HCONN hConn, LPVOID
Buffer, LPDWORD lpdwByt
return HttpDataHandler::RET_FAILURE;
buffer= (char*)ConnInfo->td->buffer->getBuffer ();
- HttpRequestHeader::Entry *connection = ConnInfo->td->request.other.get
("Connection");
+ HttpRequestHeader::Entry *connection = ConnInfo->td->request.other.get
("connection");
if (ConnInfo == NULL)
{
@@ -277,19 +277,19 @@ BOOL WINAPI ISAPI_WriteClientExport (HCONN hConn, LPVOID
Buffer, LPDWORD lpdwByt
if (keepalive)
{
HttpResponseHeader::Entry *e;
- e = ConnInfo->td->response.other.get ("Transfer-encoding");
+ e = ConnInfo->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");
ConnInfo->td->response.other.put (*(e->name), e);
}
}
else
- ConnInfo->td->response.setValue ("Connection", "Close");
+ ConnInfo->td->response.setValue ("connection", "Close");
if (HttpHeaders::sendHeader (ConnInfo->td->response,
*ConnInfo->td->connection->socket,
@@ -493,8 +493,8 @@ BOOL Isapi::buildAllHttpHeaders (HttpThreadContext* td,
ConnectionPtr /*!a*/,
DWORD valLen = 0;
DWORD maxLen = *dwMaxLen;
char *ValStr=(char*)output;
- HttpRequestHeader::Entry *accept = td->request.other.get ("Accept");
- HttpRequestHeader::Entry *cache = td->request.other.get ("Cache-Control");
+ HttpRequestHeader::Entry *accept = td->request.other.get ("accept");
+ HttpRequestHeader::Entry *cache = td->request.other.get ("cache-control");
if (accept && accept->value->length () && (valLen+30<maxLen))
valLen += sprintf (&ValStr[valLen],"HTTP_ACCEPT:%s\n",
@@ -524,7 +524,7 @@ BOOL Isapi::buildAllHttpHeaders (HttpThreadContext* td,
ConnectionPtr /*!a*/,
}
{
- HttpRequestHeader::Entry* e = td->request.other.get ("Accept-Encoding");
+ HttpRequestHeader::Entry* e = td->request.other.get ("accept-encoding");
if (e && (valLen + 30 < maxLen))
valLen += sprintf (&ValStr[valLen], "HTTP_ACCEPT_ENCODING:%s\n",
e->value->c_str ());
@@ -533,7 +533,7 @@ BOOL Isapi::buildAllHttpHeaders (HttpThreadContext* td,
ConnectionPtr /*!a*/,
}
{
- HttpRequestHeader::Entry* e = td->request.other.get ("Accept-Language");
+ HttpRequestHeader::Entry* e = td->request.other.get ("accept-language");
if (e && (valLen + 30 < maxLen))
valLen += sprintf (&ValStr[valLen],"HTTP_ACCEPT_LANGUAGE:%s\n",
e->value->c_str ());
@@ -543,7 +543,7 @@ BOOL Isapi::buildAllHttpHeaders (HttpThreadContext* td,
ConnectionPtr /*!a*/,
{
- HttpRequestHeader::Entry* e = td->request.other.get ("Accept-Charset");
+ HttpRequestHeader::Entry* e = td->request.other.get ("accept-charset");
if (e && (valLen + 30 < maxLen))
valLen += sprintf (&ValStr[valLen],"HTTP_ACCEPT_CHARSET:%s\n",
e->value->c_str ());
@@ -552,7 +552,7 @@ BOOL Isapi::buildAllHttpHeaders (HttpThreadContext* td,
ConnectionPtr /*!a*/,
}
{
- HttpRequestHeader::Entry* e = td->request.other.get ("Pragma");
+ HttpRequestHeader::Entry* e = td->request.other.get ("pragma");
if (e && (valLen + 30 < maxLen))
valLen += sprintf (&ValStr[valLen],"HTTP_PRAGMA:%s\n",
e->value->c_str ());
@@ -561,7 +561,7 @@ BOOL Isapi::buildAllHttpHeaders (HttpThreadContext* td,
ConnectionPtr /*!a*/,
}
{
- HttpRequestHeader::Entry* e = td->request.other.get ("Connection");
+ HttpRequestHeader::Entry* e = td->request.other.get ("connection");
if (e && (valLen + 30< maxLen))
valLen += sprintf (&ValStr[valLen],"HTTP_CONNECTION:%s\n",
e->value->c_str ());
@@ -570,7 +570,7 @@ BOOL Isapi::buildAllHttpHeaders (HttpThreadContext* td,
ConnectionPtr /*!a*/,
}
{
- HttpRequestHeader::Entry* e = td->request.other.get ("Cookie");
+ HttpRequestHeader::Entry* e = td->request.other.get ("cookie");
if (e && (valLen + 30 < maxLen))
valLen += sprintf (&ValStr[valLen],"HTTP_COOKIE:%s\n",
e->value->c_str ());
@@ -579,7 +579,7 @@ BOOL Isapi::buildAllHttpHeaders (HttpThreadContext* td,
ConnectionPtr /*!a*/,
}
{
- HttpRequestHeader::Entry* e = td->request.other.get ("Host");
+ HttpRequestHeader::Entry* e = td->request.other.get ("host");
if (e && (valLen + 30 < maxLen))
valLen += sprintf (&ValStr[valLen],"HTTP_HOST:%s\n",
e->value->c_str ());
@@ -588,7 +588,7 @@ BOOL Isapi::buildAllHttpHeaders (HttpThreadContext* td,
ConnectionPtr /*!a*/,
}
{
- HttpRequestHeader::Entry* e = td->request.other.get ("Date");
+ HttpRequestHeader::Entry* e = td->request.other.get ("date");
if (e && (valLen + 30 < maxLen))
valLen += sprintf (&ValStr[valLen],"HTTP_DATE:%s\n",
e->value->c_str ());
@@ -597,7 +597,7 @@ BOOL Isapi::buildAllHttpHeaders (HttpThreadContext* td,
ConnectionPtr /*!a*/,
}
{
- HttpRequestHeader::Entry* e = td->request.other.get ("If-Modified-Since");
+ HttpRequestHeader::Entry* e = td->request.other.get ("if-modified-since");
if (e && (valLen + 30 < maxLen))
valLen += sprintf (&ValStr[valLen],"HTTP_IF_MODIFIED_SINCE:%s\n",
e->value->c_str ());
@@ -606,7 +606,7 @@ BOOL Isapi::buildAllHttpHeaders (HttpThreadContext* td,
ConnectionPtr /*!a*/,
}
{
- HttpRequestHeader::Entry* e = td->request.other.get ("Referer");
+ HttpRequestHeader::Entry* e = td->request.other.get ("referer");
if (e && (valLen + 30 < maxLen))
valLen += sprintf (&ValStr[valLen],"HTTP_REFERER:%s\n",
e->value->c_str ());
@@ -615,7 +615,7 @@ BOOL Isapi::buildAllHttpHeaders (HttpThreadContext* td,
ConnectionPtr /*!a*/,
}
{
- HttpRequestHeader::Entry* e = td->request.other.get ("User-Agent");
+ HttpRequestHeader::Entry* e = td->request.other.get ("user-agent");
if (e && (valLen + 30 < maxLen))
valLen += sprintf (&ValStr[valLen],"HTTP_USER_AGENT:%s\n",
e->value->c_str ());
@@ -624,7 +624,7 @@ BOOL Isapi::buildAllHttpHeaders (HttpThreadContext* td,
ConnectionPtr /*!a*/,
}
{
- HttpRequestHeader::Entry* e = td->request.other.get ("From");
+ HttpRequestHeader::Entry* e = td->request.other.get ("from");
if (e && (valLen + 30 < maxLen))
valLen += sprintf (&ValStr[valLen],"HTTP_FROM:%s\n",
e->value->c_str ());
@@ -883,7 +883,7 @@ int Isapi::send (HttpThreadContext* td,
ExtCtrlBlk.lpbData = 0;
- HttpRequestHeader::Entry *content = td->request.other.get ("Content-type");
+ HttpRequestHeader::Entry *content = td->request.other.get ("content-type");
ExtCtrlBlk.lpszContentType = content ? (char*)content->value->c_str () :
NULL;
connTable[connIndex].td->buffer->setLength (0);
@@ -903,7 +903,7 @@ int Isapi::send (HttpThreadContext* td,
{
u_long nbw = 0;
- HttpRequestHeader::Entry *connection =
connTable[connIndex].td->request.other.get ("Connection");
+ HttpRequestHeader::Entry *connection =
connTable[connIndex].td->request.other.get ("connection");
if (connection && !stringcmpi (connection->value->c_str (), "keep-alive"))
Ret = connTable[connIndex].chain.getStream ()->write ("0\r\n\r\n", 5,
&nbw);
diff --git a/myserver/src/http_handler/wincgi/wincgi.cpp
b/myserver/src/http_handler/wincgi/wincgi.cpp
index 8122d43..6f41ebb 100644
--- a/myserver/src/http_handler/wincgi/wincgi.cpp
+++ b/myserver/src/http_handler/wincgi/wincgi.cpp
@@ -171,7 +171,7 @@ int WinCgi::send (HttpThreadContext* td, const char*
scriptpath,
}
{
- HttpRequestHeader::Entry *referer = td->request.other.get ("Referer");
+ HttpRequestHeader::Entry *referer = td->request.other.get ("referer");
if (referer && referer->value->length ())
{
@@ -181,7 +181,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 ())
{
@@ -191,7 +191,7 @@ int WinCgi::send (HttpThreadContext* td, const char*
scriptpath,
}
{
- HttpRequestHeader::Entry *userAgent = td->request.other.get ("User-Agent");
+ HttpRequestHeader::Entry *userAgent = td->request.other.get ("user-agent");
if (userAgent && userAgent->value->length ())
{
@@ -225,7 +225,7 @@ int WinCgi::send (HttpThreadContext* td, const char*
scriptpath,
DataFileHandle.writeToFile (buffer, (u_long)strlen (buffer), &nbr);
{
- HttpRequestHeader::Entry *host = td->request.other.get ("Host");
+ HttpRequestHeader::Entry *host = td->request.other.get ("host");
if (host)
sprintf (buffer, "Server Name=%s\r\n", host->value->c_str ());
DataFileHandle.writeToFile (buffer, (u_long)strlen (buffer), &nbr);
@@ -330,7 +330,7 @@ int WinCgi::send (HttpThreadContext* td, const char*
scriptpath,
}
if (td->request.isKeepAlive ())
- td->response.setValue ("Connection", "keep-alive");
+ td->response.setValue ("connection", "keep-alive");
HttpHeaders::buildHTTPResponseHeaderStruct (buffer, &td->response,
&(td->nBytesToRead));
diff --git a/myserver/src/protocol/http/Makefile.am
b/myserver/src/protocol/http/Makefile.am
index 4a9ffbe..ebba91c 100644
--- a/myserver/src/protocol/http/Makefile.am
+++ b/myserver/src/protocol/http/Makefile.am
@@ -16,7 +16,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AM_CXXFLAGS="-I$(top_srcdir)/lib"
lib_LIBRARIES = libhttp.a
-libhttp_a_SOURCES = http.cpp http_data_handler.cpp http_data_read.cpp
http_errors.cpp http_headers.cpp http_request.cpp http_req_security_domain.cpp
http_response.cpp http_thread_context.cpp dyn_http_manager.cpp
dyn_http_manager_list.cpp dyn_http_command.cpp dyn_http_command_manager.cpp
+libhttp_a_SOURCES = http.cpp http_data_handler.cpp http_data_read.cpp \
+ http_errors.cpp http_header.cpp http_headers.cpp \
+ http_request.cpp http_req_security_domain.cpp \
+ http_response.cpp http_thread_context.cpp \
+ dyn_http_manager.cpp dyn_http_manager_list.cpp \
+ dyn_http_command.cpp dyn_http_command_manager.cpp
SUBDIRS = env
AM_CPPFLAGS = $(all_includes)
diff --git a/myserver/src/protocol/http/env/env.cpp
b/myserver/src/protocol/http/env/env.cpp
index 552c53e..b506d35 100644
--- a/myserver/src/protocol/http/env/env.cpp
+++ b/myserver/src/protocol/http/env/env.cpp
@@ -204,7 +204,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 ea1e4c6..f58896c 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -134,7 +134,7 @@ int Http::optionsHTTPRESOURCE (string& filename, int
yetmapped)
try
{
- HttpRequestHeader::Entry *connection = td->request.other.get
("Connection");
+ HttpRequestHeader::Entry *connection = td->request.other.get
("connection");
string methods ("OPTIONS, GET, POST, HEAD, DELETE, PUT, TRACE");
HashMap<string, DynamicHttpCommand*>::Iterator it =
@@ -204,7 +204,7 @@ int Http::traceHTTPRESOURCE (string& filename, int
yetmapped)
*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");
+ connection = td->request.other.get ("connection");
if (connection && connection->value->length ())
*td->auxiliaryBuffer << "Connection:" << connection->value->c_str ()
<< "\r\n";
@@ -466,7 +466,7 @@ int Http::preprocessHttpRequest (string& filename, int
yetmapped, int* permissio
try
{
if (td->request.isKeepAlive ())
- td->response.setValue ("Connection", "keep-alive");
+ td->response.setValue ("connection", "keep-alive");
ret = getFilePermissions (filename, directory, file,
td->filenamePath, yetmapped, permissions);
@@ -715,12 +715,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 = "";
}
@@ -808,8 +808,8 @@ int Http::logHTTPaccess ()
if (td->connection->host)
{
- HttpRequestHeader::Entry *userAgent = td->request.other.get
("User-Agent");
- HttpRequestHeader::Entry *referer = td->request.other.get ("Refer");
+ HttpRequestHeader::Entry *userAgent = td->request.other.get
("user-agent");
+ HttpRequestHeader::Entry *referer = td->request.other.get ("refer");
if (strstr ((td->connection->host)->getAccessLogOpt (),
"type=combined"))
*td->auxiliaryBuffer << " " << (referer ? referer->value->c_str ()
: "")
@@ -934,7 +934,7 @@ int Http::controlConnection (ConnectionPtr a, char*, char*,
u_long, u_long,
if (td->request.ver.compare ("HTTP/1.1"))
{
HttpRequestHeader::Entry *connection =
- td->request.other.get ("Connection");
+ td->request.other.get ("connection");
if (connection && connection->value->length ())
connection->value->assign ("close");
@@ -994,7 +994,7 @@ int Http::controlConnection (ConnectionPtr a, char*, char*,
u_long, u_long,
* Servers MUST reports a 400 (Bad request) error if an HTTP/1.1
* request does not include a Host request-header.
*/
- HttpRequestHeader::Entry *host = td->request.other.get ("Host");
+ HttpRequestHeader::Entry *host = td->request.other.get ("host");
if (host == NULL || (!td->request.ver.compare ("HTTP/1.1")
&& host->value->length () == 0))
@@ -1207,7 +1207,7 @@ int Http::controlConnection (ConnectionPtr a, char*,
char*, u_long, u_long,
bool keepalive = false;
HttpRequestHeader::Entry *connection = td->request.other.get
- ("Connection");
+ ("connection");
if (connection)
keepalive = !stringcmpi (connection->value->c_str (), "keep-alive");
@@ -1254,8 +1254,8 @@ int Http::requestAuthorization ()
{
Md5 md5;
string time;
- HttpRequestHeader::Entry *connection = td->request.other.get ("Connection");
- HttpRequestHeader::Entry *host = td->request.other.get ("Host");
+ HttpRequestHeader::Entry *connection = td->request.other.get ("connection");
+ HttpRequestHeader::Entry *host = td->request.other.get ("host");
td->response.httpStatus = 401;
td->auxiliaryBuffer->setLength (0);
*td->auxiliaryBuffer << "HTTP/1.1 401 Unauthorized\r\n"
@@ -1351,8 +1351,8 @@ int Http::raiseHTTPError (int ID)
ostringstream errorBodyMessage;
int errorBodyLength = 0;
int useMessagesFiles = 1;
- HttpRequestHeader::Entry *host = td->request.other.get ("Host");
- HttpRequestHeader::Entry *connection = td->request.other.get
("Connection");
+ HttpRequestHeader::Entry *host = td->request.other.get ("host");
+ HttpRequestHeader::Entry *connection = td->request.other.get
("connection");
const char *useMessagesVal = td->securityToken.getData
("http.use_error_file",
MYSERVER_VHOST_CONF
|
MYSERVER_SERVER_CONF,
@@ -1376,7 +1376,7 @@ int Http::raiseHTTPError (int ID)
HttpHeaders::buildDefaultHTTPResponseHeader (&(td->response));
if (connection && !stringcmpi (connection->value->c_str (),
"keep-alive"))
- td->response.setValue ("Connection", "keep-alive");
+ td->response.setValue ("connection", "keep-alive");
td->response.httpStatus = ID;
@@ -1691,7 +1691,7 @@ int Http::processDefaultFile (string& uri, int
permissions, int onlyHeader)
int Http::sendHTTPRedirect (const char *newURL)
{
string time;
- HttpRequestHeader::Entry *connection = td->request.other.get ("Connection");
+ HttpRequestHeader::Entry *connection = td->request.other.get ("connection");
td->response.httpStatus = 302;
td->auxiliaryBuffer->setLength (0);
@@ -1726,7 +1726,7 @@ int Http::sendHTTPRedirect (const char *newURL)
int Http::sendHTTPNonModified ()
{
string time;
- HttpRequestHeader::Entry *connection = td->request.other.get ("Connection");
+ HttpRequestHeader::Entry *connection = td->request.other.get ("connection");
td->response.httpStatus = 304;
td->auxiliaryBuffer->setLength (0);
diff --git a/myserver/src/protocol/http/http_data_handler.cpp
b/myserver/src/protocol/http/http_data_handler.cpp
index 4742532..216cb05 100644
--- a/myserver/src/protocol/http/http_data_handler.cpp
+++ b/myserver/src/protocol/http/http_data_handler.cpp
@@ -204,13 +204,13 @@ HttpDataHandler::checkDataChunks (HttpThreadContext* td,
bool* keepalive,
if (*keepalive)
{
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);
}
diff --git a/myserver/src/protocol/http/http_data_read.cpp
b/myserver/src/protocol/http/http_data_read.cpp
index 4fcde2f..aeb5852 100644
--- a/myserver/src/protocol/http/http_data_read.cpp
+++ b/myserver/src/protocol/http/http_data_read.cpp
@@ -243,16 +243,16 @@ 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");
+ td->request.other.get ("transfer-encoding");
/* Specify a type if it not specified by the client. */
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)
@@ -284,7 +284,7 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int*
httpRetCode)
if (!contentLengthSpecified && td->request.isKeepAlive ())
{
HttpRequestHeader::Entry *content =
- td->request.other.get ("Content-Encoding");
+ td->request.other.get ("content-encoding");
if (content && (content->value->length () == '\0')
&& (td->request.contentLength.length () == 0))
diff --git a/myserver/src/protocol/http/http_header.cpp
b/myserver/src/protocol/http/http_header.cpp
new file mode 100644
index 0000000..791a37d
--- /dev/null
+++ b/myserver/src/protocol/http/http_header.cpp
@@ -0,0 +1,70 @@
+/*
+MyServer
+Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009, 2010 Free Software
+Foundation, Inc.
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "myserver.h"
+#include <sstream>
+#include <include/protocol/http/http_header.h>
+
+#include <string>
+#include <algorithm>
+
+using namespace std;
+
+/*!
+ * Get the value of the [name] field.
+ */
+string* HttpHeader::getValue (const char *name, string *out)
+{
+ string key (name);
+ transform (key.begin (), str.end (), str.begin (), ::tolower);
+
+ Entry *e = other.get (str);
+ if (e)
+ {
+ if (out)
+ out->assign (*(e->value));
+ return e->value;
+ }
+
+ return NULL;
+}
+
+/*!
+ * Set the value of the [name] field to [in].
+ */
+string* HttpHeader::setValue (const char *name, const char *in)
+{
+ string key (name);
+ transform (key.begin (), key.end (), key.begin (), ::tolower);
+
+ Entry *e = other.get (key);
+ if (e)
+ {
+ e->value->assign (in);
+ return (e->value);
+ }
+ else
+ {
+ e = new Entry;
+ e->name->assign (name);
+ e->value->assign (in);
+ other.put (key, e);
+ }
+
+ return NULL;
+}
diff --git a/myserver/src/protocol/http/http_headers.cpp
b/myserver/src/protocol/http/http_headers.cpp
index 8956b8c..05bce44 100644
--- a/myserver/src/protocol/http/http_headers.cpp
+++ b/myserver/src/protocol/http/http_headers.cpp
@@ -75,7 +75,7 @@ u_long HttpHeaders::buildHTTPResponseHeader (char *str,
* Do not specify the Content-length field if it is used
* the chunked Transfer-encoding.
*/
- HttpResponseHeader::Entry *e = response->other.get ("Transfer-encoding");
+ HttpResponseHeader::Entry *e = response->other.get ("transfer-encoding");
if (!e || (e && e->value->find ("chunked", 0) == string::npos ))
{
@@ -206,7 +206,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);
}
@@ -223,7 +223,7 @@ void HttpHeaders::buildDefaultHTTPRequestHeader
(HttpRequestHeader* request)
request->uri.assign ("/");
/* HTTP/1.1 MUST specify a host. */
- request->setValue ("Host", "localhost");
+ request->setValue ("host", "localhost");
request->uriOpts.assign ("");
request->uriOptsPtr = 0;
}
@@ -577,6 +577,8 @@ int HttpHeaders::buildHTTPRequestHeaderStruct (const char
*input,
return 400;
string cmdStr (command);
+ transform (cmdStr.begin (), cmdStr.end (), cmdStr.begin (),
+ ::tolower);
HttpRequestHeader::Entry *old = request->other.get (cmdStr);
if (old)
{
@@ -589,8 +591,8 @@ int HttpHeaders::buildHTTPRequestHeaderStruct (const char
*input,
else
{
HttpRequestHeader::Entry *e = new HttpRequestHeader::Entry ();
- e->name->assign (command, std::min (HTTP_RESPONSE_OTHER_DIM,
- tokenOff));
+ e->name->assign (cmdStr.c_str (),
+ std::min (HTTP_RESPONSE_OTHER_DIM, tokenOff));
e->value->assign (token, std::min (HTTP_RESPONSE_OTHER_DIM,
tokenOff));
request->other.put (cmdStr, e);
@@ -1059,14 +1061,15 @@ int HttpHeaders::buildHTTPResponseHeaderStruct (const
char *input,
break;
}
- if (! strcasecmp (command, "Content-type"))
+ if (! strcasecmp (command, "content-type"))
append = false;
HttpResponseHeader::Entry *old = NULL;
HttpResponseHeader::Entry *e = new HttpResponseHeader::Entry ();
e->name->assign (command);
- string cmdString (command);
- old = response->other.put (cmdString, e);
+ transform (e->name->begin (), e->name->end (), e->name->begin (),
+ ::tolower);
+ old = response->other.put (*e->name, e);
if (old)
{
if (append)
diff --git a/myserver/src/protocol/http/http_request.cpp
b/myserver/src/protocol/http/http_request.cpp
index 2cbfeea..9249d8b 100644
--- a/myserver/src/protocol/http/http_request.cpp
+++ b/myserver/src/protocol/http/http_request.cpp
@@ -1,19 +1,19 @@
/*
-MyServer
-Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation,
-Inc.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
+ MyServer
+ Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation,
+ Inc.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "myserver.h"
@@ -79,16 +79,16 @@ void HttpRequestHeader::free ()
}
/*!
- *Check if this request is keep-alive.
+ * Check if this request is keep-alive.
*/
bool HttpRequestHeader::isKeepAlive ()
{
- Entry *connection = other.get ("Connection");
- if (connection)
- return (! stringcmpi (*connection->value,
- "keep-alive"));
+ Entry *connection = other.get ("connection");
+ if (connection)
+ return (! stringcmpi (*connection->value,
+ "keep-alive"));
- return false;
+ return false;
}
/*!
@@ -97,161 +97,134 @@ bool HttpRequestHeader::isKeepAlive ()
string* HttpRequestHeader::getValue (const char* name, string* out)
{
if (! strcasecmp (name, "cmd"))
- {
- if (out)
- out->assign (cmd.c_str ());
- return &cmd;
- }
+ {
+ if (out)
+ out->assign (cmd.c_str ());
+ return &cmd;
+ }
if (! strcasecmp (name, "ver"))
- {
- if (out)
- out->assign (ver.c_str ());
- return &ver;
- }
+ {
+ if (out)
+ out->assign (ver.c_str ());
+ return &ver;
+ }
if (! strcasecmp (name, "uri"))
- {
- if (out)
- out->assign (uri.c_str ());
- return &uri;
- }
+ {
+ if (out)
+ out->assign (uri.c_str ());
+ return &uri;
+ }
if (! strcasecmp (name, "uriOpts"))
- {
- if (out)
- out->assign (uriOpts.c_str ());
- return &uriOpts;
- }
-
- if (! strcasecmp (name, "Authorization"))
- {
- if (out)
- out->assign (auth.c_str ());
- return &auth;
- }
-
- if (! strcasecmp (name, "Content-length"))
- {
- if (out)
- out->assign (contentLength.c_str ());
- return &contentLength;
- }
-
- if (! strcasecmp (name, "rangeType"))
- {
- if (out)
- out->assign (rangeType.c_str ());
- return &rangeType;
- }
-
- if (! strcasecmp (name, "rangeByteBegin"))
- {
- ostringstream s;
- s << rangeByteBegin;
- if (out)
- out->assign (s.str ());
- return 0;
- }
-
- if (! strcasecmp (name, "rangeByteEnd"))
- {
- ostringstream s;
- s << rangeByteEnd;
- if (out)
- out->assign (s.str ());
- return 0;
- }
-
- {
- HttpRequestHeader::Entry *e = other.get (name);
- if (e)
- {
- if (out)
- out->assign (*(e->value));
- return (e->value);
- }
- return 0;
- }
-
+ {
+ if (out)
+ out->assign (uriOpts.c_str ());
+ return &uriOpts;
+ }
+
+ if (! strcasecmp (name, "Authorization"))
+ {
+ if (out)
+ out->assign (auth.c_str ());
+ return &auth;
+ }
+
+ if (! strcasecmp (name, "Content-length"))
+ {
+ if (out)
+ out->assign (contentLength.c_str ());
+ return &contentLength;
+ }
+
+ if (! strcasecmp (name, "rangeType"))
+ {
+ if (out)
+ out->assign (rangeType.c_str ());
+ return &rangeType;
+ }
+
+ if (! strcasecmp (name, "rangeByteBegin"))
+ {
+ ostringstream s;
+ s << rangeByteBegin;
+ if (out)
+ out->assign (s.str ());
+ return 0;
+ }
+
+ if (! strcasecmp (name, "rangeByteEnd"))
+ {
+ ostringstream s;
+ s << rangeByteEnd;
+ if (out)
+ out->assign (s.str ());
+ return 0;
+ }
+
+ return HttpHeader::getValue (name, out);
}
-
/*!
*Set the value of the [name] field to [in].
*/
-string* HttpRequestHeader::setValue (const char* name, const char* in)
+string* HttpRequestHeader::setValue (const char *name, const char *in)
{
if (! strcasecmp (name, "cmd"))
- {
- cmd.assign (in);
- return &cmd;
- }
+ {
+ cmd.assign (in);
+ return &cmd;
+ }
if (! strcasecmp (name, "ver"))
- {
- ver.assign (in);
- return &ver;
- }
+ {
+ ver.assign (in);
+ return &ver;
+ }
if (! strcasecmp (name, "uri"))
- {
- uri.assign (in);
- return &uri;
- }
+ {
+ uri.assign (in);
+ return &uri;
+ }
if (! strcasecmp (name, "uriOpts"))
- {
- uriOpts.assign (in);
- return &uriOpts;
- }
-
- if (! strcasecmp (name, "Authorization"))
- {
- auth.assign (in);
- return &auth;
- }
-
- if (! strcasecmp (name, "Content-length"))
- {
- contentLength.assign (in);
- return &contentLength;
- }
-
- if (! strcasecmp (name, "rangeType"))
- {
- rangeType.assign (in);
- return &rangeType;
- }
-
- if (! strcasecmp (name, "rangeByteBegin"))
- {
- rangeByteBegin = atoi (in);
- return 0;
- }
-
- if (! strcasecmp (name, "rangeByteEnd"))
- {
- rangeByteEnd = atoi (in);
- return 0;
- }
-
- {
- HttpRequestHeader::Entry *e = other.get (name);
- if (e)
- {
- e->value->assign (in);
- return (e->value);
- }
- else
- {
- e = new HttpRequestHeader::Entry;
- e->name->assign (name);
- e->value->assign (in);
- other.put (*e->name, e);
- }
- return 0;
- }
-
+ {
+ uriOpts.assign (in);
+ return &uriOpts;
+ }
+
+ if (! strcasecmp (name, "Authorization"))
+ {
+ auth.assign (in);
+ return &auth;
+ }
+
+ if (! strcasecmp (name, "Content-length"))
+ {
+ contentLength.assign (in);
+ return &contentLength;
+ }
+
+ if (! strcasecmp (name, "rangeType"))
+ {
+ rangeType.assign (in);
+ return &rangeType;
+ }
+
+ if (! strcasecmp (name, "rangeByteBegin"))
+ {
+ rangeByteBegin = atoi (in);
+ return 0;
+ }
+
+ if (! strcasecmp (name, "rangeByteEnd"))
+ {
+ rangeByteEnd = atoi (in);
+ return 0;
+ }
+
+ return HttpHeader::setValue (name, in);
}
diff --git a/myserver/src/protocol/http/http_response.cpp
b/myserver/src/protocol/http/http_response.cpp
index 79172be..83577ab 100644
--- a/myserver/src/protocol/http/http_response.cpp
+++ b/myserver/src/protocol/http/http_response.cpp
@@ -77,14 +77,7 @@ string* HttpResponseHeader::getValue (const char* name,
string* out)
return &contentLength;
}
- HttpResponseHeader::Entry *e = other.get (name);
- if (e)
- {
- if (out)
- out->assign (*(e->value));
- return e->value;
- }
- return 0;
+ return HttpHeader::getValue (name, out);
}
/*!
@@ -104,23 +97,7 @@ string* HttpResponseHeader::setValue (const char* name,
const char* in)
return &contentLength;
}
- {
- HttpResponseHeader::Entry *e = other.get (name);
- if (e)
- {
- e->value->assign (in);
- return (e->value);
- }
- else
- {
- e = new HttpResponseHeader::Entry;
- e->name->assign (name);
- e->value->assign (in);
- other.put (*e->name, e);
- }
-
- return 0;
- }
+ return HttpHeader::setValue (name, in);
}
/*!
diff --git a/myserver/tests/test_http_req_security_domain.cpp
b/myserver/tests/test_http_req_security_domain.cpp
index fa35a58..f729b28 100644
--- a/myserver/tests/test_http_req_security_domain.cpp
+++ b/myserver/tests/test_http_req_security_domain.cpp
@@ -72,6 +72,7 @@ public:
string *ret = dom->getValue (nameStr);
+ CPPUNIT_ASSERT (ret);
CPPUNIT_ASSERT_EQUAL (ret->compare (value), 0);
delete dom;
diff --git a/myserver/tests/test_http_request.cpp
b/myserver/tests/test_http_request.cpp
index c2dc13e..e96a964 100644
--- a/myserver/tests/test_http_request.cpp
+++ b/myserver/tests/test_http_request.cpp
@@ -120,6 +120,8 @@ public:
CPPUNIT_ASSERT (header.ver.compare ("HTTP/1.1") == 0);
CPPUNIT_ASSERT (header.uri.compare ("/resource") == 0);
CPPUNIT_ASSERT (header.uriOpts.compare ("args") == 0);
+
+ CPPUNIT_ASSERT (header.getValue ("Host", 0));
CPPUNIT_ASSERT (header.getValue ("Host", 0)->compare ("localhost") == 0);
}
commit c8ee22bdb1ee47ef23a8553dc0903aaf4a6ddb5a
Author: Giuseppe Scrivano <address@hidden>
Date: Mon Feb 22 15:46:28 2010 +0100
Move strupr from stringutils to mime_utils.
diff --git a/myserver/include/base/string/stringutils.h
b/myserver/include/base/string/stringutils.h
index 182be32..214d44c 100644
--- a/myserver/include/base/string/stringutils.h
+++ b/myserver/include/base/string/stringutils.h
@@ -81,11 +81,4 @@ int stringcmp (string const &a, string const &b);
int stringcmpi (string const &a, const char* b);
int stringcmp (string const &a, const char* b);
-# ifndef WIN32
-extern "C"
-{
- char* strupr (char * string);
-}
-# endif
-
#endif
diff --git a/myserver/src/base/base64/mime_utils.cpp
b/myserver/src/base/base64/mime_utils.cpp
index aec95e9..390fbb8 100644
--- a/myserver/src/base/base64/mime_utils.cpp
+++ b/myserver/src/base/base64/mime_utils.cpp
@@ -33,6 +33,14 @@ extern "C"
#include <include/base/string/stringutils.h>
#include <include/base/string/securestr.h>
+static char* myserver_strupr (char * s)
+{
+ unsigned int len = strlen (s);
+ for (register unsigned int i = 0; i < len; i++)
+ s[i] = toupper (s[i]);
+ return s;
+}
+
#define strupos(x, y) (strustr (x, y) != NULL ? strustr (x, y) - x : -1)
static char* strustr (char *source, char *s)
@@ -49,8 +57,8 @@ static char* strustr (char *source, char *s)
}
strncpy (csource, source, (strlen (source) + 2));
strncpy (cs, s, (strlen (s) + 2));
- strupr (csource);
- strupr (cs);
+ myserver_strupr (csource);
+ myserver_strupr (cs);
char *result = strstr (csource, cs);
if (result != NULL)
{
@@ -574,7 +582,7 @@ char* CQPUtils::encode (char *input)
snprintf (mids, 3, "%X", mid);
- strupr (mids);
+ myserver_strupr (mids);
*(fresult++) = '=';
*(fresult++) = mids[0];
*(fresult++) = mids[1];
diff --git a/myserver/src/base/string/stringutils.cpp
b/myserver/src/base/string/stringutils.cpp
index 87ec4fa..f14c505 100644
--- a/myserver/src/base/string/stringutils.cpp
+++ b/myserver/src/base/string/stringutils.cpp
@@ -864,13 +864,3 @@ int stringcmp (string const &a, const char* b)
{
return strcmp (a.c_str (), b);
}
-
-#ifndef WIN32
-char* strupr (char * s)
-{
- unsigned int len = strlen (s);
- for (register unsigned int i = 0; i < len; i++)
- s[i] = toupper (s[i]);
- return s;
-}
-#endif
commit 30c2526c69c05471358299c04a44d0a129c4fb0c
Author: Giuseppe Scrivano <address@hidden>
Date: Mon Feb 22 14:57:56 2010 +0100
make install doesn't overwrite configuration files.
diff --git a/myserver/binaries/Makefile.am b/myserver/binaries/Makefile.am
index 5955626..3731bfc 100644
--- a/myserver/binaries/Makefile.am
+++ b/myserver/binaries/Makefile.am
@@ -22,6 +22,6 @@ EXTRA_DIST = myserver-daemon MIMEtypes.default.xml
myserver.default.xml \
configdir = $(DESTDIR)$(prefix)/etc/myserver
install: install-recursive
- $(install_sh_DATA) MIMEtypes.default.xml $(configdir)/MIMEtypes.xml
- $(install_sh_DATA) myserver.default.xml $(configdir)/myserver.xml
- $(install_sh_DATA) virtualhosts.default.xml
$(configdir)/virtualhosts.xml
+ $(install_sh_DATA) MIMEtypes.default.xml
$(configdir)/MIMEtypes.default.xml
+ $(install_sh_DATA) myserver.default.xml
$(configdir)/myserver.default.xml
+ $(install_sh_DATA) virtualhosts.default.xml
$(configdir)/virtualhosts.default.xml
commit b9c635f390604b98846c410e95eed74f887b3feb
Author: Giuseppe Scrivano <address@hidden>
Date: Mon Feb 22 14:57:28 2010 +0100
Add the noinst_ prefix to the test_suite program.
diff --git a/myserver/tests/Makefile.am b/myserver/tests/Makefile.am
index 70c8af0..3503dcb 100644
--- a/myserver/tests/Makefile.am
+++ b/myserver/tests/Makefile.am
@@ -15,9 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AM_CXXFLAGS="-I$(top_srcdir)/lib"
-bin_PROGRAMS = test_suite
+noinst_PROGRAMS = test_suite
test_suite_SOURCES = main.cpp \
- memory_socket.h \
+ memory_socket.h \
test_auth_domain.cpp \
test_auth_method.cpp \
test_base64.cpp \
@@ -35,7 +35,7 @@ test_suite_SOURCES = main.cpp
\
test_filter_chain.cpp \
test_fork_server.cpp \
test_ftp.cpp \
- test_gopher_content.cpp \
+ test_gopher_content.cpp \
test_gzip.cpp \
test_hashmap.cpp \
test_homedir.cpp \
-----------------------------------------------------------------------
Summary of changes:
myserver/binaries/Makefile.am | 6 +-
myserver/include/base/string/stringutils.h | 7 -
myserver/include/protocol/http/http_header.h | 35 +++-
myserver/include/protocol/http/http_request.h | 29 --
myserver/include/protocol/http/http_response.h | 26 --
myserver/src/base/base64/mime_utils.cpp | 14 +-
myserver/src/base/string/stringutils.cpp | 10 -
myserver/src/http_handler/http_dir/http_dir.cpp | 4 +-
myserver/src/http_handler/http_file/http_file.cpp | 32 ++--
myserver/src/http_handler/isapi/isapi.cpp | 40 ++--
myserver/src/http_handler/wincgi/wincgi.cpp | 10 +-
myserver/src/protocol/http/Makefile.am | 7 +-
myserver/src/protocol/http/env/env.cpp | 2 +-
myserver/src/protocol/http/http.cpp | 34 ++--
myserver/src/protocol/http/http_data_handler.cpp | 4 +-
myserver/src/protocol/http/http_data_read.cpp | 8 +-
myserver/src/protocol/http/http_header.cpp | 70 +++++
myserver/src/protocol/http/http_headers.cpp | 19 +-
myserver/src/protocol/http/http_request.cpp | 289 ++++++++++-----------
myserver/src/protocol/http/http_response.cpp | 27 +--
myserver/tests/Makefile.am | 6 +-
myserver/tests/test_http_req_security_domain.cpp | 1 +
myserver/tests/test_http_request.cpp | 2 +
23 files changed, 340 insertions(+), 342 deletions(-)
create mode 100644 myserver/src/protocol/http/http_header.cpp
hooks/post-receive
--
GNU MyServer
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-25-g95371ab,
Giuseppe Scrivano <=