--
You received this message because you are subscribed to a topic in the Google Groups "LittleProxy" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/littleproxy/iPY59IIiDgE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to littleproxy...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
String urlString = "http://the-internet.herokuapp.com/javascript_error";
Proxy proxy = new Proxy();
proxy.setProxyType(Proxy.ProxyType.MANUAL);
String proxyStr = String.format("localhost:%d", PROXY_PORT);
proxy.setHttpProxy(proxyStr);
proxy.setSslProxy(proxyStr);
LoggingPreferences logs = new LoggingPreferences();
logs.enable(LogType.BROWSER, Level.ALL);
//Safari
// DesiredCapabilities capability = DesiredCapabilities.safari();
// capability.setCapability(CapabilityType.PROXY, proxy);
// capability.setCapability(CapabilityType.LOGGING_PREFS, logs);
// WebDriver driver = new SafariDriver(capability);
//Firefox
DesiredCapabilities capability = DesiredCapabilities.firefox();
capability.setCapability(CapabilityType.PROXY, proxy);
capability.setCapability(CapabilityType.LOGGING_PREFS, logs);
WebDriver driver = new FirefoxDriver(capability);
driver.get(urlString);
I'm sorry for dumping two questions in one email. Please let me know If I have to post this as a new question in the mailing group.
Thanks a lot.
-Syam
Jun 30, 2014 12:18:11 AM org.littleshoot.proxy.impl.DefaultHttpProxyServer start
INFO: Starting proxy at address: /127.0.0.1:8938
Jun 30, 2014 12:18:11 AM org.littleshoot.proxy.impl.DefaultHttpProxyServer doStart
INFO: Proxy listening with TCP transport
But now I am facing an even bigger problem. Actually the target webpage whose response I need to modify is using an HTTPS connection. So I tried to use MITM manager as given in the MITM test example , i.e But the webpage I'm trying to access is not getting loaded and I'm getting this error.
The connection was reset
The connection to the server was reset while the page was loading.
Also I want to know is it possible to get the content of the webpage in text format using this approach. If not, what can be the best approach to solve this issue?
Thanks,
Syam
String urlString = "https://www.paypal.com/home";
Proxy proxy = new Proxy();
proxy.setProxyType(Proxy.ProxyType.MANUAL);
String proxyStr = String.format("localhost:%d", PROXY_PORT);
proxy.setHttpProxy(proxyStr);
proxy.setSslProxy(proxyStr);
LoggingPreferences logs = new LoggingPreferences();
logs.enable(LogType.BROWSER, Level.ALL);
String chromeDriverPath = "/Users/syasankar/software/chromedriver";
System.setProperty("webdriver.chrome.driver", chromeDriverPath);
DesiredCapabilities capability = DesiredCapabilities.chrome();
capability.setCapability(CapabilityType.LOGGING_PREFS, logs);
capability.setCapability(CapabilityType.PROXY, proxy);
capability.setCapability("chrome.switches", Arrays.asList("--ignore-certificate-errors"));
WebDriver driver = new ChromeDriver(capability);
Any pointers to what it is causing this would be awesome.
Definitely.
My HttpObject is not of the above 3 types, so I'm not able to view the content from those response. I'm only able to get a DefaultHttpResponse which is pretty useless as it doesnt have any content methods. Here is my response interceptor, do let me if I'm doing it all wrong.
public HttpObject responsePre(HttpObject httpObject) {
if (httpObject instanceof HttpResponse) {
if (httpObject instanceof DefaultHttpContent) {
DefaultHttpContent resp3 = (DefaultHttpContent) httpObject;
System.out.println("response default content ---------");
System.out.println(resp3.content().toString(CharsetUtil.UTF_8));
}
if (httpObject instanceof LastHttpContent) {
LastHttpContent resp3 = (LastHttpContent) httpObject;
System.out.println("response last content---------");
System.out.println(resp3.content().toString(CharsetUtil.UTF_8));
}
if (httpObject instanceof DefaultHttpResponse) {
DefaultHttpResponse resp3 = (DefaultHttpResponse) httpObject;
System.out.println("default response---------");
System.out.println(resp3);
}
if (httpObject instanceof HttpContent) {
HttpContent resp3 = (HttpContent) httpObject;
System.out.println("default content---------");
System.out.println(resp3.content().toString(CharsetUtil.UTF_8));
}
curl -k -x localhost:8919 https://www.google.com/humans.txt
Google is built by a large team of engineers, designers, researchers, robots, and others in many different sites across the globe. It is updated continuously, and built with more tools and technologies than we can shake a stick at. If you'd like to help us out, see google.com/careers.
Looking forward to it :)
...
--
You received this message because you are subscribed to a topic in the Google Groups "LittleProxy" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/littleproxy/iPY59IIiDgE/unsubscribe.
... I want to go through the body and change html elements dynamically...
...DefaultHttpResponse will come first it is not possible to change the body and set the content length header afterwards.
And another question... How to prevent the filter from receiving small chunks? I would prefer to receive the entire body and handle it with Jsoup...
Regards,
Bruno
The filter is stateful and 1 per request. Just store the chunks then do your thing when the last one arrives.
fullResponse.headers().set("Content-Length", proxyVO.getText().length());