Hi All,

As I noticed, there is no Class for HttpConnect method

I need to add specific Http Header on CONNECT which is called X-For-Forward

I can successfully add XFF Header on HttpGet Request using :

HttpClientContext context = HttpClientContext.create();
HttpGet httpget = new HttpGet(URL);
RequestConfig requestConfig = RequestConfig.copy(defaultRequestConfig)
        .setProxy(new HttpHost(Proxy, Port))
        .build();
httpget.setConfig(requestConfig);
httpget.setHeader("X-Forwarded-For", XFFHeader);
httpget.setHeader(new BasicHeader("Prama", "no-cache"));
httpget.setHeader(new BasicHeader("Cache-Control", "no-cache"));
httpget.setHeader("X-Requested-With", "XMLHttpRequest");
httpget.setHeader(HttpHeaders.USER_AGENT,"Mozilla/5.0 (Windows NT 10.0; Win64; 
x64) "
+ "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36 
Chrome/69.0.3497.100 "
+ "Apache-HttpClient/4.5.3 (Java/1.8.0_141)");

Is there a way to Add the same Header to CONNECT method ?

My Traffic for Connect is as shown (Can't find way to add XFF Header Here ):

<43 4f 4e 4e 45 43 54 20 77 77 77 2e 79 6f 75 74     CONNECT www.yout;
16:  75 62 65 2e 63 6f 6d 3a 34 34 33 20 48 54 54 50     ube.com:443 HTTP;
32:  2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 77 77 77 2e     /1.1..Host: www.;
48:  79 6f 75 74 75 62 65 2e 63 6f 6d 0d 0a 55 73 65     youtube.com..Use;
64:  72 2d 41 67 65 6e 74 3a 20 41 70 61 63 68 65 2d     r-Agent: Apache-;
80:  48 74 74 70 43 6c 69 65 6e 74 2f 34 2e 35 2e 33     HttpClient/4.5.3;
96:  20 28 4a 61 76 61 2f 31 2e 38 2e 30 5f 31 34 31      (Java/1.8.0_141;
112:  29 0d 0a 0d 0a>                                     )....;

0: <47 45 54 20 2f 20 48 54 54 50 2f 31 2e 31 0d 0a     GET / HTTP/1.1..;
16:  58 2d 46 6f 72 77 61 72 64 65 64 2d 46 6f 72 3a     X-Forwarded-For:;
32:  20 31 30 2e 35 32 2e 31 30 36 2e 38 39 0d 0a 50      10.52.106.89..P;
48:  72 61 6d 61 3a 20 6e 6f 2d 63 61 63 68 65 0d 0a     rama: no-cache..;
64:  43 61 63 68 65 2d 43 6f 6e 74 72 6f 6c 3a 20 6e     Cache-Control: n;
80:  6f 2d 63 61 63 68 65 0d 0a 58 2d 52 65 71 75 65     o-cache..X-Reque;
96:  73 74 65 64 2d 57 69 74 68 3a 20 58 4d 4c 48 74     sted-With: XMLHt;
112:  74 70 52 65 71 75 65 73 74 0d 0a 55 73 65 72 2d     tpRequest..User-;
128:  41 67 65 6e 74 3a 20 4d 6f 7a 69 6c 6c 61 2f 35     Agent: Mozilla/5;
144:  2e 30 20 28 57 69 6e 64 6f 77 73 20 4e 54 20 31     .0 (Windows NT 1;
160:  30 2e 30 3b 20 57 69 6e 36 34 3b 20 78 36 34 29     0.0; Win64; x64);
176:  20 41 70 70 6c 65 57 65 62 4b 69 74 2f 35 33 37      AppleWebKit/537;
192:  2e 33 36 20 28 4b 48 54 4d 4c 2c 20 6c 69 6b 65     .36 (KHTML, like;
208:  20 47 65 63 6b 6f 29 20 43 68 72 6f 6d 65 2f 36      Gecko) Chrome/6;
224:  39 2e 30 2e 33 34 39 37 2e 31 30 30 20 53 61 66     9.0.3497.100 Saf;
240:  61 72 69 2f 35 33 37 2e 33 36 20 43 68 72 6f 6d     ari/537.36 Chrom;
256:  65 2f 36 39 2e 30 2e 33 34 39 37 2e 31 30 30 20     e/69.0.3497.100 ;
272:  41 70 61 63 68 65 2d 48 74 74 70 43 6c 69 65 6e     Apache-HttpClien;
288:  74 2f 34 2e 35 2e 33 20 28 4a 61 76 61 2f 31 2e     t/4.5.3 (Java/1.;
304:  38 2e 30 5f 31 34 31 29 0d 0a 48 6f 73 74 3a 20     8.0_141)..Host: ;
320:  77 65 62 2e 77 68 61 74 73 61 70 70 2e 63 6f 6d     web.whatsapp.com;
336:  0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 4b 65     ..Connection: Ke;
352:  65 70 2d 41 6c 69 76 65 0d 0a 41 63 63 65 70 74     ep-Alive..Accept;
368:  2d 45 6e 63 6f 64 69 6e 67 3a 20 67 7a 69 70 2c     -Encoding: gzip,;
384:  64 65 66 6c 61 74 65 0d 0a 0d 0a>                   deflate....;

Omar Khateeb | QA Engineer, IDA & DLP
Check Point Software Technologies <http://www.checkpoint.com/> | * 
om...@checkpoint.com<mailto:om...@checkpoint.com>

Reply via email to