32 |
|
string agent = env.getUserAgent(); |
33 |
|
string method = env.getRequestMethod(); |
34 |
|
|
35 |
< |
if (agent.find("Host Update/") == 0 && method == "GET" && agent.find(" (") |
35 |
> |
if (agent.find("Host Update/") == 0 && method == "POST" && agent.find(" (") |
36 |
|
!= string::npos && agent.find(") libwww-perl/") != string::npos) |
37 |
|
{ |
38 |
|
update(env, agent); |
57 |
|
if (!cgi.getElement("host", entries)) return; |
58 |
|
if (entries[0].isEmpty()) return; |
59 |
|
|
60 |
< |
string host = entries[0].getStrippedValue(); |
61 |
< |
string name = env.getRemoteHost(); |
62 |
< |
string address = env.getRemoteAddr(); |
60 |
> |
string host = entries[0].getStrippedValue(), name = env.getRemoteHost(), |
61 |
> |
address = env.getRemoteAddr(); |
62 |
|
|
63 |
|
if (name == address) name = ""; |
64 |
|
|
65 |
< |
string::size_type begin = agent.find('(') + 1, end = agent.find(begin, ')'); |
65 |
> |
string::size_type begin = agent.find('(') + 1, end = agent.find(')', |
66 |
> |
begin); |
67 |
|
string platform = agent.substr(begin, end - begin); |
68 |
+ |
|
69 |
+ |
cout << "host=" << host << '\n' |
70 |
+ |
<< "name=" << name << '\n' |
71 |
+ |
<< "address=" << address << '\n' |
72 |
+ |
<< "platform=" << platform << '\n'; |
73 |
+ |
|
74 |
+ |
Host client(host, name, address, platform), saved(host); |
75 |
+ |
|
76 |
+ |
if (client != ++saved) client--; |
77 |
|
} |
78 |
|
|
79 |
|
void HostUpdate::display(CgiEnvironment& env) |
80 |
|
{ |
81 |
< |
// |
81 |
> |
cout << "Status: 401\nWWW-Authenticate: Basic realm=\"Host Update\"\n\n"; |
82 |
|
} |