On Tue, 2008-03-11 at 11:25 -0700, George Ludwig wrote: > I am doing some web harvesting, and I'm trying to > better handle the situation where a hostile website > has my connection and then sends a few packets of > garbage data every couple of minutes. > > In the loop where I read data off the input stream, I > check the duration of the entire read process, and if > it has taken longer than a preset number of > milliseconds, I want to terminate the get method. > > Initially, I simply threw an exception, then called > method.releaseConnection() in the finally block. > However, I have since realized that > releaseConnection() tries to read the entire response > before releasing the connection. This does me no good, > since I want to stop consuming the response. > > So now I call method.abort(), then throw the > exception, and then method.releaseConnection() is > called in the finally block. > > Is this the best way to terminate a hostile > connection? >
George, HttpMethod#abort is the way to go Oleg > TIA, > > George > > > > ____________________________________________________________________________________ > Be a better friend, newshound, and > know-it-all with Yahoo! Mobile. Try it now. > http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]