private void setHTTPOnlyCookieDetected() { http_only_detected = true; if ( parent != null ){ parent.setHTTPOnlyCookieDetected(); } }
@Override public void widgetDisposed( DisposeEvent arg0) { if ( sniffer != null ){ sniffer.destroy(); } } });
private boolean hasSetCookieName( String name ) { if ( parent != null ){ return( parent.hasSetCookieName( name )); }else{ synchronized( cookie_names_set ){ trace( "GetCookieName: " + name ); return( cookie_names_set.containsKey( name )); } } }
sniffer.destroy(); new HTTPAuthHelper( new URL( originalLoginUrl )); this_sniffer.addListener( new HTTPAuthHelperListener() this_sniffer.start(); browser.setUrl( "http://localhost:" + sniffer.getPort() + str );
public static void main( String[] args ) { try{ HTTPAuthHelper proxy = new HTTPAuthHelper( new URL( "https://client.vuze.com/" )); proxy.start(); System.out.println( "port=" + proxy.getPort()); while( true ){ Thread.sleep(1000); } }catch( Throwable e ){ e.printStackTrace(); } } }
return( parent.getChild( url_str,optional )); String child_key = getKey( child_url ); if ( child_key.equals( getKey( delegate_to ))){ child = new HTTPAuthHelper( this, new URL( url_str )); child.start();
String[] request_lines = splitHeader( request_header ); }.start(); String reply_header = readHeader( target_is ); String[] reply_lines = splitHeader( reply_header ); line_out = "Location: http://127.0.0.1:" + child.getPort() + page; String replacement = "http://127.0.0.1:" + child.getPort();
private void sniff() { try{ InputStream is = socket_in.getInputStream(); String request_header = readHeader( is ); connectToDelegate(); process( request_header ); }catch( Throwable e ){ if ( !( e instanceof IOException )){ Debug.out( e ); } destroy(); } }
private void addSetCookieName( String name, String value ) { if ( parent != null ){ parent.addSetCookieName( name, value ); }else{ boolean new_entry; synchronized( cookie_names_set ){ trace( "SetCookieName: " + name ); String old_value = (String)cookie_names_set.put( name, value ); new_entry = old_value==null || !old_value.equals( value ); } if ( new_entry ){ Iterator it = listeners.iterator(); while( it.hasNext()){ try{ ((HTTPAuthHelperListener)it.next()).cookieFound( this, name, value ); }catch( Throwable e ){ Debug.printStackTrace(e ); } } } } }
public boolean proxyCaptureModeRequired() { // if we sniffed more cookies that we grabbed through js then use proxy if ( sniffer_cookies.size() > js_cookies.size()){ return( true ); } return( sniffer != null && sniffer.wasHTTPOnlyCookieDetected()); }
@Override public void run() { try{ while( !destroyed ){ Socket socket = server_socket.accept(); socket.setSoTimeout( READ_TIMEOUT ); synchronized( HTTPAuthHelper.this ){ if ( processors.size() >= MAX_PROCESSORS ){ try{ Debug.out( "Too many processors" ); socket.close(); }catch( Throwable e ){ } }else{ processor proc = new processor( socket ); processors.add( proc ); proc.start(); } } } }catch( Throwable e ){ if ( !destroyed ){ Debug.printStackTrace( e ); } } } }.start();