Bug #3668 » wt-3.3.4-rc1-gnu-regex-fcgi.patch
src/fcgi/Server.C | ||
---|---|---|
#include <csignal>
|
||
#include <fstream>
|
||
#include <boost/regex.hpp>
|
||
#include <boost/lexical_cast.hpp>
|
||
#include <exception>
|
||
#include <vector>
|
||
#ifdef WT_HAVE_GNU_REGEX
|
||
#include <regex.h>
|
||
#include <stdio.h>
|
||
#else
|
||
#include <boost/regex.hpp>
|
||
#endif // WT_HAVE_GNU_REGEX
|
||
#include "fcgiapp.h"
|
||
#include "Configuration.h"
|
||
#include "FCGIRecord.h"
|
||
... | ... | |
{
|
||
Configuration& conf = wt_.configuration();
|
||
#ifdef WT_HAVE_GNU_REGEX
|
||
char regex_str[40];
|
||
static bool regex_ready = false;
|
||
static regex_t preg;
|
||
if (!regex_ready) {
|
||
regex_ready = true;
|
||
snprintf(regex_str, sizeof(regex_str), ".*wtd=([a-zA-Z0-9]{%d}).*",
|
||
conf.sessionIdLength());
|
||
regcomp(&preg, regex_str, REG_EXTENDED);
|
||
}
|
||
regmatch_t match[2];
|
||
if (!regexec(&preg, queryString.c_str(), 2, match, 0)) {
|
||
sessionId.assign(queryString, match[1].rm_so,
|
||
match[1].rm_eo - match[1].rm_so);
|
||
return true;
|
||
}
|
||
#else
|
||
static const boost::regex
|
||
session_e(".*wtd=([a-zA-Z0-9]{"
|
||
+ boost::lexical_cast<std::string>(conf.sessionIdLength())
|
||
... | ... | |
sessionId = what[1];
|
||
return true;
|
||
}
|
||
#endif
|
||
return false;
|
||
}
|