ESI plugin unfortunately still uses TSFetchUrl and therefore cannot handle
ipv6 client addresses.


On Sun, Feb 23, 2014 at 8:19 AM, James Peach <jpe...@apache.org> wrote:

> On Feb 20, 2014, at 2:43 PM, kic...@apache.org wrote:
>
> > Repository: trafficserver
> > Updated Branches:
> > refs/heads/master d3e4614bf -> d94a47ba8
> >
> >
> > TS-2579: remove ipv4 limit on FetchSM and TSFetchUrl/TSFetchPages
>
> What's the use case for this fix? One thing I just noticed is that all my
> code that calls TSHttpConnect uses the wrong IP address :(
>
> >
> >
> > Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
> > Commit:
> http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d94a47ba
> > Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d94a47ba
> > Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d94a47ba
> >
> > Branch: refs/heads/master
> > Commit: d94a47ba85cad73ebbc0e35b31baaa88279fe5c9
> > Parents: d3e4614
> > Author: Kit Chan <kic...@apache.org>
> > Authored: Thu Feb 20 22:42:30 2014 +0000
> > Committer: Kit Chan <kic...@apache.org>
> > Committed: Thu Feb 20 22:42:30 2014 +0000
> >
> > ----------------------------------------------------------------------
> > CHANGES          | 2 ++
> > proxy/FetchSM.cc | 4 +---
> > proxy/FetchSM.h  | 8 +++-----
> > proxy/InkAPI.cc  | 9 ++-------
> > 4 files changed, 8 insertions(+), 15 deletions(-)
> > ----------------------------------------------------------------------
> >
> >
> >
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d94a47ba/CHANGES
> > ----------------------------------------------------------------------
> > diff --git a/CHANGES b/CHANGES
> > index 90db4ec..e33e4b9 100644
> > --- a/CHANGES
> > +++ b/CHANGES
> > @@ -1,6 +1,8 @@
> >                                                        -*- coding: utf-8
> -*-
> > Changes with Apache Traffic Server 5.0.0
> >
> > +  *) [TS-2579] Remove ipv4 limit for FetchSM and
> TSFetchUrl/TSFetchPages.
> > +
> > *) [TS-1893] Add more options to server session control.
> >
> > *) [TS-2239] Initial ALPN TLS extension support.
> >
> >
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d94a47ba/proxy/FetchSM.cc
> > ----------------------------------------------------------------------
> > diff --git a/proxy/FetchSM.cc b/proxy/FetchSM.cc
> > index 36a6547..a0c70f7 100644
> > --- a/proxy/FetchSM.cc
> > +++ b/proxy/FetchSM.cc
> > @@ -52,9 +52,7 @@ void
> > FetchSM::httpConnect()
> > {
> > Debug(DEBUG_TAG, "[%s] calling httpconnect write", __FUNCTION__);
> > -  sockaddr_in addr;
> > -  ats_ip4_set(&addr, _ip, _port);
> > -  http_vc = TSHttpConnect(ats_ip_sa_cast(&addr));
> > +  http_vc = TSHttpConnect(_addr);
> >
> > PluginVC *vc = (PluginVC *) http_vc;
> >
> >
> >
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d94a47ba/proxy/FetchSM.h
> > ----------------------------------------------------------------------
> > diff --git a/proxy/FetchSM.h b/proxy/FetchSM.h
> > index 2b7586d..05241a4 100644
> > --- a/proxy/FetchSM.h
> > +++ b/proxy/FetchSM.h
> > @@ -40,7 +40,7 @@ public:
> > FetchSM()
> > { }
> >
> > -  void init(Continuation* cont, TSFetchWakeUpOptions options,
> TSFetchEvent events, const char* headers, int length, unsigned int ip, int
> port)
> > +  void init(Continuation* cont, TSFetchWakeUpOptions options,
> TSFetchEvent events, const char* headers, int length, sockaddr const * addr)
> > {
> >   //_headers.assign(headers);
> >   Debug("FetchSM", "[%s] FetchSM initialized for request with
> headers\n--\n%.*s\n--", __FUNCTION__, length, headers);
> > @@ -60,8 +60,7 @@ public:
> >   mutex = new_ProxyMutex();
> >   callback_events = events;
> >   callback_options = options;
> > -    _ip = ip;
> > -    _port = port;
> > +    _addr = addr;
> >   writeRequest(headers,length);
> >   SET_HANDLER(&FetchSM::fetch_handler);
> > }
> > @@ -105,8 +104,7 @@ private:
> > bool req_finished;
> > bool header_done;
> > bool resp_finished;
> > -  unsigned int _ip;
> > -  int _port;
> > +  sockaddr const * _addr;
> > };
> >
> > #endif
> >
> >
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d94a47ba/proxy/InkAPI.cc
> > ----------------------------------------------------------------------
> > diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
> > index bc0a9ec..e429103 100644
> > --- a/proxy/InkAPI.cc
> > +++ b/proxy/InkAPI.cc
> > @@ -7178,10 +7178,8 @@ TSFetchPages(TSFetchUrlParams_t *params)
> > while (myparams != NULL) {
> >   FetchSM *fetch_sm =  FetchSMAllocator.alloc();
> >   sockaddr* addr = ats_ip_sa_cast(&myparams->ip);
> > -    in_addr_t ip = ats_ip4_addr_cast(addr);
> > -    uint16_t port = ats_ip_port_host_order(addr);
> >
> > -    fetch_sm->init((Continuation*)myparams->contp,
> myparams->options,myparams->events, myparams->request,
> myparams->request_len, ip, port);
> > +    fetch_sm->init((Continuation*)myparams->contp,
> myparams->options,myparams->events, myparams->request,
> myparams->request_len, addr);
> >   fetch_sm->httpConnect();
> >   myparams= myparams->next;
> > }
> > @@ -7193,13 +7191,10 @@ TSFetchUrl(const char* headers, int request_len,
> sockaddr const* ip , TSCont con
> > if (callback_options != NO_CALLBACK) {
> >   sdk_assert(sdk_sanity_check_continuation(contp) == TS_SUCCESS);
> > }
> > -  sdk_assert(ats_is_ip4(ip));
> >
> > FetchSM *fetch_sm =  FetchSMAllocator.alloc();
> > -  in_addr_t addr = ats_ip4_addr_cast(ip);
> > -  unsigned short port = ats_ip_port_cast(ip);
> >
> > -  fetch_sm->init((Continuation*)contp, callback_options, events,
> headers, request_len, addr, port);
> > +  fetch_sm->init((Continuation*)contp, callback_options, events,
> headers, request_len, ip);
> > fetch_sm->httpConnect();
> > }
> >
> >
>
>

Reply via email to