How to get HTTP server IP address?

Asked by 3onepair on 2014-08-13

hi..

squid version : 3.4.5
ecap version : 0.2.1

const libecap::Area ip = hostx->option(libecap::metaClientIp) <----- OK
const libecap::Area ip2 = hostx->optoin(libecap::metaServerIp) <----- Fail..

How to get HTTP server IP address?

Question information

Language:
English Edit question
Status:
Solved
For:
eCAP Edit question
Assignee:
No assignee Edit question
Solved by:
Alex Rousskov
Solved:
2014-08-14
Last query:
2014-08-14
Last reply:
2014-08-13
Best Alex Rousskov (rousskov) said : #1

Your host application (Squid) does not yet support supplying metaServerIp to adaptation services. Your options include:

1. Do the DNS lookup in your adapter. This is tricky because you do not want to do a blocking lookup, because async adapters are difficult to write, because properly handling raw DNS responses is difficult, and because the response your adapter gets may differ from the response Squid gets.

2. Teach your host application to supply server IP or IPs. This is tricky because Squid may not know the server IP at the adaptation time, because Squid does not have an API to associate an early DNS lookup with the transaction (so that the results do not change during adaptation), because this potentially slow DNS lookup should not be done by default, and because there may be multiple IPs.

3. Make the IP-based decision you need using other means. For example, Squid has ACLs that can do DNS lookups and recent Squid versions support annotations that Squid can pass to adapters. Perhaps there is a way to test the condition you want using squid.conf and then just pass the result to the adapter as an annotation. This approach may not require any Squid development but suffers from at least one of the complications in #2: The IP address(es) may change after adaptation.

Please direct any Squid-specific followup questions to Squid support forums.

3onepair (gilung) said : #2

Thanks Alex Rousskov, that solved my question.