Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] Fwd: Jetty Client 9.04 threads

Hmm, so onResponseHeaders is called multiple times if there are
multiple redirects?

Also, do yo know any async dns resolver? Does Jetty use sync or async
DNS resolving?
--
Kamil Gorlo


On Fri, Jul 19, 2013 at 3:28 PM, Simone Bordet <sbordet@xxxxxxxxxxx> wrote:
> Hi,
>
> On Fri, Jul 19, 2013 at 10:30 AM, Kamil Gorlo <kgorlo@xxxxxxxxx> wrote:
>> I am implementing some kind of webcrawler which presents results to
>> users. User asks my service to crawl website and then I show some
>> report for him.
>>
>> If users asks me about (malicious) website which will return Location:
>> http://<internal_ip_in_my_network>/index.php then I want to block this
>> action. How to do this nicely in Jetty? For now, I have turned off
>> automatic redirects and implemented them manually and additionally in
>> each step I need to resolve returned host from Location header, check
>> if it is "safe" and then loop.
>
> newRequest(...)
>     ...
>     .onResponseHeaders(response -> {
>             if (!isRedirectAllowed(response))
>                 response.abort(new Exception());
>     })
>     .send(...);
>
> You implement isRedirectAllowed(Response) with your logic, and that
> should be it.
>
> --
> Simone Bordet
> ----
> http://cometd.org
> http://webtide.com
> http://intalio.com
> Developer advice, training, services and support
> from the Jetty & CometD experts.
> Intalio, the modern way to build business applications.
> _______________________________________________
> jetty-dev mailing list
> jetty-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-dev


Back to the top