CPPSERV


Home Projects Jobs Clientele Contact

cppserv


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Fixed src/container/HttpServletRequestImpl.cpp



From: Sergey Jukov <sergey@total-knowledge.com>

---
 ChangeLog                                |    3 +++
 src/container/HttpServletRequestImpl.cpp |   15 ++++++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fb2b0a8..84d7944 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2006.09.08        Sergey Jukov <sergey@total-knowledge>
+- Fix extra path issue in HttpServletImpl.cpp
+
 2006.08.23	  Ilya A. Volynets-Evenbakh <ilya@total-knowledge.com>
 - Fix few gcc-4 errors and warnings
 
diff --git a/src/container/HttpServletRequestImpl.cpp b/src/container/HttpServletRequestImpl.cpp
index 9eff32c..be8f9d9 100644
--- a/src/container/HttpServletRequestImpl.cpp
+++ b/src/container/HttpServletRequestImpl.cpp
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2004 by Ilya A. Volynets-Evenbakh                       *
+ *   Copyright (C) 2006 by Ilya A. Volynets-Evenbakh                       *
  *   ilya@total-knowledge.com                                              *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -76,6 +76,8 @@ HttpServletRequestImpl::~HttpServletRequ
 void container::HttpServletRequestImpl::getHeaders()
 {
 //Use stringstream here to parse...
+
+
 	std::string line;
 	getline(inputStream,line);
 	std::string::size_type i=line.find(' ');
@@ -85,11 +87,13 @@ void container::HttpServletRequestImpl::
 	std::transform(method.begin(),method.end(),method.begin(),util::ToUpper());
 	std::string::size_type j=++i;
 	i=line.find(' ',i);
+
 	if(i==std::string::npos)
 		return;
 	uri.assign(line, j, i-j);
 	protocol.assign(line, i+1, line.length()-i-1);
 	i=uri.find("://");
+
 	if(i==std::string::npos)
 		scheme="http";
 	else {
@@ -97,14 +101,14 @@ void container::HttpServletRequestImpl::
 		uri=uri.substr(i+3);
 	}
 	i=uri.find('?');
+
 	if(i!=std::string::npos){
 		queryString.assign(uri.substr(i+1));
 		uri.erase(i);
 	}
-	std::string servPath(getServletPath() + '/');
-	i=uri.find(servPath);
+	i=uri.find(servletName);
 	if(i!=std::string::npos){
-		pathInfo=uri.substr(i + servPath.length());
+		pathInfo=uri.substr(i + servletName.length());
 	}
 	std::transform(scheme.begin(),scheme.end(),scheme.begin(),util::ToLower());
 	serverPort=80;
@@ -642,7 +646,8 @@ std::string  HttpServletRequestImpl::get
 }
 std::string  HttpServletRequestImpl::getServletPath() const 
 {
-	return ctx->getServletContextName() + '/' + servletName;
+  	return ctx->getServletContextName() + '/' + servletName;
+
 }
 bool  HttpServletRequestImpl::isRequestedSessionIdValid() const 
 {
-- 
1.4.2


Authoright © Total Knowledge: 2001-2008