ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Smersh/Smersh.cpp
Revision: 162
Committed: 2004-06-17T15:51:47-07:00 (21 years ago) by Douglas Thrift
File size: 690 byte(s)
Log Message:
Hello, World!

File Contents

# User Rev Content
1 Douglas Thrift 162 // Smersh
2     //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7     #include "Smersh.hpp"
8    
9     int main(int argc, char* argv[])
10     {
11     Smersh smersh;
12    
13     return 0;
14     }
15    
16     Smersh::Smersh()
17     {
18     string method = sgetenv("REQUEST_METHOD");
19    
20     parse(method);
21    
22     cout << "Content-Type: text/plain\n\n" << (cgi.find("sn") != cgi.end() ?
23     cgi.find("sn")->second : "Unknown") << '\n';
24     }
25    
26     void Smersh::parse(const string& method)
27     {
28     string query(sgetenv("QUERY_STRING"));
29    
30     if (method == "POST") getline(cin, query);
31     if (query == "") return;
32    
33     istringstream input(query);
34    
35     do
36     {
37     string name, value;
38    
39     getline(input, name, '=');
40     getline(input, value, '&');
41    
42     cgi.insert(pair<string, string>(name, value));
43     }
44     while (input.good());
45     }