mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-16 07:56:12 +03:00
Updated with suggestions from @zimmerle for code style
This commit is contained in:
parent
b3ab9a4084
commit
e38a468a26
14
src/assay.cc
14
src/assay.cc
@ -286,24 +286,24 @@ int Assay::processURI(const char *uri, const char *protocol,
|
|||||||
m_collections.store("REQUEST_PROTOCOL",
|
m_collections.store("REQUEST_PROTOCOL",
|
||||||
"HTTP/" + std::string(http_version));
|
"HTTP/" + std::string(http_version));
|
||||||
|
|
||||||
std::string parsedURI = uri;
|
std::string parsedURI = uri;
|
||||||
// The more popular case is without domain
|
// The more popular case is without domain
|
||||||
if (m_uri_decoded.at(1) != '/'){
|
if (!m_uri_decoded.empty() && m_uri_decoded.at(1) != '/') {
|
||||||
bool fullDomain = true;
|
bool fullDomain = true;
|
||||||
size_t scheme = m_uri_decoded.find(":")+1;
|
size_t scheme = m_uri_decoded.find(":")+1;
|
||||||
if(scheme==std::string::npos){
|
if (scheme==std::string::npos) {
|
||||||
fullDomain = false;
|
fullDomain = false;
|
||||||
}
|
}
|
||||||
// Searching with a pos of -1 is undefined we also shortcut
|
// Searching with a pos of -1 is undefined we also shortcut
|
||||||
if(scheme != std::string::npos and fullDomain == true){
|
if (scheme != std::string::npos and fullDomain == true) {
|
||||||
// Assuming we found a colon make sure its followed
|
// Assuming we found a colon make sure its followed
|
||||||
size_t netloc = m_uri_decoded.find("//",scheme)+2;
|
size_t netloc = m_uri_decoded.find("//",scheme)+2;
|
||||||
if(netloc==std::string::npos or (netloc != scheme+2)){
|
if (netloc==std::string::npos or (netloc != scheme+2)) {
|
||||||
fullDomain = false;
|
fullDomain = false;
|
||||||
}
|
}
|
||||||
if(netloc != std::string::npos and fullDomain == true){
|
if (netloc != std::string::npos and fullDomain == true) {
|
||||||
size_t path = m_uri_decoded.find("/",netloc);
|
size_t path = m_uri_decoded.find("/",netloc);
|
||||||
if(path != std::string::npos and fullDomain == true){
|
if (path != std::string::npos and fullDomain == true) {
|
||||||
parsedURI = m_uri_decoded.substr(path);
|
parsedURI = m_uri_decoded.substr(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user