Skip to content

Instantly share code, notes, and snippets.

@bagder bagder/issue-3602.c
Last active Feb 24, 2019

Embed
What would you like to do?
An attempt to reproduce curl issue 3602 with a sample written in C
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
#include <curl/curl.h>
struct one {
const char *ip;
int port;
int type;
};
struct one proxies[]={
"83.167.203.174", 44848, CURLPROXY_HTTP,
"83.219.1.80", 56004, CURLPROXY_HTTP,
"83.239.97.26", 50223, CURLPROXY_HTTP,
"84.241.19.214", 4145, CURLPROXY_SOCKS4,
"85.11.66.137", 55886, CURLPROXY_HTTP,
"85.52.217.114", 42544, CURLPROXY_HTTP,
"85.193.216.85", 59205, CURLPROXY_HTTP,
"85.193.229.6", 57712, CURLPROXY_HTTP,
"85.198.135.180", 54630, CURLPROXY_HTTP,
#if 1
"86.38.39.21", 54703, CURLPROXY_HTTP,
"86.100.77.210", 53281, CURLPROXY_HTTP,
"87.244.182.181", 32598, CURLPROXY_HTTP,
"88.146.243.106", 35852, CURLPROXY_HTTP,
"88.150.135.10", 36624, CURLPROXY_HTTP,
"88.255.251.163", 8080, CURLPROXY_HTTP,
"89.67.144.213", 55605, CURLPROXY_HTTP,
"89.111.104.2", 41258, CURLPROXY_HTTP,
"89.189.189.115", 59249, CURLPROXY_HTTP,
"89.231.32.226", 55466, CURLPROXY_SOCKS4,
"91.139.1.158", 37504, CURLPROXY_HTTP,
"77.120.75.131", 35911, CURLPROXY_HTTP,
"77.222.20.246", 47888, CURLPROXY_HTTP,
"78.128.124.9", 47654, CURLPROXY_HTTP,
"78.132.136.40", 32431, CURLPROXY_HTTP,
"78.187.50.200", 30852, CURLPROXY_HTTP,
"79.78.184.12", 56834, CURLPROXY_HTTP,
"79.106.35.253", 8080, CURLPROXY_HTTP,
"79.106.41.15", 35876, CURLPROXY_HTTP,
"80.55.32.238", 59513, CURLPROXY_HTTP,
"80.71.112.51", 55243, CURLPROXY_SOCKS4,
"80.191.162.51", 44199, CURLPROXY_SOCKS4,
"80.211.154.106", 8080, CURLPROXY_HTTP,
"80.240.253.112", 50530, CURLPROXY_HTTP,
"80.249.229.64", 42186, CURLPROXY_HTTP,
"81.16.10.141", 59352, CURLPROXY_HTTP,
"81.163.62.221", 31299, CURLPROXY_HTTP,
"81.174.247.181", 8118, CURLPROXY_HTTP,
"81.199.32.214", 60172, CURLPROXY_HTTP,
"83.2.189.66", 38011, CURLPROXY_HTTP,
"83.13.63.38", 60860, CURLPROXY_HTTP,
"45.114.144.106", 23500, CURLPROXY_HTTP,
"46.20.93.83", 41258, CURLPROXY_HTTP,
"46.99.179.81", 48746, CURLPROXY_HTTP,
"46.151.108.6", 33727, CURLPROXY_HTTP,
"46.164.149.40", 36551, CURLPROXY_HTTP,
"46.228.199.70", 3128, CURLPROXY_HTTP,
"50.7.105.69", 48823, CURLPROXY_SOCKS4,
"50.7.106.228", 48823, CURLPROXY_SOCKS4,
"50.226.80.129", 42741, CURLPROXY_SOCKS4,
"51.38.71.101", 8080, CURLPROXY_HTTP,
"51.254.182.52", 61133, CURLPROXY_HTTP,
"58.68.228.234", 1234, CURLPROXY_SOCKS4,
"60.46.17.210", 3128, CURLPROXY_HTTP,
"62.74.230.146", 40018, CURLPROXY_HTTP,
"62.232.2.98", 53281, CURLPROXY_HTTP,
"65.173.110.238", 37252, CURLPROXY_SOCKS4,
"66.96.237.71", 36582, CURLPROXY_HTTP,
"67.226.65.195", 80, CURLPROXY_HTTP,
"68.183.17.69", 8080, CURLPROXY_HTTP,
"68.183.185.17", 8888, CURLPROXY_HTTP,
"37.19.94.86", 4145, CURLPROXY_SOCKS4,
"37.53.83.40", 50887, CURLPROXY_SOCKS4,
"41.78.172.20", 61169, CURLPROXY_HTTP,
"41.162.117.37", 8080, CURLPROXY_HTTP,
"41.170.11.226", 46093, CURLPROXY_HTTP,
"41.216.230.154", 56673, CURLPROXY_SOCKS4,
"41.217.216.45", 50951, CURLPROXY_HTTP,
"42.115.39.70", 49236, CURLPROXY_HTTP,
"43.229.27.175", 8080, CURLPROXY_HTTP,
"43.229.252.45", 53281, CURLPROXY_HTTP,
"45.63.51.89", 80, CURLPROXY_HTTP,
"45.64.122.210", 58181, CURLPROXY_HTTP,
"36.37.124.234", 36179, CURLPROXY_HTTP,
"36.37.163.220", 23500, CURLPROXY_HTTP,
"36.67.27.29", 56125, CURLPROXY_HTTP,
"36.67.27.189", 53323, CURLPROXY_SOCKS4,
"36.67.199.89", 47923, CURLPROXY_HTTP,
"36.89.81.129", 53732, CURLPROXY_HTTP,
"36.89.190.217", 45170, CURLPROXY_HTTP,
"36.89.227.50", 53281, CURLPROXY_HTTP,
"91.195.131.242", 4145, CURLPROXY_SOCKS4,
"91.200.125.248", 4145, CURLPROXY_SOCKS4,
"91.203.115.21", 45644, CURLPROXY_SOCKS4,
"91.214.240.19", 50481, CURLPROXY_HTTP,
"91.218.163.74", 50517, CURLPROXY_SOCKS4,
"91.228.32.70", 6969, CURLPROXY_HTTP,
"91.230.199.174", 60926, CURLPROXY_HTTP,
"91.235.7.216", 59067, CURLPROXY_HTTP,
"91.237.161.141", 45311, CURLPROXY_HTTP,
"92.39.56.15", 61917, CURLPROXY_SOCKS4,
"92.62.66.161", 4145, CURLPROXY_SOCKS4,
"92.115.102.133", 53281, CURLPROXY_HTTP,
"92.244.36.66", 60789, CURLPROXY_SOCKS4,
"92.244.36.68", 47150, CURLPROXY_HTTP,
"92.246.220.206", 40396, CURLPROXY_HTTP,
"93.87.51.138", 23500, CURLPROXY_HTTP,
"93.87.66.66", 61831, CURLPROXY_HTTP,
"93.116.57.4", 55674, CURLPROXY_HTTP,
"93.171.241.18", 45781, CURLPROXY_HTTP,
"93.177.150.112", 45186, CURLPROXY_HTTP,
"94.102.124.207", 35836, CURLPROXY_HTTP,
"94.179.130.34", 41293, CURLPROXY_HTTP,
"94.180.245.1", 61251, CURLPROXY_HTTP,
"94.190.190.254", 46269, CURLPROXY_HTTP,
"94.228.21.66", 55295, CURLPROXY_HTTP,
"94.240.46.195", 23500, CURLPROXY_HTTP,
"95.31.32.102", 34233, CURLPROXY_HTTP,
"95.38.211.185", 4145, CURLPROXY_SOCKS4,
"95.47.180.171", 53484, CURLPROXY_HTTP,
"95.66.140.121", 59078, CURLPROXY_HTTP,
"95.79.54.143", 80, CURLPROXY_HTTP,
"95.87.127.133", 50594, CURLPROXY_HTTP,
"95.140.27.135", 60275, CURLPROXY_HTTP,
"95.181.35.30", 40804, CURLPROXY_HTTP,
"96.9.69.230", 53281, CURLPROXY_HTTP,
"96.9.73.79", 61057, CURLPROXY_HTTP,
"96.9.91.27", 53523, CURLPROXY_HTTP,
"101.109.255.243", 50098, CURLPROXY_HTTP,
"101.255.124.202", 42608, CURLPROXY_HTTP,
"103.10.61.106", 59733, CURLPROXY_SOCKS4,
"103.12.246.65", 4145, CURLPROXY_SOCKS4,
"103.15.140.138", 42584, CURLPROXY_SOCKS4,
"103.21.231.131", 53281, CURLPROXY_HTTP,
"103.28.243.11", 37120, CURLPROXY_HTTP,
"103.71.255.10", 51242, CURLPROXY_HTTP,
"103.73.86.67", 8080, CURLPROXY_HTTP,
"103.75.32.132", 53130, CURLPROXY_HTTP,
"103.75.34.121", 46210, CURLPROXY_HTTP,
"103.76.170.50", 60240, CURLPROXY_HTTP,
"103.76.188.85", 44827, CURLPROXY_HTTP,
"103.76.188.209", 45190, CURLPROXY_HTTP,
"103.77.23.202", 59311, CURLPROXY_SOCKS4,
"103.78.164.1", 4145, CURLPROXY_SOCKS4,
"103.81.104.121", 4145, CURLPROXY_SOCKS4,
"103.85.19.169", 39856, CURLPROXY_SOCKS4,
"103.91.120.65", 40540, CURLPROXY_SOCKS4,
"103.92.153.17", 57408, CURLPROXY_SOCKS4,
"103.94.7.254", 4145, CURLPROXY_SOCKS4,
"103.94.169.114", 30372, CURLPROXY_HTTP,
"103.99.161.17", 4145, CURLPROXY_SOCKS4,
"103.106.56.33", 4145, CURLPROXY_SOCKS4,
"103.106.148.200", 53712, CURLPROXY_HTTP,
"103.106.216.21", 21913, CURLPROXY_HTTP,
"103.107.163.129", 51327, CURLPROXY_SOCKS4,
"103.108.62.14", 49271, CURLPROXY_HTTP,
"103.109.93.25", 44550, CURLPROXY_SOCKS4,
"103.110.184.163", 40186, CURLPROXY_SOCKS4,
"103.115.100.246", 47788, CURLPROXY_HTTP,
"103.192.169.186", 35865, CURLPROXY_HTTP,
"103.194.240.54", 53908, CURLPROXY_SOCKS4,
"103.205.27.46", 52311, CURLPROXY_HTTP,
"103.206.201.179", 37938, CURLPROXY_HTTP,
"103.211.8.125", 4145, CURLPROXY_SOCKS4,
"103.221.254.2", 36778, CURLPROXY_HTTP,
"103.226.142.90", 47460, CURLPROXY_SOCKS4,
"103.226.227.218", 43010, CURLPROXY_HTTP,
"103.229.177.51", 45275, CURLPROXY_HTTP,
"103.237.174.82", 55326, CURLPROXY_HTTP,
"103.243.82.234", 59063, CURLPROXY_SOCKS4,
"103.248.31.244", 4145, CURLPROXY_SOCKS4,
"103.255.148.26", 35242, CURLPROXY_HTTP,
"105.255.223.2", 8080, CURLPROXY_HTTP,
"109.87.193.112", 33620, CURLPROXY_HTTP,
"109.225.41.174", 47234, CURLPROXY_HTTP,
"109.245.214.49", 42004, CURLPROXY_HTTP,
"110.36.218.126", 36651, CURLPROXY_HTTP,
"110.74.193.235", 53569, CURLPROXY_HTTP,
"110.74.196.9", 54848, CURLPROXY_HTTP,
"110.74.219.10", 30906, CURLPROXY_HTTP,
"1.10.186.48", 38104, CURLPROXY_HTTP,
"1.10.186.157", 51976, CURLPROXY_HTTP,
"1.10.187.6", 31097, CURLPROXY_HTTP,
"1.10.188.12", 35573, CURLPROXY_HTTP,
"1.10.188.205", 43580, CURLPROXY_HTTP,
"1.20.97.166", 32588, CURLPROXY_HTTP,
"1.20.99.176", 47005, CURLPROXY_HTTP,
"1.20.99.185", 44450, CURLPROXY_HTTP,
"1.20.100.42", 47962, CURLPROXY_HTTP,
"2.92.242.230", 40014, CURLPROXY_HTTP,
"3.8.44.17", 80, CURLPROXY_HTTP,
"3.8.121.95", 80, CURLPROXY_HTTP,
"5.19.142.82", 37589, CURLPROXY_HTTP,
"5.58.152.226", 60583, CURLPROXY_HTTP,
"5.128.32.12", 51959, CURLPROXY_HTTP,
"5.140.233.249", 33455, CURLPROXY_HTTP,
"5.157.115.235", 3128, CURLPROXY_HTTP,
"12.189.124.100", 44791, CURLPROXY_HTTP,
"13.233.72.134", 80, CURLPROXY_HTTP,
"18.219.3.105", 80, CURLPROXY_HTTP,
"18.220.245.122", 80, CURLPROXY_HTTP,
"18.228.217.208", 80, CURLPROXY_HTTP,
"24.172.34.114", 52143, CURLPROXY_HTTP,
"31.29.62.188", 4145, CURLPROXY_SOCKS4,
"31.42.254.24", 30912, CURLPROXY_HTTP,
"31.46.30.228", 51579, CURLPROXY_HTTP,
"31.145.137.166", 4145, CURLPROXY_SOCKS4,
"31.173.211.114", 43873, CURLPROXY_HTTP,
"31.200.228.169", 37293, CURLPROXY_HTTP,
"31.223.245.183", 4145, CURLPROXY_SOCKS4,
"34.244.2.233", 8123, CURLPROXY_HTTP,
"35.196.70.16", 80, CURLPROXY_HTTP,
"36.37.109.205", 808, CURLPROXY_HTTP,
"110.172.135.234", 53822, CURLPROXY_HTTP,
"110.235.198.3", 57660, CURLPROXY_HTTP,
"111.92.243.154", 37539, CURLPROXY_HTTP,
"113.11.47.242", 40071, CURLPROXY_HTTP,
"113.53.83.157", 35969, CURLPROXY_HTTP,
"113.108.242.36", 32655, CURLPROXY_SOCKS4,
"114.35.29.247", 42313, CURLPROXY_SOCKS4,
"115.127.39.66", 55474, CURLPROXY_HTTP,
"115.178.27.125", 48497, CURLPROXY_HTTP,
"116.212.152.128", 36041, CURLPROXY_HTTP,
"117.196.236.162", 43989, CURLPROXY_HTTP,
"118.172.201.109", 54347, CURLPROXY_HTTP,
"118.173.232.5", 55124, CURLPROXY_HTTP,
"118.173.232.43", 48204, CURLPROXY_HTTP,
"118.173.232.190", 13629, CURLPROXY_SOCKS4,
"118.174.234.129", 54431, CURLPROXY_HTTP,
"118.175.93.28", 61285, CURLPROXY_HTTP,
"118.175.93.164", 37694, CURLPROXY_HTTP,
"118.179.69.233", 44505, CURLPROXY_HTTP,
"118.179.84.106", 34236, CURLPROXY_HTTP,
"119.82.252.115", 49085, CURLPROXY_HTTP,
"119.82.253.155", 37436, CURLPROXY_HTTP,
"119.235.19.42", 38546, CURLPROXY_HTTP,
"119.252.175.38", 4550, CURLPROXY_HTTP,
"122.15.131.65", 57873, CURLPROXY_HTTP,
"122.102.41.82", 56067, CURLPROXY_HTTP,
"122.176.65.143", 42175, CURLPROXY_HTTP,
"124.41.211.213", 54986, CURLPROXY_HTTP,
"124.41.211.231", 49949, CURLPROXY_HTTP,
"124.41.213.203", 55187, CURLPROXY_HTTP,
"124.41.240.56", 50526, CURLPROXY_HTTP,
"125.27.251.208", 30753, CURLPROXY_HTTP,
"125.209.108.26", 53126, CURLPROXY_HTTP,
"128.40.76.198", 80, CURLPROXY_HTTP,
"128.201.97.156", 53281, CURLPROXY_HTTP,
"128.201.240.245", 4145, CURLPROXY_SOCKS4,
"130.193.112.146", 36923, CURLPROXY_HTTP,
"131.108.63.213", 57604, CURLPROXY_HTTP,
"131.255.4.49", 10770, CURLPROXY_HTTP,
"134.0.16.6", 47631, CURLPROXY_HTTP,
"138.36.108.30", 4145, CURLPROXY_SOCKS4,
"138.122.5.22", 61201, CURLPROXY_HTTP,
"138.186.122.105", 43602, CURLPROXY_HTTP,
"138.186.172.222", 33109, CURLPROXY_SOCKS4,
"139.178.127.128", 4145, CURLPROXY_SOCKS4,
"139.255.64.10", 41309, CURLPROXY_HTTP,
"141.101.236.49", 56000, CURLPROXY_HTTP,
"143.0.140.200", 3128, CURLPROXY_HTTP,
"149.255.243.78", 51372, CURLPROXY_SOCKS4,
"154.0.15.166", 49713, CURLPROXY_HTTP,
"154.41.2.154", 13538, CURLPROXY_HTTP,
"157.230.43.245", 8888, CURLPROXY_HTTP,
"159.192.97.83", 55938, CURLPROXY_HTTP,
"159.192.97.181", 23500, CURLPROXY_HTTP,
"163.53.150.230", 30195, CURLPROXY_HTTP,
"163.53.182.148", 39486, CURLPROXY_HTTP,
"165.90.211.69", 61692, CURLPROXY_HTTP,
"166.249.54.244", 55867, CURLPROXY_HTTP,
"167.99.79.1", 31330, CURLPROXY_HTTP,
"168.181.121.195", 51514, CURLPROXY_HTTP,
"168.205.84.55", 4145, CURLPROXY_SOCKS4,
"168.232.198.25", 32009, CURLPROXY_HTTP,
"169.255.67.244", 37804, CURLPROXY_HTTP,
"170.0.112.199", 50294, CURLPROXY_SOCKS4,
"170.0.112.226", 50294, CURLPROXY_SOCKS4,
"170.0.124.161", 4145, CURLPROXY_SOCKS4,
"170.79.121.38", 4145, CURLPROXY_SOCKS4,
"170.79.122.194", 4145, CURLPROXY_SOCKS4,
"170.79.123.26", 4145, CURLPROXY_SOCKS4,
"170.80.17.129", 40336, CURLPROXY_HTTP,
"170.80.52.33", 4145, CURLPROXY_SOCKS4,
"170.210.236.1", 34792, CURLPROXY_HTTP,
"170.231.140.150", 4145, CURLPROXY_SOCKS4,
"170.245.173.87", 4145, CURLPROXY_SOCKS4,
"172.96.224.179", 80, CURLPROXY_HTTP,
"175.100.5.52", 45940, CURLPROXY_HTTP,
"175.100.185.151", 53281, CURLPROXY_HTTP,
"176.98.75.120", 45259, CURLPROXY_HTTP,
"176.98.76.210", 45280, CURLPROXY_HTTP,
"176.103.45.27", 46994, CURLPROXY_HTTP,
"176.111.10.136", 46560, CURLPROXY_HTTP,
"176.119.18.92", 30996, CURLPROXY_HTTP,
"176.120.211.176", 58035, CURLPROXY_HTTP,
"176.196.238.234", 44648, CURLPROXY_HTTP,
"176.214.81.106", 41774, CURLPROXY_HTTP,
"176.221.112.82", 52094, CURLPROXY_HTTP,
"177.66.53.203", 43493, CURLPROXY_HTTP,
"177.66.255.232", 61798, CURLPROXY_HTTP,
"177.75.143.198", 43223, CURLPROXY_HTTP,
"177.220.171.54", 60729, CURLPROXY_HTTP,
"177.223.52.242", 42363, CURLPROXY_HTTP,
"178.32.59.233", 53281, CURLPROXY_HTTP,
"178.75.58.58", 41514, CURLPROXY_HTTP,
"178.92.9.210", 3128, CURLPROXY_HTTP,
"178.124.152.84", 52676, CURLPROXY_HTTP,
"178.128.58.122", 8080, CURLPROXY_HTTP,
"178.128.123.20", 8888, CURLPROXY_HTTP,
"178.150.242.139", 36086, CURLPROXY_HTTP,
"178.170.254.178", 46788, CURLPROXY_HTTP,
"178.217.168.77", 46062, CURLPROXY_HTTP,
"180.247.199.128", 8080, CURLPROXY_HTTP,
"181.112.57.34", 60148, CURLPROXY_HTTP,
"181.113.17.230", 59067, CURLPROXY_HTTP,
"181.113.135.254", 52058, CURLPROXY_HTTP,
"181.129.39.2", 29792, CURLPROXY_HTTP,
"181.191.241.179", 33670, CURLPROXY_SOCKS4,
"181.196.77.70", 53281, CURLPROXY_HTTP,
"181.196.147.98", 45882, CURLPROXY_HTTP,
"182.16.163.138", 8080, CURLPROXY_HTTP,
"182.52.51.15", 33680, CURLPROXY_HTTP,
"182.52.51.181", 3629, CURLPROXY_SOCKS4,
"182.53.206.40", 52214, CURLPROXY_HTTP,
"182.75.21.30", 46527, CURLPROXY_HTTP,
"182.253.201.10", 36776, CURLPROXY_HTTP,
"182.253.233.10", 8080, CURLPROXY_HTTP,
"183.81.157.178", 52555, CURLPROXY_HTTP,
"183.81.158.106", 4145, CURLPROXY_SOCKS4,
"185.59.244.161", 41258, CURLPROXY_HTTP,
"185.80.130.78", 3128, CURLPROXY_HTTP,
"185.112.249.187", 3128, CURLPROXY_HTTP,
"185.136.151.20", 58371, CURLPROXY_HTTP,
"185.162.57.251", 80, CURLPROXY_HTTP,
"185.194.24.187", 37854, CURLPROXY_HTTP,
"186.30.57.251", 48786, CURLPROXY_HTTP,
"186.38.39.22", 39524, CURLPROXY_HTTP,
"187.1.43.246", 53396, CURLPROXY_HTTP,
"187.87.241.25", 53386, CURLPROXY_HTTP,
"187.111.192.142", 30485, CURLPROXY_HTTP,
"188.121.103.187", 4145, CURLPROXY_SOCKS4,
"188.130.240.17", 52343, CURLPROXY_HTTP,
"188.186.182.125", 4145, CURLPROXY_SOCKS4,
"188.233.188.128", 31244, CURLPROXY_HTTP,
"189.127.35.51", 41615, CURLPROXY_HTTP,
"190.7.141.66", 47231, CURLPROXY_HTTP,
"190.53.46.14", 38618, CURLPROXY_HTTP,
"190.107.20.203", 4145, CURLPROXY_SOCKS4,
"190.128.135.130", 44915, CURLPROXY_SOCKS4,
"190.152.5.126", 53040, CURLPROXY_HTTP,
"190.193.8.28", 9999, CURLPROXY_SOCKS4,
"190.248.13.19", 50553, CURLPROXY_HTTP,
"190.248.136.18", 53963, CURLPROXY_HTTP,
"191.102.104.2", 80, CURLPROXY_HTTP,
"192.140.42.82", 39448, CURLPROXY_HTTP,
"193.59.101.12", 4145, CURLPROXY_SOCKS4,
"193.160.226.89", 53186, CURLPROXY_HTTP,
"194.67.37.90", 3128, CURLPROXY_HTTP,
"194.169.164.3", 57562, CURLPROXY_HTTP,
"195.39.71.252", 56935, CURLPROXY_HTTP,
"195.128.119.233", 4145, CURLPROXY_SOCKS4,
"195.177.75.106", 30297, CURLPROXY_HTTP,
"195.239.178.110", 40448, CURLPROXY_HTTP,
"196.18.215.37", 3128, CURLPROXY_HTTP,
"196.18.215.72", 3128, CURLPROXY_HTTP,
"196.18.215.75", 3128, CURLPROXY_HTTP,
"196.18.215.160", 3128, CURLPROXY_HTTP,
"196.18.215.230", 3128, CURLPROXY_HTTP,
"196.18.215.239", 3128, CURLPROXY_HTTP,
"196.32.109.73", 56930, CURLPROXY_HTTP,
"196.38.8.91", 8080, CURLPROXY_HTTP,
"196.201.206.129", 55625, CURLPROXY_HTTP,
"197.98.180.162", 61047, CURLPROXY_HTTP,
"197.232.55.224", 39385, CURLPROXY_HTTP,
"197.245.152.245", 38173, CURLPROXY_HTTP,
"197.248.224.242", 80, CURLPROXY_HTTP,
"198.144.108.36", 54321, CURLPROXY_SOCKS4,
"200.5.35.234", 4145, CURLPROXY_SOCKS4,
"200.7.205.194", 51910, CURLPROXY_HTTP,
"200.35.49.73", 45186, CURLPROXY_HTTP,
"200.71.123.185", 34343, CURLPROXY_HTTP,
"200.195.188.2", 32954, CURLPROXY_HTTP,
"200.255.122.170", 8080, CURLPROXY_HTTP,
"201.234.253.24", 59238, CURLPROXY_HTTP,
"202.3.72.6", 38725, CURLPROXY_HTTP,
"202.49.183.168", 30309, CURLPROXY_HTTP,
"202.57.39.126", 4145, CURLPROXY_SOCKS4,
"202.57.49.193", 4145, CURLPROXY_SOCKS4,
"202.57.55.242", 52634, CURLPROXY_HTTP,
"202.61.52.14", 60267, CURLPROXY_HTTP,
"202.84.79.11", 41247, CURLPROXY_HTTP,
"202.93.226.170", 4145, CURLPROXY_SOCKS4,
"202.178.125.99", 33853, CURLPROXY_HTTP,
"203.17.150.95", 38498, CURLPROXY_HTTP,
"203.76.147.26", 45684, CURLPROXY_HTTP,
"203.81.176.254", 49901, CURLPROXY_HTTP,
"203.129.195.183", 80, CURLPROXY_HTTP,
"203.142.69.242", 47619, CURLPROXY_HTTP,
"203.160.58.117", 4145, CURLPROXY_SOCKS4,
"203.174.15.234", 40604, CURLPROXY_HTTP,
"203.177.133.148", 44632, CURLPROXY_HTTP,
"206.189.137.227", 3128, CURLPROXY_HTTP,
"208.77.8.25", 54321, CURLPROXY_SOCKS4,
"208.98.185.89", 53630, CURLPROXY_HTTP,
"210.3.215.56", 8080, CURLPROXY_HTTP,
"210.16.120.108", 3128, CURLPROXY_HTTP,
"212.28.237.131", 59588, CURLPROXY_HTTP,
"212.72.159.174", 50323, CURLPROXY_HTTP,
"212.90.162.54", 50819, CURLPROXY_HTTP,
"212.154.200.6", 80, CURLPROXY_HTTP,
"213.6.67.86", 32586, CURLPROXY_HTTP,
"213.6.199.94", 41320, CURLPROXY_HTTP,
"213.23.110.196", 8080, CURLPROXY_HTTP,
"213.87.42.53", 40367, CURLPROXY_HTTP,
"213.174.6.207", 43935, CURLPROXY_SOCKS4,
"217.113.17.226", 50948, CURLPROXY_HTTP,
"221.120.163.242", 56969, CURLPROXY_HTTP,
#endif
NULL, 0, 0,
};
#ifdef _WIN32
#define WAITMS(x) Sleep(x)
#else
/* Portable sleep for platforms other than Windows. */
#define WAITMS(x) \
struct timeval wait = { 0, (x) * 1000 }; \
(void)select(0, NULL, NULL, NULL, &wait);
#endif
#define N_PARALLEL 400
struct urlpriv {
char errormsg[CURL_ERROR_SIZE];
struct timeval start;
};
int main(void)
{
CURLM *mh;
int still_running = 0; /* keep number of running handles */
int added = 0;
/* init a multi stack */
mh = curl_multi_init();
do {
CURLMcode mc; /* curl_multi_wait() return code */
int numfds;
CURLMsg *msg;
int msgs_left;
while(proxies[added].ip && (still_running < N_PARALLEL)) {
CURL *e = curl_easy_init();
char proxybuf[128];
struct urlpriv *p = calloc(1, sizeof(struct urlpriv));
gettimeofday(&p->start, NULL);
snprintf(proxybuf, sizeof(proxybuf), "%s:%u",
proxies[added].ip, proxies[added].port);
curl_easy_setopt(e, CURLOPT_URL, "https://www.example.com/");
curl_easy_setopt(e, CURLOPT_CONNECTTIMEOUT_MS, 3000L);
curl_easy_setopt(e, CURLOPT_TIMEOUT_MS, 4000L);
curl_easy_setopt(e, CURLOPT_PROXY, proxybuf);
curl_easy_setopt(e, CURLOPT_PROXYTYPE, proxies[added].type);
curl_easy_setopt(e, CURLOPT_ERRORBUFFER, p->errormsg);
curl_easy_setopt(e, CURLOPT_PRIVATE, p);
curl_multi_add_handle(mh, e);
still_running++;
added++;
}
#if 0
fprintf(stderr, "Perform %d parallel transfers\n", still_running);
#endif
/* we start some action by calling perform right away */
curl_multi_perform(mh, &still_running);
while ((msg = curl_multi_info_read(mh, &msgs_left))) {
if (msg->msg == CURLMSG_DONE) {
CURL *e = msg->easy_handle;
struct urlpriv *p;
struct timeval now;
long diff;
long us;
gettimeofday(&now, NULL);
curl_easy_getinfo(e, CURLINFO_PRIVATE, &p);
diff = (long)now.tv_sec-p->start.tv_sec;
us = diff * 1000000 + ((long)now.tv_usec - (long)p->start.tv_usec);
if(msg->data.result != CURLE_OK) {
double time;
curl_off_t ttime;
curl_easy_getinfo(e, CURLINFO_TOTAL_TIME, &time);
curl_easy_getinfo(e, CURLINFO_TOTAL_TIME_T, &ttime);
fprintf(stderr, "returned: %d - %s time:%.3f / %ld us (real: %ld)\n",
msg->data.result, p->errormsg, time, (long)ttime,
us);
}
free(p);
curl_multi_remove_handle(mh, e);
curl_easy_cleanup(e);
}
}
/* wait for activity, timeout or "nothing" */
mc = curl_multi_wait(mh, NULL, 0, 1000, &numfds);
if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_wait() failed, code %d.\n", mc);
break;
}
} while(still_running);
curl_multi_cleanup(mh);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.