Primarily just to make the code cleaner and a little concerned if I have a lot of hostnames.  100 for example.  Having to potentially traverse several if statements for each request seems inefficient to me.<br><br>Thank you,<br>
Paul<br><br><div class="gmail_quote">On Mon, Mar 7, 2011 at 11:32 PM, Indranil Chakravorty <span dir="ltr"><<a href="mailto:indranilc@rediff-inc.com">indranilc@rediff-inc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Apart from improving the construct to if ... elseif , could you please tell me the reason why you are looking for a different way? Is it only for ease of writing less statements or is there some other reason you foresee? I am asking because we also have a number of similar construct in our vcl. Thanks.<br>
<br>Thanks,<br>Neel<br><br>
On Tue, 08 Mar 2011 12:31:11 +0530 Paul Lu <<a href="mailto:paul.lu81@gmail.com" target="_blank">paul.lu81@gmail.com</a>> wrote<div><div></div><div class="h5"><br>
>Hi,<br>
><br>
>I have to work with a lot of domain names in my varnish config and I was wondering if there is an easier to way to match the hostname other than a series of if statements. Is there anything like a hash? Or does anybody have any C code to do this?<br>

> <br>
>example pseudo code:<br>
>=================================<br>
>vcl_recv(){<br>
><br>
> if(req.http.host == "<a href="http://www.domain1.com" target="_blank">www.domain1.com</a>")<br>
> {<br>
> set req.backend = www_domain1_com;<br>
>  # more code<br>
> return(lookup);<br>
> }<br>
> if(req.http.host == "<a href="http://www.domain2.com" target="_blank">www.domain2.com</a>")<br>
> {<br>
> set req.backend = www_domain2_com;<br>
> # more code<br>
>  return(lookup);<br>
> }<br>
> if(req.http.host == "<a href="http://www.domain3.com" target="_blank">www.domain3.com</a>")<br>
> {<br>
> set req.backend = www_domain3_com;<br>
> # more code<br>
> return(lookup);<br>
>  }<br>
>}<br>
>=================================<br>
><br>
>Thank you,<br>
>Paul<br></div></div>
> _______________________________________________<br>
> varnish-misc mailing list<br>
> <a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
> <a href="http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" target="_blank">http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a> </blockquote></div><br>