|
From: <fe...@us...> - 2012-08-07 13:36:22
|
Revision: 160
http://ehs.svn.sourceforge.net/ehs/?rev=160&view=rev
Author: felfert
Date: 2012-08-07 13:36:13 +0000 (Tue, 07 Aug 2012)
Log Message:
-----------
- Removed last remnants of pcrepp dependency.
- regex stuff now taken from boost.
Modified Paths:
--------------
trunk/conf/ehs.spec.in
trunk/conf/mingw32-ehs.spec.in
trunk/configure.ac
trunk/ehs_development_guide.txt
trunk/httprequest.cpp
trunk/samples/ehs_formtest.cpp
Modified: trunk/conf/ehs.spec.in
===================================================================
--- trunk/conf/ehs.spec.in 2012-08-05 17:32:27 UTC (rev 159)
+++ trunk/conf/ehs.spec.in 2012-08-07 13:36:13 UTC (rev 160)
@@ -25,7 +25,7 @@
Source99: %{name}.rpmlintrc
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
-Buildrequires: openssl-devel, gcc-c++, pcre-devel, boost-devel
+Buildrequires: openssl-devel, gcc-c++, boost-devel
Buildrequires: doxygen, graphviz, automake, libtool
%if %{is_fc}
Modified: trunk/conf/mingw32-ehs.spec.in
===================================================================
--- trunk/conf/mingw32-ehs.spec.in 2012-08-05 17:32:27 UTC (rev 159)
+++ trunk/conf/mingw32-ehs.spec.in 2012-08-07 13:36:13 UTC (rev 160)
@@ -28,7 +28,6 @@
BuildRequires: mingw32-openssl
BuildRequires: mingw32-pthreads
BuildRequires: mingw32-boost-static
-BuildRequires: mingw32-pcre
BuildRequires: iscc
%description
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2012-08-05 17:32:27 UTC (rev 159)
+++ trunk/configure.ac 2012-08-07 13:36:13 UTC (rev 160)
@@ -67,12 +67,6 @@
])
dnl Checks for libraries.
-
-AC_ARG_WITH([pcre],AS_HELP_STRING([--with-pcre=DIR],[Specifies the location of the PCRE library]),
- [CPPFLAGS="$CPPFLAGS -I${withval}/include"
- CXXFLAGS="$CXXFLAGS -I${withval}/include"
- LDFLAGS="$LDFLAGS -L${withval}/lib"],[])
-
ac_cv_dllpath=
AC_ARG_WITH([dllpath],
AS_HELP_STRING([--with-dllpath=PATH],
@@ -80,20 +74,15 @@
[ac_cv_dllpath=$withval])
-dnl Replace `main' with a function in -lpcre:
BFDLIB1=
BFDLIB2=
DWLIB=
dnl The following headers have to be checked *before* invoking
-dnl AC_CHECK_LIB for pcrecpp, ssl and crypto in order for those
+dnl AC_CHECK_LIB for ssl and crypto in order for those
dnl checks to work correctly in mingw
-AC_CHECK_HEADERS([openssl/ssl.h openssl/err.h pcre.h])
-AC_LANG_PUSH([C++])
-AC_CHECK_HEADERS([pcrecpp.h])
-AC_LANG_POP
+AC_CHECK_HEADERS([openssl/ssl.h openssl/err.h])
-AC_CHECK_LIB(pcrecpp, main)
AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB(sokt, socket)
AC_CHECK_LIB(z, inflate)
Modified: trunk/ehs_development_guide.txt
===================================================================
--- trunk/ehs_development_guide.txt 2012-08-05 17:32:27 UTC (rev 159)
+++ trunk/ehs_development_guide.txt 2012-08-07 13:36:13 UTC (rev 160)
@@ -9,9 +9,9 @@
C++ class to have HTTP (web) server capabilities.
-How to build EHS (for UNIX):
+How to build EHS (on UNIX):
------------------
-./configure --with-ssl --enable-debug --enable-memory --enable-warn
+./configure --enable-warn
--with-ssl: compile with HTTPS support. Requires OpenSSL library installed.
If not specified, configure will enable SSL support automatically,
@@ -20,12 +20,12 @@
build a new application, but rather spammy.
--enable-warn: Enable additional compiler warnings
+For info about more options, run ./configure --help
+
Requirements:
--------------
-PCRECPP (Perl Compatible Regular Expressions for C++) can be found at
-http://www.pcre.org. EHS 1.4 was tested against version 7.8. Earlier and
-later versions may work as well, but have not been tested.
+Boost (libboost_regex)
OpenSSL is required for HTTPS support (./configure --with-ssl). It can be
found at http://www.openssl.org.
Modified: trunk/httprequest.cpp
===================================================================
--- trunk/httprequest.cpp 2012-08-05 17:32:27 UTC (rev 159)
+++ trunk/httprequest.cpp 2012-08-07 13:36:13 UTC (rev 160)
@@ -31,7 +31,6 @@
#include "ehsconnection.h"
#include "debug.h"
-#include <pcrecpp.h>
#include <string>
#include <algorithm>
#include <set>
@@ -134,18 +133,21 @@
string sHeaders(isSubbody, 0, nBlankLinePosition);
// First line MUST be the content-disposition header line, so that
// we know what the name of the field is.. otherwise, we're in trouble
- string sContentDisposition;
- string sNameValuePairs;
- pcrecpp::RE re("Content-Disposition:[ ]?([^;]+);[ ]?(.*)");
- if (re.PartialMatch(sHeaders, &sContentDisposition, &sNameValuePairs)) {
+ boost::smatch match;
+ boost::regex re("Content-Disposition:[ ]?([^;]+);[ ]?(.*)");
+ if (boost::regex_match(sHeaders, match, re)) {
+ string sContentDisposition(match[1]);
+ string sPairs(match[2]);
StringCaseMap oStringCaseMap;
- string sName;
- string sValue;
- pcrecpp::StringPiece nvp(sNameValuePairs);
- pcrecpp::RE nvre("[ ]?([^= ]+)=\"([^\"]+)\"[;]?");
- while (nvre.FindAndConsume(&nvp, &sName, &sValue)) {
+ boost::regex nvre("[ ]?([^= ]+)=\"([^\"]+)\"[;]?");
+ boost::sregex_iterator i(sPairs.begin(), sPairs.end(), nvre);
+ boost::sregex_iterator end;
+ while (i != end) {
+ string sName((*i)[1]);
+ string sValue((*i)[2]);
EHS_TRACE("Subbody header found: '%s' => '%s'", sName.c_str(), sValue.c_str());
oStringCaseMap[sName] = sValue;
+ ++i;
}
// Take oStringCaseMap and actually fill the right object with its data
@@ -156,7 +158,7 @@
roFormValue.m_sBody = isSubbody.substr(nBlankLinePosition + 4);
} else {
// couldn't find content-disposition line -- FATAL ERROR
- EHS_TRACE("ERROR: Couldn't find content-disposition line", "");
+ EHS_TRACE("ERROR: Couldn't find content-disposition line sHeaders='%s'", sHeaders.c_str());
return PARSESUBBODY_INVALIDSUBBODY;
}
return PARSESUBBODY_SUCCESS;
@@ -195,8 +197,8 @@
return PARSEMULTIPARTFORMDATA_FAILED;
}
- // go past the initial boundary
- string sRemainingBody = m_sBody.substr(blen);
+ // go past the initial boundary and it's terminating CRLF
+ string sRemainingBody = m_sBody.substr(blen + 2);
// while we're at a boundary after we grab a part, keep going
string::size_type nNextPartPosition;
Modified: trunk/samples/ehs_formtest.cpp
===================================================================
--- trunk/samples/ehs_formtest.cpp 2012-08-05 17:32:27 UTC (rev 159)
+++ trunk/samples/ehs_formtest.cpp 2012-08-07 13:36:13 UTC (rev 160)
@@ -64,7 +64,7 @@
}
cerr << "Got name of " << sName << endl;
- oss << "Hi " << sName << "</body></html>";
+ oss << "Hi " << sName << "<p><a href=\"/\">Back to login form</a></body></html>";
m_oNameList.push_back ( sName );
response->SetBody( oss.str().c_str(), oss.str().length() );
@@ -75,7 +75,7 @@
// otherwise, present the form to the user to fill in
cerr << "Got no form data" << endl;
- oss << "<p>Please log in</p>" << endl << "<form action = \"/\" method=\"GET\">" << endl
+ oss << "<p>Please log in</p>" << endl << "<form action = \"/\" method=\"POST\">" << endl
<< "User name: <input type=\"text\" name=\"user\"><br />" << endl
<< "<select name=\"existinguser\" width=\"20\">" << endl;
for ( StringList::iterator i = m_oNameList.begin(); i != m_oNameList.end ( ); ++i ) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|