ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/HostUpdate/HostUpdate.cpp
(Generate patch)

Comparing HostUpdate/HostUpdate.cpp (file contents):
Revision 22 by Douglas Thrift, 2003-11-10T23:58:38-08:00 vs.
Revision 91 by Douglas Thrift, 2004-03-01T19:41:20-08:00

# Line 40 | Line 40 | HostUpdate::HostUpdate()
40          {
41                  update(agent);
42          }
43 +        else if (agent.find("Host Update Sharp/") == 0 && method == "POST" &&
44 +                agent.find(" (") != string::npos && agent.find(')') != string::npos)
45 +        {
46 +                update(agent);
47 +        }
48          else
49          {
50                  display();
# Line 81 | Line 86 | void HostUpdate::mode()
86                  false;
87  
88          for (multimap<string, string>::iterator itor = cgi.find("mode"); itor !=
89 <                cgi.upper_bound("mode"); itor++)
89 >                cgi.upper_bound("mode") && itor != cgi.end(); itor++)
90          {
91                  string mode = itor->second;
92  
# Line 128 | Line 133 | void HostUpdate::update(const string& ag
133          string host = itor->second, name = sgetenv("REMOTE_HOST"), address =
134             sgetenv("REMOTE_ADDR");
135  
136 <        string::size_type begin = agent.find('(') + 1, end = agent.find(')',
137 <                begin);
136 >        string::size_type begin = agent.find('(') + 1, end = agent.rfind(')');
137 >
138 >        if (begin >= end) return;
139 >
140          string platform = agent.substr(begin, end - begin);
141  
142          Host client(host, name, address, platform), saved(host);
# Line 147 | Line 154 | void HostUpdate::display()
154                  bool request = false;
155  
156                  for (multimap<string, string>::iterator itor = cgi.find("host"); itor !=
157 <                        cgi.upper_bound("host"); itor++)
157 >                        cgi.upper_bound("host") && itor != cgi.end(); itor++)
158                  {
159                          if (itor->second != "")
160                          {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines