info.host

This commit is contained in:
2018-09-02 21:10:54 +02:00
parent 100e1c50ac
commit 38a910715e

View File

@ -26,14 +26,14 @@
typedef struct { typedef struct {
const char* host; string host;
const char* cc; string cc;
const char* country; string country;
const char* prov; string prov;
const char* provname; string provname;
const char* city; string city;
const char* timezone; string timezone;
const char* localdate; string localdate;
} IpAddressInfo; } IpAddressInfo;
@ -72,14 +72,14 @@ IpAddressInfo get_ip_address_info(Address* addr) {
int num = 0; int num = 0;
while (std::getline(buffer, line)) { while (std::getline(buffer, line)) {
switch (num) { switch (num) {
case 0: info.host = line.c_str(); break; case 0: info.host = line; break;
case 1: info.cc = line.c_str(); break; case 1: info.cc = line; break;
case 2: info.country = line.c_str(); break; case 2: info.country = line; break;
case 3: info.prov = line.c_str(); break; case 3: info.prov = line; break;
case 4: info.provname = line.c_str(); break; case 4: info.provname = line; break;
case 5: info.city = line.c_str(); break; case 5: info.city = line; break;
case 6: info.timezone = line.c_str(); break; case 6: info.timezone = line; break;
case 7: info.localdate = line.c_str(); break; case 7: info.localdate = line; break;
} }
num++; num++;
} }
@ -224,7 +224,7 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
}*/ }*/
sprintf(buffer, "[\x1B[1m%s\x1B[0m][%i]%s[%s][%i]%s ", host.c_str(), socket->getSocketPort(), col1, sprintf(buffer, "[\x1B[1m%s\x1B[0m][%i]%s[%s][%i]%s ", host.c_str(), socket->getSocketPort(), col1,
info->host, socket->getPeerPort(), col2); info->host.c_str(), socket->getPeerPort(), col2);
prefix = buffer; prefix = buffer;
log(prefix, "\x1B[1m" + req.getMethod() + " " + req.getPath() + "\x1B[0m"); log(prefix, "\x1B[1m" + req.getMethod() + " " + req.getPath() + "\x1B[0m");