java - Fiddler doesn't capture Apache HttpClient post -
somehow fiddler doesn't capture posts send httpclient provided apache.
but when send same post in c# using httpclient same server, fiddler intercept sessions.
my java code:
private defaulthttpclient client = new defaulthttpclient(); private httpcontext context = new basichttpcontext(); private basiccookiestore store = new basiccookiestore(); public client() throws urisyntaxexception { context.setattribute(clientcontext.cookie_store, store); login(); } private void login() throws urisyntaxexception { httpurirequest login = requestbuilder.post() .seturi(new uri("http://www.derpforum.nl")) .addparameter("username", "kattoor4") .addparameter("password", "xxxx") .addheader("referer", "http://www.derpforum.nl/") .build(); try (closeablehttpresponse response = client.execute(login, context)) { httpentity entity = response.getentity(); bufferedreader reader = new bufferedreader(new inputstreamreader(entity.getcontent())); string line; while ((line = reader.readline()) != null) system.out.println(line); } catch (ioexception e) { e.printstacktrace(); } }
any thoughts? thanks!
you need configure java use fiddler proxy either in code or setting relevant java system properties below. see question.
-dhttp.proxyhost=127.0.0.1 -dhttp.proxyport=8888
Comments
Post a Comment