Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite stuck #83

Open
Fonix420 opened this issue May 24, 2020 · 29 comments
Open

Infinite stuck #83

Fonix420 opened this issue May 24, 2020 · 29 comments
Labels
bug Something isn't working next release Will be in the next release

Comments

@Fonix420
Copy link

Fonix420 commented May 24, 2020

If you try to make any kind of request with a proxy which is also a url it will get stuck without crashing or ever moving forward

ex. 77.74.231.21:8028 which is also a site

example as it only happens on some sites:
Capture

@abhay991
Copy link

Hi, yes that is known issue in .net framework where it just doesn't timeout for some reason and idk if there is any solution to this but best alternative to this would be using httpclient and use wait method with timeout parameter.

@grandsilence
Copy link
Member

Without a proxy, is the problem still showing up?

@grandsilence grandsilence added bug Something isn't working help wanted Extra attention is needed labels May 26, 2020
@grandsilence
Copy link
Member

Is there a problem with .NET Core?

@Fonix420
Copy link
Author

Is there a problem with .NET Core?

Yes it is with .net core too, no only with this specific proxy(or any proxy which is also a url)

@grandsilence
Copy link
Member

Is there a problem with .NET Core?

Yes it is with .net core too, no only with this specific proxy(or any proxy which is also a url)

@Fonix420 thank you for reporting. I'll try to fix that on the week.

@grandsilence
Copy link
Member

grandsilence commented May 26, 2020

Fixed by adding UserAgent header for http://77.74.231.21:8028/.

var req = new HttpRequest();
req.UserAgent =
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36";

var resp = req.Get("http://77.74.231.21:8028/");
string respStr = resp.ToString();

More URLs needed for tests.

@grandsilence grandsilence added the insufficient info There is not enough information about the issue. label May 26, 2020
@Fonix420
Copy link
Author

Fixed by adding UserAgent header for http://77.74.231.21:8028/.

var req = new HttpRequest();
req.UserAgent =
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36";

var resp = req.Get("http://77.74.231.21:8028/");
string respStr = resp.ToString();

More URLs needed for tests.

Look at the image on the main post. The issue is send a request to that specific site while using the url as a proxy.

@Fonix420
Copy link
Author

Fonix420 commented May 27, 2020

Fixed by adding UserAgent header for http://77.74.231.21:8028/.

var req = new HttpRequest();
req.UserAgent =
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36";

var resp = req.Get("http://77.74.231.21:8028/");
string respStr = resp.ToString();

More URLs needed for tests.

            var proxy = "77.74.231.21:8028";
            cleint.Proxy = HttpProxyClient.Parse(proxy);

            cleint.Cookies = new CookieStorage();
            cleint.Proxy.ConnectTimeout = 5000;
            cleint.Proxy.ReadWriteTimeout = 5000;
            cleint.ConnectTimeout = 5000;
            cleint.ReadWriteTimeout = 5000;
            cleint.KeepAliveTimeout = 5000;

            var html = cleint.Get("http://proxydb.net/anon");

            Console.WriteLine(html);

            Console.ReadKey();```

Try this code

grandsilence added a commit that referenced this issue May 27, 2020
@grandsilence grandsilence removed the insufficient info There is not enough information about the issue. label May 27, 2020
@grandsilence
Copy link
Member

grandsilence commented May 27, 2020

Should be fixed in v5.2.9.
Already published on NuGet.

@grandsilence
Copy link
Member

grandsilence commented May 27, 2020

@Fonix420 @abhay991 I need your feedback.

@Fonix420
Copy link
Author

@Fonix420 @abhay991 I need your feedback.

Im still having issues, same thing. It's just stuck on the get request

@grandsilence
Copy link
Member

@Fonix420 @abhay991 I need your feedback.

Im still having issues, same thing. It's just stuck on the get request

It's stuck on .Get() call or on .ToString() call? Without proxy too?

@Fonix420
Copy link
Author

@Fonix420 @abhay991 I need your feedback.

Im still having issues, same thing. It's just stuck on the get request

It's stuck on .Get() call or on .ToString() call? Without proxy too?

On .Get(), only with this specific proxy on this specific site. All proxies which are also urls gets this issue on this url

@abhay991
Copy link

abhay991 commented May 27, 2020

@Fonix420 @abhay991 I need your feedback.

If i am not wrong i have faced this issue with webrequests in past as well. I have faced situation with (xNet) where it didn't timeout for hour as well. According to Docs this might be an issue.

A Domain Name System (DNS) query may take up to 15 seconds to return or time out. If your request contains a host name that requires resolution and you set Timeout to a value less than 15 seconds, it may take 15 seconds or more before a WebException is thrown to indicate a timeout on your request.

https://docs.microsoft.com/en-us/dotnet/api/system.net.httpwebrequest.timeout?view=netframework-4.5

@grandsilence
Copy link
Member

grandsilence commented May 27, 2020

@Fonix420 Just tried to use 77.74.231.21:8028 proxy in Chrome, it's not working.
Also I've tried nativeHttpClient:

private static void HttpClientTest()
{
    var httpHandler = new HttpClientHandler {
        Proxy = new WebProxy("77.74.231.21:8028")
    };
    
    var httpClient = new HttpClient(httpHandler);
    httpClient.DefaultRequestHeaders.ExpectContinue = false;
    httpClient.DefaultRequestHeaders.UserAgent.TryParseAdd(
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36"
    );

    var res = httpClient.GetStringAsync("http://proxydb.net/anon");
    var str = res.Result;
}

77.74.231.21:8028 is just not a correct proxy server I think.
It's returning playlist stream instead of requested HTTP resource.
Without proxy or using correct proxy I haven't any issues on Net Framework 4.6.1.

@grandsilence grandsilence added the insufficient info There is not enough information about the issue. label May 27, 2020
@grandsilence
Copy link
Member

Should be fixed in v5.2.10 without side-effects.
Any feedback?

@Fonix420
Copy link
Author

Should be fixed in v5.2.10 without side-effects.
Any feedback?

Same issue, try the exact code i sent before and you will see

@grandsilence
Copy link
Member

Should be fixed in v5.2.10 without side-effects.
Any feedback?

Same issue, try the exact code i sent before and you will see

Without proxy? 77.74.231.21:8028 is not a valid proxy. It's streaming server.

@Fonix420
Copy link
Author

Should be fixed in v5.2.10 without side-effects.
Any feedback?

Same issue, try the exact code i sent before and you will see

Without proxy? 77.74.231.21:8028 is not a valid proxy. It's streaming server.

With proxy, i need it to timeout in the case that i get another proxy like this when testing. I made a parser which checks proxies from a source and that is why i need it to timeout on these proxies instead of hanging.

@grandsilence
Copy link
Member

grandsilence commented May 28, 2020

@Fonix420

Should be fixed in v5.2.10 without side-effects.
Any feedback?

Same issue, try the exact code i sent before and you will see

Without proxy? 77.74.231.21:8028 is not a valid proxy. It's streaming server.

With proxy, i need it to timeout in the case that i get another proxy like this when testing. I made a parser which checks proxies from a source and that is why i need it to timeout on these proxies instead of hanging.

Try using this proxy in any browser and you will realize that it doesn't work. To check the proxy, you must check the response from the proxy server and it must match the requested resource. What Timeout are you talking about if your proxy server is not a proxy server, but is streaming an infinite media stream.

@Fonix420
Copy link
Author

@Fonix420

Should be fixed in v5.2.10 without side-effects.
Any feedback?

Same issue, try the exact code i sent before and you will see

Without proxy? 77.74.231.21:8028 is not a valid proxy. It's streaming server.

With proxy, i need it to timeout in the case that i get another proxy like this when testing. I made a parser which checks proxies from a source and that is why i need it to timeout on these proxies instead of hanging.

Try using this proxy in any browser and you will realize that it doesn't work. To check the proxy, you must check the response from the proxy server and it must match the requested resource. What Timeout are you talking about if your proxy server is not a proxy server, but is streaming an infinite media stream.

Yes i know but my tool looks for random proxies on sources and then tests them. So once it finds a proxy like this and tries to test it, it gets stuck. I need it to throw an exception or timeout.

@grandsilence
Copy link
Member

@Fonix420 Now I get it, thanks for the explanation. Will be fixed soon.

@Fonix420
Copy link
Author

@Fonix420 Now I get it, thanks for the explanation. Will be fixed soon.

Thanks, sorry for not explaining it better from the beginning.

@grandsilence grandsilence added next release Will be in the next release and removed insufficient info There is not enough information about the issue. help wanted Extra attention is needed labels May 28, 2020
@uahmad235
Copy link

uahmad235 commented Jan 24, 2021

I am also facing the same issue. Getting stuck forever on the Http GET method. POST works fine for me.
It is happening only in the case of HttpProxyClient.Parse and working fine for Other proxy types e.g., Socks5ProxyClient and Socks4ProxyClient. @grandsilence

@CripWalked
Copy link

you guys didnt set the proxy type when setting the proxy...
httpRequest.Proxy = ProxyClient.Parse(ProxyType.HTTP, proxy);
if this doesnt work, try using TRY & catch before requesting anything.
using (HttpRequest httpRequest = new HttpRequest()) { try { //request code here. } catch { } }

@xDiogow
Copy link

xDiogow commented Sep 29, 2021

you guys didnt set the proxy type when setting the proxy... httpRequest.Proxy = ProxyClient.Parse(ProxyType.HTTP, proxy); if this doesnt work, try using TRY & catch before requesting anything. using (HttpRequest httpRequest = new HttpRequest()) { try { //request code here. } catch { } }

Not working...

@CripWalked
Copy link

you guys didnt set the proxy type when setting the proxy... httpRequest.Proxy = ProxyClient.Parse(ProxyType.HTTP, proxy); if this doesnt work, try using TRY & catch before requesting anything. using (HttpRequest httpRequest = new HttpRequest()) { try { //request code here. } catch { } }

Not working...

you probally did it wrong then, cant help

@xDiogow
Copy link

xDiogow commented Oct 1, 2021

you guys didnt set the proxy type when setting the proxy... httpRequest.Proxy = ProxyClient.Parse(ProxyType.HTTP, proxy); if this doesnt work, try using TRY & catch before requesting anything. using (HttpRequest httpRequest = new HttpRequest()) { try { //request code here. } catch { } }

Not working...

you probally did it wrong then, cant help

I switched to xNet and now is working lmao

@novacisadev
Copy link

I have an issue where it just wont return the response data, like it connects and does all the right things, but when I try to turn it into a string it sits for about 30 sec and returns this error:

IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond..

SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working next release Will be in the next release
Projects
None yet
Development

No branches or pull requests

7 participants