| 596 | } |
| 597 | |
| 598 | CService HTTPRequest::GetPeer() const |
| 599 | { |
| 600 | evhttp_connection* con = evhttp_request_get_connection(req); |
| 601 | CService peer; |
| 602 | if (con) { |
| 603 | // evhttp retains ownership over returned address string |
| 604 | const char* address = ""; |
| 605 | uint16_t port = 0; |
| 606 | |
| 607 | #ifdef HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR |
| 608 | evhttp_connection_get_peer(con, &address, &port); |
| 609 | #else |
| 610 | evhttp_connection_get_peer(con, (char**)&address, &port); |
| 611 | #endif // HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR |
| 612 | |
| 613 | peer = LookupNumeric(address, port); |
| 614 | } |
| 615 | return peer; |
| 616 | } |
| 617 | |
| 618 | std::string HTTPRequest::GetURI() const |
| 619 | { |