myserver-commit
[Top][All Lists]
Advanced

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

[myserver-commit] [2858] Added new `HttpReqSecurityDomain' class.


From: Giuseppe Scrivano
Subject: [myserver-commit] [2858] Added new `HttpReqSecurityDomain' class.
Date: Wed, 01 Oct 2008 19:43:36 +0000

Revision: 2858
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2858
Author:   gscrivano
Date:     2008-10-01 19:43:35 +0000 (Wed, 01 Oct 2008)

Log Message:
-----------
Added new `HttpReqSecurityDomain' class.

Modified Paths:
--------------
    branches/myserver_sec_new/include/conf/security/security_domain.h
    branches/myserver_sec_new/include/protocol/http/Makefile.am
    branches/myserver_sec_new/src/conf/security/security_domain.cpp
    branches/myserver_sec_new/src/protocol/http/Makefile.am
    branches/myserver_sec_new/tests/Makefile.am

Added Paths:
-----------
    branches/myserver_sec_new/include/protocol/http/http_req_security_domain.h
    branches/myserver_sec_new/tests/test_http_req_security_domain.cpp

Modified: branches/myserver_sec_new/include/conf/security/security_domain.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/security_domain.h   
2008-09-30 20:33:12 UTC (rev 2857)
+++ branches/myserver_sec_new/include/conf/security/security_domain.h   
2008-10-01 19:43:35 UTC (rev 2858)
@@ -29,6 +29,7 @@
 {
 public:
   SecurityDomain ();
+  SecurityDomain (const char* name);
   SecurityDomain (string &name);
   virtual ~SecurityDomain ();
   virtual string *getValue (string &name);

Modified: branches/myserver_sec_new/include/protocol/http/Makefile.am
===================================================================
--- branches/myserver_sec_new/include/protocol/http/Makefile.am 2008-09-30 
20:33:12 UTC (rev 2857)
+++ branches/myserver_sec_new/include/protocol/http/Makefile.am 2008-10-01 
19:43:35 UTC (rev 2858)
@@ -1,4 +1,4 @@
 httpincludedir=$(includedir)/myserver/include/protocol/http
-httpinclude_HEADERS = http_data_handler.h http_data_read.h http_errors.h 
http.h http_header_checker.h http_header.h http_headers.h http_request.h 
http_response.h http_thread_context.h
+httpinclude_HEADERS = http_data_handler.h http_data_read.h http_errors.h 
http.h http_header_checker.h http_header.h http_headers.h http_request.h 
http_req_security_domain.cpp http_response.h http_thread_context.h
 SUBDIRS = env
 

Added: 
branches/myserver_sec_new/include/protocol/http/http_req_security_domain.h
===================================================================
--- branches/myserver_sec_new/include/protocol/http/http_req_security_domain.h  
                        (rev 0)
+++ branches/myserver_sec_new/include/protocol/http/http_req_security_domain.h  
2008-10-01 19:43:35 UTC (rev 2858)
@@ -0,0 +1,42 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2008 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/>.
+*/
+
+#ifndef HTTP_REQ_SECURITY_DOMAIN_H
+#define HTTP_REQ_SECURITY_DOMAIN_H
+
+#include "stdafx.h"
+
+#include <include/conf/security/security_domain.h>
+#include <include/protocol/http/http_request.h>
+#include <string>
+
+using namespace std;
+
+class HttpReqSecurityDomain : public SecurityDomain
+{
+public:
+  HttpReqSecurityDomain (HttpRequestHeader *request);
+  virtual ~HttpReqSecurityDomain ();
+  virtual string *getValue (string &name);
+  HttpRequestHeader *getRequest () {return request;}
+protected:
+  HttpRequestHeader *request;
+  string name;
+};
+
+#endif

Modified: branches/myserver_sec_new/src/conf/security/security_domain.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/security_domain.cpp     
2008-09-30 20:33:12 UTC (rev 2857)
+++ branches/myserver_sec_new/src/conf/security/security_domain.cpp     
2008-10-01 19:43:35 UTC (rev 2858)
@@ -21,16 +21,20 @@
 
 SecurityDomain::SecurityDomain ()
 {
-  this->name.assign("");
+  this->name.assign ("");
 }
 
 SecurityDomain::SecurityDomain (string& name)
 {
-  this->name.assign(name);
+  this->name.assign (name);
 }
+SecurityDomain::SecurityDomain (const char* name)
+{
+  this->name.assign (name);
+}
 
 
-SecurityDomain::~SecurityDomain()
+SecurityDomain::~SecurityDomain ()
 {
 
 }

Modified: branches/myserver_sec_new/src/protocol/http/Makefile.am
===================================================================
--- branches/myserver_sec_new/src/protocol/http/Makefile.am     2008-09-30 
20:33:12 UTC (rev 2857)
+++ branches/myserver_sec_new/src/protocol/http/Makefile.am     2008-10-01 
19:43:35 UTC (rev 2858)
@@ -1,5 +1,5 @@
 lib_LIBRARIES = libhttp.a
-libhttp_a_SOURCES = http.cpp http_data_handler.cpp http_data_read.cpp 
http_errors.cpp http_header_checker.cpp http_headers.cpp http_request.cpp 
http_response.cpp http_thread_context.cpp
+libhttp_a_SOURCES = http.cpp http_data_handler.cpp http_data_read.cpp 
http_errors.cpp http_header_checker.cpp http_headers.cpp http_request.cpp 
http_req_security_domain.cpp http_response.cpp http_thread_context.cpp
 SUBDIRS = env
 INCLUDES = $(all_includes)
 

Modified: branches/myserver_sec_new/tests/Makefile.am
===================================================================
--- branches/myserver_sec_new/tests/Makefile.am 2008-09-30 20:33:12 UTC (rev 
2857)
+++ branches/myserver_sec_new/tests/Makefile.am 2008-10-01 19:43:35 UTC (rev 
2858)
@@ -2,5 +2,5 @@
 #
 
 bin_PROGRAMS = tests_suite
-tests_suite_SOURCES = main.cpp test_connection.cpp test_ftp.cpp 
test_log_manager.cpp test_mutex.cpp test_security_domain.cpp test_validator.cpp 
test_auth_domain.cpp test_connections_scheduler.cpp test_gzip.cpp 
test_log_stream_factory.cpp test_pipe.cpp test_security_manager.cpp 
test_validator_factory.cpp test_base64.cpp test_file_stream.cpp 
test_hashmap.cpp test_md5.cpp test_recursive_mutex.cpp test_semaphore.cpp 
test_xml.cpp test_cached_file_buffer.cpp test_file_stream_creator.cpp 
test_homedir.cpp test_mem_buff.cpp test_regex.cpp 
test_socket_stream_creator.cpp test_cached_file.cpp test_files_utility.cpp 
test_http_request.cpp test_mem_stream.cpp test_safetime.cpp test_thread.cpp 
test_cached_file_factory.cpp test_filter_chain.cpp test_http_response.cpp 
test_multicast.cpp test_security_cache.cpp test_utility.cpp  
test_xml_validator.cpp
+tests_suite_SOURCES = main.cpp test_connection.cpp test_ftp.cpp 
test_log_manager.cpp test_mutex.cpp test_security_domain.cpp test_validator.cpp 
test_auth_domain.cpp test_connections_scheduler.cpp test_gzip.cpp 
test_log_stream_factory.cpp test_pipe.cpp test_security_manager.cpp 
test_validator_factory.cpp test_base64.cpp test_file_stream.cpp 
test_hashmap.cpp test_md5.cpp test_recursive_mutex.cpp test_semaphore.cpp 
test_xml.cpp test_cached_file_buffer.cpp test_file_stream_creator.cpp 
test_homedir.cpp test_mem_buff.cpp test_regex.cpp 
test_socket_stream_creator.cpp test_cached_file.cpp test_files_utility.cpp 
test_http_request.cpp test_http_req_security_domain.cpp test_mem_stream.cpp 
test_safetime.cpp test_thread.cpp test_cached_file_factory.cpp 
test_filter_chain.cpp test_http_response.cpp test_multicast.cpp 
test_security_cache.cpp test_utility.cpp  test_xml_validator.cpp
 tests_suite_LDADD = ../src/libmyserver.a $(CPPUNIT_LDFLAGS) $(PTHREAD_LIB) 
$(IDN_LIB) $(XNET_LIB) $(EVENT_LIB) $(DL_LIB) $(OPENSSL_LIB) $(ZLIB_LIB) 
$(XML_LIBS) $(LDFLAGS)

Added: branches/myserver_sec_new/tests/test_http_req_security_domain.cpp
===================================================================
--- branches/myserver_sec_new/tests/test_http_req_security_domain.cpp           
                (rev 0)
+++ branches/myserver_sec_new/tests/test_http_req_security_domain.cpp   
2008-10-01 19:43:35 UTC (rev 2858)
@@ -0,0 +1,82 @@
+/*
+ MyServer
+ Copyright (C) 2008 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 <ctype.h>
+
+#include <string.h>
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <include/protocol/http/http_req_security_domain.h>
+
+#include <iostream>
+using namespace std;
+
+class TestHttpReqSecurityDomain : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( TestHttpReqSecurityDomain );
+  CPPUNIT_TEST( testConstructor );
+  CPPUNIT_TEST( testGetValue );
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+  void setUp()
+  {
+
+  }
+
+  void tearDown()
+  {
+
+  }
+
+
+  void testConstructor ()
+  {
+    HttpRequestHeader req;
+    HttpReqSecurityDomain *dom = new  HttpReqSecurityDomain (&req);
+
+    CPPUNIT_ASSERT_EQUAL (&req, dom->getRequest ());
+
+    delete dom;
+  }
+
+
+  void testGetValue ()
+  {
+    HttpRequestHeader req;
+    const char *name = "My-Header";
+    const char *value = "foo-bar";
+    string nameStr (name);
+    HttpReqSecurityDomain *dom = new  HttpReqSecurityDomain (&req);
+
+    req.setValue (name, value);
+
+    string *ret = dom->getValue (nameStr);
+
+    CPPUNIT_ASSERT_EQUAL (ret->compare (value), 0);
+
+    delete dom;
+  }
+
+};
+
+
+CPPUNIT_TEST_SUITE_REGISTRATION( TestHttpReqSecurityDomain );






reply via email to

[Prev in Thread] Current Thread [Next in Thread]