|
Boost-Commit : |
From: lists.drrngrvy_at_[hidden]
Date: 2007-08-24 23:13:12
Author: drrngrvy
Date: 2007-08-24 23:13:11 EDT (Fri, 24 Aug 2007)
New Revision: 38917
URL: http://svn.boost.org/trac/boost/changeset/38917
Log:
Some doc/example updates.
* Examples now work on MSVC Express
* Example Jamfile.v2 install command now commented out, with a note to encourage testing them.
Text files modified:
sandbox/SOC/2007/cgi/libs/cgi/doc/src/cgi.qbk | 5 +++++
sandbox/SOC/2007/cgi/libs/cgi/doc/src/future_development.qbk | 24 ++++++++++++++++++++++++
sandbox/SOC/2007/cgi/libs/cgi/doc/src/user_guide/tutorial.qbk | 2 +-
sandbox/SOC/2007/cgi/libs/cgi/doc/src/user_guide/tutorial/variables.qbk | 12 +++++++-----
sandbox/SOC/2007/cgi/libs/cgi/example/acgi/Jamfile.v2 | 23 ++++++++++++++---------
sandbox/SOC/2007/cgi/libs/cgi/example/acgi/main.cpp | 12 +++++++++---
sandbox/SOC/2007/cgi/libs/cgi/example/cgi/Jamfile.v2 | 14 +++++++++-----
sandbox/SOC/2007/cgi/libs/cgi/example/cgi/main.cpp | 2 +-
sandbox/SOC/2007/cgi/libs/cgi/example/servers/fcgi_threadpool_server.cpp | 8 ++++++++
sandbox/SOC/2007/cgi/libs/cgi/util/system/Jamfile.v2 | 4 ++--
10 files changed, 80 insertions(+), 26 deletions(-)
Modified: sandbox/SOC/2007/cgi/libs/cgi/doc/src/cgi.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/libs/cgi/doc/src/cgi.qbk (original)
+++ sandbox/SOC/2007/cgi/libs/cgi/doc/src/cgi.qbk 2007-08-24 23:13:11 EDT (Fri, 24 Aug 2007)
@@ -64,6 +64,11 @@
[def __accepting__ boost.cgi.ug.tutorial.accepting]
[def __loading__ boost.cgi.ug.tutorial.loading]
+[/def __hog__ []]
+[template rfc[number]
+[@http://www.ietf.com/rfc/rfc[number] RFC[number]]
+]
+
[important
This manual does [*not] document a library that is a part of __Boost__. The major part of it has been developed this summer as part of the Google Summer of Code, '[@http://code.google.com/soc GSoC07]'. Everything from here on in is alpha-grade, some bits more than others; [link boost.cgi.preface.comments_and_support comments and bug reports] are welcome.
Modified: sandbox/SOC/2007/cgi/libs/cgi/doc/src/future_development.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/libs/cgi/doc/src/future_development.qbk (original)
+++ sandbox/SOC/2007/cgi/libs/cgi/doc/src/future_development.qbk 2007-08-24 23:13:11 EDT (Fri, 24 Aug 2007)
@@ -104,6 +104,30 @@
Even though this library introduces very few new concepts, they are not currently documented. Links to Boost.Asio's concept documentation is also required (essentially as part of a reworking of the doxygen reference section).
+[h4 Support for environment Passed on Command Line]
+
+See section 4.4 of [@http://www.ietf.org/rfc/rfc3875].
+
+[h4 Support for Multi-part POST Forms]
+
+
+
+[h4 `operator[]` Overloading]
+
+What is currently:
+``
+request req;
+std::string a( req.form_("a") );
+map& forms = req.form_();
+``
+could become:
+``
+request req;
+std::string a(req[form_, "a"]);
+map& forms = req[form_];
+a = req[form_]["a"]; // better to the above, plus is more 'standard'
+``
+
[/h4 Removing aCGI/CGI Divide]
[/h4 Support for wide characters]
Modified: sandbox/SOC/2007/cgi/libs/cgi/doc/src/user_guide/tutorial.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/libs/cgi/doc/src/user_guide/tutorial.qbk (original)
+++ sandbox/SOC/2007/cgi/libs/cgi/doc/src/user_guide/tutorial.qbk 2007-08-24 23:13:11 EDT (Fri, 24 Aug 2007)
@@ -25,7 +25,7 @@
* [link __meta_data__ Accessing the data] associated with a request;
-* [link __writing__ Writing] a reply;
+* [link __writing__ Writing] a response;
* [link __wrapping_up__ Wrapping up];
Modified: sandbox/SOC/2007/cgi/libs/cgi/doc/src/user_guide/tutorial/variables.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/libs/cgi/doc/src/user_guide/tutorial/variables.qbk (original)
+++ sandbox/SOC/2007/cgi/libs/cgi/doc/src/user_guide/tutorial/variables.qbk 2007-08-24 23:13:11 EDT (Fri, 24 Aug 2007)
@@ -99,6 +99,7 @@
Since looking up variables using raw strings can be error-prone, the `basic_request<>` class provides a safer way to reference the standard CGI environment variables. The table below lists them, and briefly explains their function.[footnote Reference information largely drafted from [@http://hoohoo.ncsa.uiuc.edu/cgi/env.html] and [@http://www.ietf.org/rfc/rfc3875 RFC3875].]
+
[table Standard CGI Meta-variables
[[Function signature] [Purpose]]
[
@@ -115,11 +116,11 @@
]
[
[`std::string gateway_interface()`]
- [The revision of the CGI specification to which this server complies. Format: CGI/revision]
+ [The revision of the CGI specification to which this server complies. Format: CGI/revision, eg. `"CGI/1.1"`]
]
[
[`std::string path_info()`]
- [The extra path information, as given by the client. In other words, scripts can be accessed by their virtual pathname, followed by extra information at the end of this path. The extra information is sent as PATH_INFO. This information should be decoded by the server if it comes from a URL before it is passed to the CGI script.]
+ [The extra path information, as given by the client. In other words, scripts can be accessed by their virtual pathname, followed by extra information at the end of this path. The extra information is sent as PATH_INFO.]
]
[
[`std::string path_translated()`]
@@ -127,11 +128,11 @@
]
[
[`std::string query_string()`]
- [The information following the '?' in the URL. This is where the GET data is extracted from. Format: name1=value1&name2=value2... Any reserved characters are URL-encoded.]
+ [The information following the '?' in the URL. This is where the GET data is extracted from. Format: `"name1=value1&name2=value2..."` Any reserved characters are URL-encoded.]
]
[
[`std::string remote_addr()`]
- [The IP address of the remote host making the request. You should [*never] trust that this is accurate.]
+ [The IP address of the remote host making the request. You should [*never] rely on the accuracy of this value, as it is easily forged.]
]
[
[`std::string remote_host()`]
@@ -139,7 +140,7 @@
]
[
[`std::string remote_ident()`]
- [If the HTTP server supports RFC 931 identification, then this variable will be set to the remote user name retrieved from the server. Usage of this variable should be limited to logging only.]
+ [If the HTTP server supports [rfc 931] identification, then this variable will be set to the remote user name retrieved from the server. Usage of this variable should be limited to logging only.]
]
[
[`std::string remote_user()`]
@@ -171,6 +172,7 @@
]
]
+
[/ should this return a `std::pair<std::string, cgi::meta_type>` instead, where a `cgi::meta_type` is one of `get`, `post`, `env`, or `cookie`?]
[endsect]
Modified: sandbox/SOC/2007/cgi/libs/cgi/example/acgi/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/libs/cgi/example/acgi/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/libs/cgi/example/acgi/Jamfile.v2 2007-08-24 23:13:11 EDT (Fri, 24 Aug 2007)
@@ -15,15 +15,20 @@
exe acgi
:
$(SOURCES).cpp
+ : requirements
+ <include>$(BOOST_ROOT)
+ <include>"../../../../"
+ <library>../../util/system//boost_system
+ #<library>libboost_system
+ <define>BOOST_ALL_NO_LIB=1
+ <toolset>gcc:<linkflags>-lpthread
:
- <include>$(BOOST_ROOT)
- <include>"../../../../"
- <library>../../util/system//boost_system
- <define>BOOST_ALL_NO_LIB=1
- <toolset>gcc:<linkflags>-lpthread
;
-install _
- : acgi
- : <location>/var/www/cgi-bin
- ;
\ No newline at end of file
+# uncomment this if you want to test the example with your HTTP server
+#install _
+# : acgi
+# : # this is where the compiled executable is copied to
+# # ie. change this to your server's /cgi-bin/
+# <location>/var/www/cgi-bin
+# ;
Modified: sandbox/SOC/2007/cgi/libs/cgi/example/acgi/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/libs/cgi/example/acgi/main.cpp (original)
+++ sandbox/SOC/2007/cgi/libs/cgi/example/acgi/main.cpp 2007-08-24 23:13:11 EDT (Fri, 24 Aug 2007)
@@ -24,6 +24,11 @@
// cgi::acgi::request& req_;
// };
+/**
+ * The following example has a few simple stages.
+ * It is best understood by compiling and testing it, and then looking at
+ * the source code.
+ */
int main()
{
@@ -40,7 +45,8 @@
if (req.get_("reset") == "true")
{
resp<< cookie("name")
- << location(req.script_name())
+ << location("acgi")
+ << content_type("text/plain")
<< header();
resp.send(req);
return 0;
@@ -58,14 +64,14 @@
return 0;
}
- // Now we'll check if they sent us a name
+ // Now we'll check if they sent us a name in a form
name = req.form_("name");
if (!name.empty())
{
resp<< header("Content-type", "text/html")
<< cookie("name", name)
<< header() // terminate the headers
- << "Hello there, " << name;
+ << "Hello there, " << "<a href=''>" << name << "</a>";
resp.send(req);
return 0;
}
Modified: sandbox/SOC/2007/cgi/libs/cgi/example/cgi/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/libs/cgi/example/cgi/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/libs/cgi/example/cgi/Jamfile.v2 2007-08-24 23:13:11 EDT (Fri, 24 Aug 2007)
@@ -18,7 +18,7 @@
main.cpp
:
<include>$(BOOST_ROOT)
- <include>"../../../../"
+ <include>../../../../
<library>../../util/system//boost_system
#<library>l:/usr/local/lib/libboost_system.a
<define>BOOST_ALL_NO_LIB=1
@@ -26,7 +26,11 @@
<toolset>gcc:<linkflags>-lpthread
;
-install _
- : ecgi
- : <location>/var/www/cgi-bin
- ;
\ No newline at end of file
+# 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
+# ;
+
Modified: sandbox/SOC/2007/cgi/libs/cgi/example/cgi/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/libs/cgi/example/cgi/main.cpp (original)
+++ sandbox/SOC/2007/cgi/libs/cgi/example/cgi/main.cpp 2007-08-24 23:13:11 EDT (Fri, 24 Aug 2007)
@@ -1,7 +1,7 @@
#include <string>
#include <boost/system/error_code.hpp>
//#include "../../../../boost/cgi/basic_protocol_service_fwd.hpp"
-#include "../../../../boost/cgi/cgi.hpp"
+#include <boost/cgi/cgi.hpp>
int main()
{
Modified: sandbox/SOC/2007/cgi/libs/cgi/example/servers/fcgi_threadpool_server.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/libs/cgi/example/servers/fcgi_threadpool_server.cpp (original)
+++ sandbox/SOC/2007/cgi/libs/cgi/example/servers/fcgi_threadpool_server.cpp 2007-08-24 23:13:11 EDT (Fri, 24 Aug 2007)
@@ -3,6 +3,14 @@
#include <boost/cgi/fcgi.hpp>
+/************************************
+NOTE: this doesn't work for now, because FastCGI support isn't
+ built in yet.
+
+ This is what a FastCGI program should look like though.
+
+ The request will be handled in `sub_main`
+*************************************/
namespace cgi {
Modified: sandbox/SOC/2007/cgi/libs/cgi/util/system/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/libs/cgi/util/system/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/libs/cgi/util/system/Jamfile.v2 2007-08-24 23:13:11 EDT (Fri, 24 Aug 2007)
@@ -2,6 +2,6 @@
lib boost_system
:
- : <file>/usr/local/lib/libboost_system.a
- #<toolset>gcc:<file>/usr/local/lib/libboost_system.a
+ : <toolset>msvc:<file>C:/Boost/lib/boost_system-mt.dll
+ <toolset>gcc:<file>/usr/local/lib/libboost_system.a
;
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