Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

38
LINES

< > BotCompany Repo | #1032718 // StandaloneHttpProxy Test for webssh

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 1113K of libraries. Click here for Pure Java version (8483L/42K).

1  
!7
2  
3  
cm ProxyTest > DynPrintLogAndEnabled {
4  
  transient autoDispose new L<StandaloneHttpProxy> proxies;
5  
  
6  
  switchable int httpInPort = 8080;
7  
  switchable int httpsInPort;
8  
  switchable int httpOutPort = 8888;
9  
  
10  
  *() { enabled = false; }
11  
12  
  void startProxy(StandaloneHttpProxy proxy) ctex {  
13  
    proxy.forwardServerAndPort = req -> HostAndPort("localhost", httpOutPort);
14  
    proxy.serveLocalhostOnly = true;
15  
    proxy.rewriteHostHeader = false;
16  
    proxies.add(proxy);
17  
    proxy.start();
18  
  }
19  
20  
  start {
21  
    if (!enabled) ret;
22  
    
23  
    if (httpInPort != 0) {
24  
      new StandaloneHttpProxy proxy;
25  
      proxy.port = httpInPort;
26  
      startProxy(proxy);
27  
    }
28  
    
29  
    if (httpsInPort != 0) {
30  
      new StandaloneHttpProxy proxy;
31  
      var serverSocketFactory = serverSocketFactory_botCompanyEtc();
32  
      proxy.port = httpsInPort;
33  
      proxy.makeServerSocket = -> ctex { ret serverSocketFactory.createServerSocket(proxy.port); };
34  
      startProxy(proxy);
35  
    }
36  
    
37  
  }
38  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, iveijnkanddl, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032718
Snippet name: StandaloneHttpProxy Test for webssh
Eternal ID of this version: #1032718/7
Text MD5: 08a2c33e862eddf5ce4404b2f00e8ff3
Transpilation MD5: 3aaeed5cc4116a8d173cb4b9bedcf508
Author: stefan
Category: javax / http
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-03 22:06:51
Source code size: 1008 bytes / 38 lines
Pitched / IR pitched: No / No
Views / Downloads: 144 / 327
Version history: 6 change(s)
Referenced in: [show references]