This repository was archived by the owner on Dec 13, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
browsermob-core/src/main/java/net/lightbody/bmp
browsermob-rest/src/main/java/net/lightbody/bmp/proxy/bricks Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -450,6 +450,12 @@ public InetAddress getServerBindAddress() {
450450 return serverBindAddress ;
451451 }
452452
453+ public void setIsDirectResolutionEnabled (boolean useDirect ) {
454+ if (proxyServer instanceof DefaultHttpProxyServer ) {
455+ ((DefaultHttpProxyServer )proxyServer ).setIsDirectResolutionEnabled (useDirect );
456+ }
457+ }
458+
453459 @ Override
454460 public Har getHar () {
455461 return har ;
Original file line number Diff line number Diff line change @@ -128,6 +128,25 @@ public Reply<?> newProxy(Request<String> request) {
128128 return Reply .with (new ProxyDescriptor (proxy .getPort ())).as (Json .class );
129129 }
130130
131+ @ Put
132+ @ At ("/:port/direct" )
133+ public Reply <?> setDirect (@ Named ("port" ) int port , Request <String > request ) {
134+ LegacyProxyServer proxy = proxyManager .get (port );
135+ if (proxy == null ) {
136+ return Reply .saying ().notFound ();
137+ }
138+
139+ String useDirectString = request .param ("direct" );
140+ boolean useDirect = Boolean .parseBoolean (useDirectString );
141+ System .out .println ("Chase -> useDirect is " + useDirect );
142+
143+ if (proxy instanceof BrowserMobProxyServer ) {
144+ ((BrowserMobProxyServer )proxy ).setIsDirectResolutionEnabled (useDirect );
145+ }
146+
147+ return Reply .saying ().ok ();
148+ }
149+
131150 @ Get
132151 @ At ("/:port/har" )
133152 public Reply <?> getHar (@ Named ("port" ) int port ) {
You can’t perform that action at this time.
0 commit comments