# Connection reset by peer

## niranjana_km

Hi,

I am getting "Connection reset by peer" for both wget and youtube-dl for using them with proxy.

```

$ http_proxy='http://46.50.175.146:3128' wget "http://www.linux-center.org/images/lc-logo2.jpg"

--2014-03-15 17:09:31--  http://www.linux-center.org/images/lc-logo2.jpg

Connecting to 46.50.175.146:3128... connected.

Proxy request sent, awaiting response... Read error (Connection reset by peer) in headers.

Retrying.

--2014-03-15 17:09:33--  (try: 2)  http://www.linux-center.org/images/lc-logo2.jpg

Connecting to 46.50.175.146:3128... connected.

Proxy request sent, awaiting response... Read error (Connection reset by peer) in headers.

Retrying.

--2014-03-15 17:09:36--  (try: 3)  http://www.linux-center.org/images/lc-logo2.jpg

Connecting to 46.50.175.146:3128... connected.

Proxy request sent, awaiting response... Read error (Connection reset by peer) in headers.

Retrying.

^C

```

```

$ https_proxy='https://46.50.175.146:3128' ./youtube-dl-20140303 -F "https://www.youtube.com/watch?v=WLIfmnlSkQ4"

[youtube] Setting language

WARNING: unable to set language: <urlopen error [Errno 104] Connection reset by peer>

[youtube] WLIfmnlSkQ4: Downloading webpage

ERROR: Unable to download webpage: <urlopen error [Errno 104] Connection reset by peer>

```

The proxy is alive and the same command for wget works fine in my old Fedora 16. Any fix and help to this problem is welcome. And the wget version in gentoo is as follows.

```

$ wget --version

GNU Wget 1.14 built on linux-gnu.

+digest +https +ipv6 -iri +large-file +nls -ntlm +opie +ssl/openssl 

Wgetrc: 

    /etc/wgetrc (system)

Locale: /usr/share/locale 

Compile: x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/etc/wgetrc" 

    -DLOCALEDIR="/usr/share/locale" -I. -I../lib -I../lib -DHAVE_LIBSSL 

    -march=corei7-avx -O2 -pipe 

Link: x86_64-pc-linux-gnu-gcc -DHAVE_LIBSSL -march=corei7-avx -O2 -pipe 

    -Wl,-O1 -Wl,--as-needed -lssl -lcrypto -lz -lpcre -lrt ftp-opie.o 

    openssl.o ../lib/libgnu.a 

Copyright (C) 2011 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later

<http://www.gnu.org/licenses/gpl.html>.

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

Originally written by Hrvoje Niksic <hniksic@xemacs.org>.

Please send bug reports and questions to <bug-wget@gnu.org>.

```

[/i][/b]

But in my old fedora 16 it is wget 1.12.

----------

## khayyam

niranjana_km ... works here (wget-1.14):

```
# http_proxy='http://46.50.175.146:3128' wget "http://www.linux-center.org/images/lc-logo2.jpg"

--2014-03-15 13:32:20--  http://www.linux-center.org/images/lc-logo2.jpg

Connecting to 46.50.175.146:3128... connected.

Proxy request sent, awaiting response... 200 OK

Length: 4686 (4.6K) [image/jpeg]

Saving to: 'lc-logo2.jpg'

100%[===============================================>] 4,686 --.-K/s   in 0s      

2014-03-15 13:32:22 (9.56 MB/s) - 'lc-logo2.jpg' saved[4686/4686]
```

.... and net-misc/youtube-dl-2014.02.10 (though the link you provided seems to be spam or what-have-you and removed by youtube) ...

```
# https_proxy='https://46.50.175.146:3128' youtube-dl https://www.youtube.com/watch?v=wZV4wP2KVGY

[youtube] Setting language

[youtube] wZV4wP2KVGY: Downloading webpage

[youtube] wZV4wP2KVGY: Downloading video info webpage

[youtube] wZV4wP2KVGY: Extracting video information

[download] Destination: 3 Minutes in the life of a Gentoo Penguin.-wZV4wP2KVGY.mp4

[download] 100% of 7.16MiB in 01:09
```

So, possibly something re your network configuration, maybe the ipv6 useflag, try the following:

```
# echo "prefer-family = IPv4" >> ~/.wgetrc
```

best ... khay

----------

## niranjana_km

Thanks for the reply. I tried the following

```

$ echo "prefer-family = IPv4" >> ~/.wgetrc

```

But the problem continues. Please suggest me regarding configuring my network. My network is handled by Networkmanager and I tried to keep my system as simple as possible. The services I use are,

```

$ rc-status 

Runlevel: default

 dbus                                                              [  started  ]

 syslog-ng                                                         [  started  ]

 consolekit                                                        [  started  ]

 NetworkManager                                                    [  started  ]

 sshd                                                              [  started  ]

 local                                                             [  started  ]

Dynamic Runlevel: hotplugged

Dynamic Runlevel: needed

Dynamic Runlevel: manual

```

And the kernel is hardened kernel (3.11.2-hardened-gnu).

----------

## khayyam

 *niranjana_km wrote:*   

> Please suggest me regarding configuring my network. My network is handled by Networkmanager and I tried to keep my system as simple as possible.

 

niranjana_km ... well, it may be the network beyond your particular machine, but that was simply a guess given that it works here and the only concrete difference I see is that your wget build has USE="ipv6". Both your clients are able to connect to the proxy but the connection is reset, this may be due to the proxy having a client/service limit (who knows) or some other factor relating to your network (gateway firewall, or what-have-you) ... basically, I can't even begin to troubleshoot it from here.

You might try enabling the 'debug' useflag on wget and using the '--debug' switch, it might provide more information as to why the connection is reset.

best ... khay

----------

