Boost logo

Boost-Commit :

From: lists.drrngrvy_at_[hidden]
Date: 2008-03-31 16:14:55


Author: drrngrvy
Date: 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
New Revision: 43976
URL: http://svn.boost.org/trac/boost/changeset/43976

Log:
Merged revisions 43936-43975 via svnmerge from
https://svn.boost.org/svn/boost/sandbox/SOC/2007/cgi/trunk

........
  r43973 | drrngrvy | 2008-03-31 21:02:15 +0100 (Mon, 31 Mar 2008) | 1 line
  
  Fixing cookie game example.
........
  r43974 | drrngrvy | 2008-03-31 21:06:39 +0100 (Mon, 31 Mar 2008) | 1 line
  
  Modifying jamfiles to make compiling examples easier.
........
  r43975 | drrngrvy | 2008-03-31 21:08:24 +0100 (Mon, 31 Mar 2008) | 1 line
  
  Modified CGI stuff to not use std::cout/cin/cerr, removing the dependence on <iostream> and reducing binary size a fair bit (seemingly making things faster too).
........

Added:
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/Jamfile.v2
      - copied unchanged from r43975, /sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/Jamfile.v2
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/hello_world/
      - copied from r43975, /sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/hello_world/Jamfile.v2
      - copied unchanged from r43975, /sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/Jamfile.v2
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/hello_world/doc.qbk
      - copied unchanged from r43975, /sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/doc.qbk
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/hello_world/main.cpp
      - copied unchanged from r43975, /sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/main.cpp
Properties modified:
   sandbox/SOC/2007/cgi/branches/release/ (props changed)
Text files modified:
   sandbox/SOC/2007/cgi/branches/release/boost/cgi/basic_request.hpp | 18 +++++
   sandbox/SOC/2007/cgi/branches/release/boost/cgi/connections/stdio.hpp | 36 ++++++++++-
   sandbox/SOC/2007/cgi/branches/release/boost/cgi/data_source.hpp | 14 +++-
   sandbox/SOC/2007/cgi/branches/release/boost/cgi/detail/cgi_request_impl_base.hpp | 2
   sandbox/SOC/2007/cgi/branches/release/boost/cgi/detail/cgi_service_impl_base.hpp | 120 +++++++++++++++++++--------------------
   sandbox/SOC/2007/cgi/branches/release/boost/cgi/error.hpp | 9 ++
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/Jamfile.v2 | 47 +++++++++------
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/Jamfile.v2 | 49 +++++++++-------
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/amortization/Jamfile.v2 | 14 ++++
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/cookie_game/Jamfile.v2 | 7 +-
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/cookie_game/main.cpp | 6 +-
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/echo/Jamfile.v2 | 12 ++-
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/echo/main.cpp | 4
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/hello_world/Jamfile.v2 | 3
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/cgi/Jamfile.v2 | 41 +++++--------
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/cgi/echo/Jamfile.v2 | 8 --
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/cgi/hello_world/Jamfile.v2 | 2
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/echo/Jamfile.v2 | 2
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/server1/Jamfile.v2 | 2
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/server2/Jamfile.v2 | 2
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/server3/Jamfile.v2 | 2
   sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/server4/Jamfile.v2 | 2
   22 files changed, 235 insertions(+), 167 deletions(-)

Modified: sandbox/SOC/2007/cgi/branches/release/boost/cgi/basic_request.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/boost/cgi/basic_request.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/release/boost/cgi/basic_request.hpp 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -16,7 +16,6 @@
 
 #include "boost/cgi/detail/push_options.hpp"
 
-#include <iostream>
 #include <boost/noncopyable.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/assert.hpp>
@@ -29,7 +28,7 @@
 #include "boost/cgi/detail/protocol_traits.hpp"
 #include "boost/cgi/request_base.hpp"
 #include "boost/cgi/role_type.hpp"
-#include "boost/cgi/data_sink.hpp"
+#include "boost/cgi/data_source.hpp"
 #include "boost/cgi/status_type.hpp"
 #include "boost/cgi/is_async.hpp"
 #include "boost/cgi/connection_base.hpp"
@@ -648,6 +647,21 @@
     {
       return this->implementation.boundary_marker;
     }
+
+ map_type& operator[](common::data_source source)
+ {
+ switch(source)
+ {
+ case get_data: return this->implementation.get_vars_;
+ case post_data: return this->implementation.post_vars_;
+ case cookie_data: return this->implementation.cookie_vars_;
+ case env_data: return this->implementation.env_vars_;
+ case form_data:
+ std::string rm( request_method() );
+ if (rm == "GET") return this->implementation.get_vars_;
+ else if (rm == "POST") return this->implementation.post_vars_;
+ }
+ }
   };
 
  } // namespace common

Modified: sandbox/SOC/2007/cgi/branches/release/boost/cgi/connections/stdio.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/boost/cgi/connections/stdio.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/release/boost/cgi/connections/stdio.hpp 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -9,9 +9,7 @@
 #ifndef CGI_STDIO_CONNECTION_IMPL_HPP_INCLUDED__
 #define CGI_STDIO_CONNECTION_IMPL_HPP_INCLUDED__
 
-#include <iostream>
-#include <istream>
-#include <ostream>
+#include <cstdio>
 #include <string>
 #include <boost/system/error_code.hpp>
 #include <boost/asio.hpp>
@@ -19,7 +17,7 @@
 #include "boost/cgi/basic_connection_fwd.hpp"
 #include "boost/cgi/tags.hpp"
 #include "boost/cgi/connection_base.hpp"
-#include "boost/cgi/data_sink.hpp"
+#include "boost/cgi/error.hpp"
 //#include "boost/cgi/io_service.hpp"
 
 namespace cgi {
@@ -75,6 +73,7 @@
       // << "before = {" << std::endl
       // << std::string(boost::asio::buffer_cast<char *>(buf), boost::asio::buffer_size(buf)) << std::endl
       // << "}" << std::endl;
+ /*
       std::cin.read(boost::asio::buffer_cast<char *>(buf)
                    , boost::asio::buffer_size(buf));
       if (std::cin.fail() && !std::cin.eof())
@@ -87,6 +86,24 @@
       // << std::string(boost::asio::buffer_cast<char *>(buf), boost::asio::buffer_size(buf)) << std::endl
       // << "}" << std::endl;
       return std::cin.gcount();
+ */
+ if (!std::fgets(boost::asio::buffer_cast<char *>(buf)
+ , boost::asio::buffer_size(buf)
+ , stdin))
+ {
+ return ::cgi::error::bad_read;
+ }
+ int len( strlen(boost::asio::buffer_cast<char *>(buf)) );
+ // Not sure what to do about EOF yet.
+ //if (len < boost::asio::buffer_size(buf))
+ //{
+ // return ::cgi::error::eof;
+ //}
+ std::cerr<< "Read data" << std::endl
+ << "after = {" << std::endl
+ << std::string(boost::asio::buffer_cast<char *>(buf), boost::asio::buffer_size(buf)) << std::endl
+ << "}" << std::endl;
+ return len;
     }
 
     template<typename ConstBufferSequence>
@@ -99,7 +116,16 @@
       {
         std::size_t buf_len = boost::asio::buffer_size(*i);
         bytes_transferred += buf_len;
- std::cout.write(boost::asio::buffer_cast<const char*>(*i), buf_len);
+ int ret( fputs(boost::asio::buffer_cast<const char*>(*i), stdout) );
+ if (ret == EOF)
+ {
+ return ::cgi::error::broken_pipe;
+ }
+ //else
+ //if (ret < 0)
+ //{
+ // return ::cgi::error::
+ //std::cout.write(boost::asio::buffer_cast<const char*>(*i), buf_len);
       }
       return bytes_transferred;
     }

Modified: sandbox/SOC/2007/cgi/branches/release/boost/cgi/data_source.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/boost/cgi/data_source.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/release/boost/cgi/data_source.hpp 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -14,11 +14,17 @@
   enum source
   { stdin_ };
 
- namespace data_source {
+ namespace common {
 
- //struct stdin_ {};
-
- } // namespace data_source
+ enum data_source
+ { get_data
+ , post_data
+ , cookie_data
+ , env_data
+ , form_data
+ };
+
+ } // namespace common
 } // namespace cgi
 
 #endif // CGI_DATA_SOURCE_HPP_INCLUDED__

Modified: sandbox/SOC/2007/cgi/branches/release/boost/cgi/detail/cgi_request_impl_base.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/boost/cgi/detail/cgi_request_impl_base.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/release/boost/cgi/detail/cgi_request_impl_base.hpp 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -68,7 +68,7 @@
     conn_ptr& connection() { return connection_; }
     //std::string& null_str() { return null_str_; }
 
- protected:
+ public:
     //conn_ptr connection() { return connection_; }
 
     //friend class cgi_service_impl_base<RequestImpl>;

Modified: sandbox/SOC/2007/cgi/branches/release/boost/cgi/detail/cgi_service_impl_base.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/boost/cgi/detail/cgi_service_impl_base.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/release/boost/cgi/detail/cgi_service_impl_base.hpp 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -5,7 +5,6 @@
 
 #include <string>
 #include <cstdlib>
-#include <iostream>
 #include <boost/assert.hpp>
 #include <boost/regex.hpp>
 #include <boost/tokenizer.hpp>
@@ -31,9 +30,6 @@
 
  } // namespace detail
 
- using std::cerr; // **FIXME**
- using std::endl; // **FIXME**
-
 
   template<typename RequestImplType>
   class cgi_service_impl_base
@@ -110,7 +106,7 @@
       {
         
         std::size_t bufsz( buf_.size() );
- cerr<< "bufsz = " << bufsz << endl;
+ //cerr<< "bufsz = " << bufsz << endl;
 
         // Reserve more space if it's needed.
         // (this could be safer, referencing this against CONTENT_LENGTH)
@@ -119,13 +115,13 @@
           buf_.resize(bufsz + size);
         //}
 
- cerr<< "Pre-read buffer (size: " << buf_.size()
- << "|capacity: " << buf_.capacity() << ") == {" << endl
- << std::string(buf_.begin() + offset_, buf_.end()) << endl
+ //cerr<< "Pre-read buffer (size: " << buf_.size()
+ // << "|capacity: " << buf_.capacity() << ") == {" << endl
+ // << std::string(buf_.begin() + offset_, buf_.end()) << endl
    // << "-----end buffer-----" << endl
    // << "-------buffer-------" << endl
   // << std::string(&buf_[0], &buf_[buf_.size()]) << endl
- << "}" << endl;
+ // << "}" << endl;
             ;
         //return boost::asio::buffer(&(*(buf_.end())), size);
   // return boost::asio::buffer(&(*(buf_.begin())) + bufsz, size);
@@ -473,7 +469,7 @@
       //parse_one_form_part(impl, ec);
       move_to_start_of_first_part(impl, ec);
       if (ec == boost::asio::error::eof) {
- cerr<< " -- Parsing done -- " << endl;
+ //cerr<< " -- Parsing done -- " << endl;
         //return ec.clear();
         return boost::system::error_code();
       }
@@ -519,7 +515,7 @@
       }
       
       regex += ")(--)?[ ]*\\x0D\\x0A";
- cerr<< "Regex: " << regex << endl;
+ //cerr<< "Regex: " << regex << endl;
       boost::regex re(regex);
       
       typedef typename
@@ -529,7 +525,7 @@
       boost::match_results<buffer_iter> matches;
 
       std::size_t offset = impl.offset_;
- cerr<< "offset = " << offset << endl;
+ //cerr<< "offset = " << offset << endl;
 
       //int runs = 0;
       buffer_iter begin(impl.buf_.begin() + offset);
@@ -537,14 +533,14 @@
 
       for(;;)
       {
- cerr<< "Starting regex_search" << endl;
+ //cerr<< "Starting regex_search" << endl;
         if (!boost::regex_search(begin, end, matches, re
                                 , boost::match_default
                                 | boost::match_partial))
         {
- cerr<< "Can't match any of this. {" << endl
- << std::string(begin, end) << endl
- << "}" << endl;
+ // cerr<< "Can't match any of this. {" << endl
+ // << std::string(begin, end) << endl
+ // << "}" << endl;
           return boost::system::error_code(345, boost::system::system_category);
         }
         else
@@ -553,9 +549,9 @@
           {
             if (matches[i].length())
             {
- cerr<< "[" << i << "] == {" << endl
- << matches[i] << endl
- << "}" << endl;
+ // cerr<< "[" << i << "] == {" << endl
+ // << matches[i] << endl
+ // << "}" << endl;
             }
           }
           // cerr<< "matches[0] = {" << endl
@@ -566,15 +562,15 @@
             impl.form_parts_.back().buffer_
              // = boost::range_iterator<;
              = std::make_pair(matches[1].first, matches[1].second);
- cerr<< "Saved buffer (size: "
- << std::distance(matches[1].first, matches[1].second)
- << ") := { " << impl.form_parts_.back().name << ", " << matches[1] << " }" << endl;
+ // cerr<< "Saved buffer (size: "
+ // << std::distance(matches[1].first, matches[1].second)
+ // << ") := { " << impl.form_parts_.back().name << ", " << matches[1] << " }" << endl;
             impl.post_vars()[impl.form_parts_.back().name] = matches[1];
             impl.offset_ = offset + matches[0].length();
             //offset += matches[0].length();
             impl.pos_ = matches[0].second;
- cerr<< "offset := " << offset << endl
- << "impl.offset_ := " << impl.offset_ << endl;
+ //cerr<< "offset := " << offset << endl
+ // << "impl.offset_ := " << impl.offset_ << endl;
 
             if (matches[3].matched)
               impl.stdin_parsed_ = true;
@@ -587,7 +583,7 @@
           }
           else
           {
- cerr<< "Reading more data." << endl;
+ //cerr<< "Reading more data." << endl;
             std::size_t bytes_read = impl.client_.read_some(impl.prepare(64), ec);
             //impl.stdin_bytes_read_ += bytes_read;
             
@@ -599,13 +595,13 @@
 
             begin = impl.buf_.begin() + offset;
             end = impl.buf_.end();
- cerr<< "Buffer (+" << bytes_read << ") == {" << endl
- << std::string(begin, end) << endl
- << "}" << endl;
+ //cerr<< "Buffer (+" << bytes_read << ") == {" << endl
+ // << std::string(begin, end) << endl
+ // << "}" << endl;
 
             if (ec)
             {
- cerr<< "Error in parse_form_part_data()." << endl;
+ //cerr<< "Error in parse_form_part_data()." << endl;
               return ec;
             }
 
@@ -678,10 +674,10 @@
> matches;
       
       std::size_t offset = impl.offset_;
- cerr.flush();
+ //cerr.flush();
       impl.pos_ = impl.buf_.begin();
       int runs = 0;
- cerr<< "Entering for() loop." << endl;
+ //cerr<< "Entering for() loop." << endl;
       std::size_t bytes_read = 0;
       for(;;)
       {
@@ -691,18 +687,18 @@
         if (!boost::regex_search(begin, end, matches, re
                                 , boost::match_default | boost::match_partial))
         {
- cerr<< "No chance of a match, quitting." << endl;
+ //cerr<< "No chance of a match, quitting." << endl;
           impl.stdin_parsed_ = true;
           return ec;
         }
- cerr<< "matches.str() == {" << endl
- << matches.str() << endl
- << "}" << endl
- << matches.size() << " submatches" << endl;
- for (unsigned i = matches.size(); i != 0; --i)
- {
- cerr<< "match[" << i << "] := { " << matches[i] << " }" << endl;
- }
+ //cerr<< "matches.str() == {" << endl
+ // << matches.str() << endl
+ // << "}" << endl
+ // << matches.size() << " submatches" << endl;
+ // for (unsigned i = matches.size(); i != 0; --i)
+ // {
+ //cerr<< "match[" << i << "] := { " << matches[i] << " }" << endl;
+ //}
         if (matches[0].matched)
         {
           common::form_part part;
@@ -715,13 +711,13 @@
            if (matches[i].str() == "name")
             {
               part.name = matches[i+1];
- cerr<< "Saved name" << endl;
+ // cerr<< "Saved name" << endl;
             }
             else
             {
               part.meta_data_[matches[i]]
                 = std::make_pair(matches[i+1].first, matches[i+1].second);
- cerr<< "Part := { " << matches[i] << ", " << matches[i+1] << " }" << endl;
+ // cerr<< "Part := { " << matches[i] << ", " << matches[i+1] << " }" << endl;
               //= boost::iterator_range<buffer_iter>(matches[3].first, matches[3].second);
             }
             impl.form_parts_.push_back(part);
@@ -738,7 +734,7 @@
            //cerr<< "Current buffer == {" << endl
            // << impl.buffer_string() << endl
            // << "}" << endl;
- cerr<< "Leaving parse_form_part_meta_data()" << endl;
+ //cerr<< "Leaving parse_form_part_meta_data()" << endl;
            return ec;
          }
          else
@@ -747,18 +743,18 @@
          }
          
         }else{
- cerr<< "Not read enough data yet, reading more." << endl;
+ // cerr<< "Not read enough data yet, reading more." << endl;
           bytes_read = impl.client_.read_some(impl.prepare(64), ec);
           if (ec)
           {
- cerr<< "Error reading data: " << ec.message() << endl;
- cerr<< "Leaving parse_form_part_meta_data()" << endl;
+ // cerr<< "Error reading data: " << ec.message() << endl;
+ // cerr<< "Leaving parse_form_part_meta_data()" << endl;
             return ec;
           }
- cerr<< "Read " << bytes_read << " bytes." << endl;
- cerr<< "buffer = {" << endl
- << impl.buffer_string() << endl
- << "} or {" << endl;
+ // cerr<< "Read " << bytes_read << " bytes." << endl;
+ //cerr<< "buffer = {" << endl
+ // << impl.buffer_string() << endl
+ // << "} or {" << endl;
               //<< std::string(impl.pos_, ;
           /*
           for (unsigned int i = 0; i < matches.size(); ++i)
@@ -777,13 +773,13 @@
           //offset = impl.buf_.end();
             if (++runs > 40)
             {
- cerr<< "Run 40 times; bailing out." << endl;
+ // cerr<< "Run 40 times; bailing out." << endl;
               break;
             }
- cerr<< "Waiting buffer (unparsed) == {" << endl << std::flush
- << impl.buffer_string() << endl
- << "}" << endl
- << "offset = " << offset << endl;
+ // cerr<< "Waiting buffer (unparsed) == {" << endl << std::flush
+ // << impl.buffer_string() << endl
+ // << "}" << endl
+ // << "offset = " << offset << endl;
         //if (bytes_read == 0)
         // break;
        }
@@ -791,7 +787,7 @@
 
       //cerr<< "impl.part
 
- cerr<< "Leaving parse_form_part_meta_data()" << endl;
+ // cerr<< "Leaving parse_form_part_meta_data()" << endl;
       return ec;
     }
 
@@ -843,7 +839,7 @@
           //std::cerr<< " == buffer = " << std::string(impl.buf_.begin(), impl.buf_.end())
           // << " == capacity = " << impl.buf_.capacity() << " ======= ";
           //impl.buf_.clear();
- cerr<< "No chance of matching." << endl;
+ // cerr<< "No chance of matching." << endl;
           offset = impl.buf_.size();
           //std::cerr<< "Buffer cleared." << endl;
           continue;
@@ -855,7 +851,7 @@
           // << "matches[1] =={{ " << matches[1] << " }}=== " << std::endl
           // << "matches[2] =={{ " << matches[2] << " }}=== " << std::endl;
           if (matches[2].matched){
- cerr<< "Found boundary marker... OK!!" << endl;
+ // cerr<< "Found boundary marker... OK!!" << endl;
             //cerr<< "[0] = " << matches[0].str() << endl;
             //cerr<< "[1] = " << matches[1].str() << endl;
             //impl.offset_ = matches[1].length();
@@ -871,15 +867,15 @@
             // << "}" << endl;
             //cerr<< "bufsize = " << impl.buf_.size() << endl;
             //cerr<< "bufsize = " << impl.buf_.size() << endl;
- cerr<< "buffer now (before erase) == {" << endl
- << std::string(impl.buf_.begin(), impl.buf_.end()) << endl
- << "}" << endl;
+ // cerr<< "buffer now (before erase) == {" << endl
+ // << std::string(impl.buf_.begin(), impl.buf_.end()) << endl
+ // << "}" << endl;
             impl.buf_.erase(impl.buf_.begin(), matches[0].second);
             impl.offset_ = 0;
             impl.pos_ = impl.buf_.begin();
             return ec;
           } else {
- cerr<< "not read enough data" << std::endl;
+ // cerr<< "not read enough data" << std::endl;
       //std::cerr<< "; bytes_read = " << bytes_read
         // << "; bufsize = " << impl.buf_.size()
           // << "; capacity = " << impl.buf_.capacity() << std::flush

Modified: sandbox/SOC/2007/cgi/branches/release/boost/cgi/error.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/boost/cgi/error.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/release/boost/cgi/error.hpp 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -50,7 +50,14 @@
   // allowed.
   accepting_on_an_open_request,
 
- invalid_socket
+ invalid_socket,
+
+ // Used in basic_connection<tags::stdio>
+ // **FIXME**
+ broken_pipe,
+
+ // **FIXME**
+ bad_read
 };
 
   namespace detail {

Modified: sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/Jamfile.v2 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -4,32 +4,43 @@
 # (See accompanying file LICENSE_1_0.txt or copy
 # at http://www.boost.org/LICENSE_1_0.txt)
 
-project boost.cgi.examples
- : requirements
+project boost/cgi/example
+: requirements
       <library>/boost/system/
       <library>/boost/thread/
   ;
 
-# Install all of the acgi examples
-install acgi
+# Build all of the cgi examples
+build-project cgi ;
+# Build all of the acgi examples
+build-project acgi ;
+# Build all of the fcgi examples
+build-project fcgi ;
+
+install cgi-install
+ : # sources
+ cgi//install
+ :
+ <location>$(cgi-bin)
+ ;
+
+install acgi-install
  : # sources
    acgi//install
  :
    <location>$(cgi-bin)
  ;
 
-explicit acgi ;
+install fcgi-install
+ :
+ fcgi//install
+ :
+ <location>$(fcgi-bin)
+ ;
+
+explicit cgi-install ;
+explicit acgi-install ;
+explicit fcgi-install ;
+
+explicit install ;
 
-#install examples
-# : # the sources
-# ecgi
-# acgi
-# #reply
-# : <location>/var/www/cgi-bin
-# ;
-
-#install scgi
-# : # the sources
-# scgi
-# : <location>/var/www/scgi-bin
-# ;

Modified: sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/Jamfile.v2 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -1,21 +1,28 @@
-# Copyright (c) 2007 Darren Garvey
-#
-# Distributed under the Boost Software License, Version 1.0.
-# (See accompanying file LICENSE_1_0.txt or copy
-# at http://www.boost.org/LICENSE_1_0.txt)
-
-project boost.cgi.examples.acgi ;
-
-# Install all acgi examples to the user-provided variable "cgi-bin"
-install install
- :
- hello_world
- echo
- cookie_game
- login
- :
- <location>$(cgi-bin)
- ;
-
-# Only install example if you use `bjam install' or equivalent
-explicit install ;
+# Copyright (c) 2007 Darren Garvey
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy
+# at http://www.boost.org/LICENSE_1_0.txt)
+
+project boost/cgi/example/acgi ;
+
+# By default, just build the examples
+build-project hello_world ;
+build-project echo ;
+build-project cookie_game ;
+build-project amortization ;
+
+# If the user explicitly passes "install" on the command line, build the
+# CGI examples and copy them to $(cgi-bin)
+install install
+ :
+ hello_world
+ echo
+ cookie_game
+ amortization
+ :
+ <location>$(cgi-bin)
+ ;
+
+explicit install ;
+

Modified: sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/amortization/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/amortization/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/amortization/Jamfile.v2 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -5,7 +5,7 @@
 # at http://www.boost.org/LICENSE_1_0.txt)
 
 # A symbolic name for this project.
-project boost.cgi.examples.acgi.amortization ;
+project boost/cgi/example/acgi/amortization ;
 
 import os ;
 
@@ -30,7 +30,7 @@
   ;
 
 # Our install rule (builds binaries and copies them to <location>)
-install install
+install install-app
  :
    acgi_amort
    acgi_amort.tpl
@@ -48,5 +48,15 @@
    <location>$(htdocs)
  ;
 
+explicit install-app ;
+explicit install-extra ;
+
+install install
+ :
+ install-app
+ install-extra
+ ;
+
 # Only install example if you use `bjam install' or equivalent
 explicit install ;
+

Modified: sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/cookie_game/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/cookie_game/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/cookie_game/Jamfile.v2 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -4,15 +4,14 @@
 # (See accompanying file LICENSE_1_0.txt or copy
 # at http://www.boost.org/LICENSE_1_0.txt)
 
-project boost.cgi.examples.acgi.cookie_game
- ;
+project boost/cgi/example/acgi/cookie_game ;
 
-exe acgi : main.cpp ;
+exe acgi_cookie_game : main.cpp /boost/regex/ ;
 
 # Our install rule (builds binaries and copies them to <location>)
 install install
   :
- acgi
+ acgi_cookie_game
   :
     <location>$(cgi-bin)
   ;

Modified: sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/cookie_game/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/cookie_game/main.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/cookie_game/main.cpp 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -60,7 +60,7 @@
   }
 
   // First, see if they have a cookie set
- std::string& name = req.cookie()["name"];
+ std::string name = req[cookie_data]["name"];
   if (!name.empty())
   {
     resp<< header("Content-type", "text/html")
@@ -71,7 +71,7 @@
   }
 
   // Now we'll check if they sent us a name in a form
- name = req.form("name");
+ name = req[form_data]["name"];
   if (!name.empty())
   {
     resp<< header("Content-type", "text/html")
@@ -92,7 +92,7 @@
   std::cerr.flush();
 
   resp<< "<form method='POST'>"
- "<input name='name' type='text' value='" << req.form("name") << "'>"
+ "<input name='name' type='text' value='" << req[form_data]["name"] << "'>"
          "</input>"
          "<input type='submit'></input>"
          "</form>"

Modified: sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/echo/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/echo/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/echo/Jamfile.v2 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -4,17 +4,21 @@
 # (See accompanying file LICENSE_1_0.txt or copy
 # at http://www.boost.org/LICENSE_1_0.txt)
 
-exe acgi_form_test
- : main.cpp
+project boost/cgi/example/acgi/echo ;
+
+exe acgi_echo
+ :
+ main.cpp
     /boost/regex/
     /boost/thread/
   ;
 
 # Our install rule (builds binaries and copies them to <location>)
 install install
- : acgi_form_test
  :
- <location>$(cgi-bin)
+ acgi_echo
+ :
+ <location>$(cgi-bin)
  ;
 
 # Only install example if you use `bjam install' or equivalent

Modified: sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/echo/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/echo/main.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/echo/main.cpp 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -23,12 +23,12 @@
 
 // This function writes the title and map contents to the ostream in an
 // HTML-encoded format (to make them easier on the eye).
-template<typename OStream, Ttypename MapT>
+template<typename OStreamT, typename MapT>
 void show_map_contents(OStreamT& os, MapT& m, const std::string& title)
 {
   os<< "<h3>" << title << "</h3>";
   if (m.empty()) os<< "NONE<br />";
- for (typename MapT::iterator i = m.begin(); i != m.end(); ++i)
+ for (typename MapT::const_iterator i = m.begin(); i != m.end(); ++i)
   {
     os<< "<b>" << i->first << "</b> = <i>" << i->second << "</i><br />";
   }

Modified: sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/hello_world/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/hello_world/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/hello_world/Jamfile.v2 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -4,8 +4,7 @@
 # (See accompanying file LICENSE_1_0.txt or copy
 # at http://www.boost.org/LICENSE_1_0.txt)
 
-project boost.cgi.examples.acgi.hello_world
- ;
+project boost/cgi/example/acgi/hello_world ;
 
 exe acgi_hello_world : main.cpp /boost/regex/ ;
 

Modified: sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/cgi/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/cgi/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/cgi/Jamfile.v2 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -4,35 +4,28 @@
 # (See accompanying file LICENSE_1_0.txt or copy
 # at http://www.boost.org/LICENSE_1_0.txt)
 
-import os ;
-
 project boost/cgi/example/cgi
- : build-dir ../../../../bin.v2
   ;
 
-local BOOST_ROOT = [ os.environ BOOST_ROOT ] ;
-
+# By default, just build the examples
+build-project hello_world ;
+build-project echo ;
+#install stage
+# :
+# hello_world
+# echo
+# :
+# <location>$(bin-dir)
+# ;
 
-exe ecgi
+# If the user explicitly passes "install" on the command line, build the
+# CGI examples and copy them to $(cgi-bin)
+install install
   :
- main.cpp
+ hello_world
+ echo
   :
- <include>$(BOOST_ROOT)
- <include>../../../../
- <library>../../util/system//boost_system
- #<library>l:/usr/local/lib/libboost_system.a
- <define>BOOST_ALL_NO_LIB=1
- <define>_CRT_SECURE_NO_DEPRECATE=1
- <define>_SCL_SECURE_NO_WARNINGS
- <define>_CRT_SECURE_NO_WARNINGS
- <toolset>gcc:<linkflags>-lpthread
+ <location>$(cgi-bin)
   ;
 
-# uncomment this if you want to test the example on your machine
-#install _
-# : ecgi
-# : # this is where the compiled executable will be copied
-# # set this to your server's /cgi-bin/
-# <location>/var/www/cgi-bin
-# ;
-
+explicit install ;

Modified: sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/cgi/echo/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/cgi/echo/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/cgi/echo/Jamfile.v2 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -4,18 +4,14 @@
 # (See accompanying file LICENSE_1_0.txt or copy
 # at http://www.boost.org/LICENSE_1_0.txt)
 
+project boost/cgi/example/cgi/echo ;
+
 exe cgi_echo
   : main.cpp
     /boost/thread/
     /boost/regex/
   ;
 
-local LOCATION = $(cgi-bin) ;
-if ! $(LOCATION)
-{
- LOCATION = . ;
-}
-
 
 # Our install rule (builds binaries and copies them to <location>)
 install install

Modified: sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/cgi/hello_world/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/cgi/hello_world/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/cgi/hello_world/Jamfile.v2 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -4,7 +4,7 @@
 # (See accompanying file LICENSE_1_0.txt or copy
 # at http://www.boost.org/LICENSE_1_0.txt)
 
-project boost.cgi.examples.cgi.hello_world ;
+project boost/cgi/example/cgi/hello_world ;
 
 exe cgi_hello_world : main.cpp /boost/regex/ ;
 

Modified: sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/echo/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/echo/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/echo/Jamfile.v2 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -1,5 +1,5 @@
 
-project cgi.examples.fcgi.echo ;
+project boost/cgi/example/fcgi/echo ;
 
 exe fcgi_echo : main.cpp ;
 

Modified: sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/server1/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/server1/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/server1/Jamfile.v2 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -1,5 +1,5 @@
 
-project cgi.examples.fcgi.sync_server ;
+project boost/cgi/example/fcgi/server1 ;
 
 exe fcgi_server1 : main.cpp ;
 

Modified: sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/server2/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/server2/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/server2/Jamfile.v2 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -1,5 +1,5 @@
 
-project cgi.examples.fcgi.server2 ;
+project boost/cgi/example/fcgi/server2 ;
 
 exe fcgi_server2 : main.cpp ;
 

Modified: sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/server3/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/server3/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/server3/Jamfile.v2 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -1,5 +1,5 @@
 
-project cgi.examples.fcgi.server3 ;
+project boost/cgi/example/fcgi/server3 ;
 
 exe fcgi_server3 : main.cpp ;
 

Modified: sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/server4/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/server4/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/fcgi/server4/Jamfile.v2 2008-03-31 16:14:53 EDT (Mon, 31 Mar 2008)
@@ -1,5 +1,5 @@
 
-project cgi.examples.fcgi.server4 ;
+project boost/cgi/example/fcgi/server4 ;
 
 exe fcgi_server4 : main.cpp ;
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk