cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-users list Archives

getpeername() failed with errno 57: Socket is not connected

From: Henrik Larsson <curl-user_at_spambox.dk>
Date: Fri, 26 Jul 2013 10:05:10 +0200

Hi Group,

I have installed "curl 7.31.0" on FreeBSD 8.4 using the port. I have an
issue with using CURL to download from a specific site.

If I try to download from the site directly, it fail with "getpeername()
failed with errno 57: Socket is not connected":
--cut--
% curl -v http://www.malwarepatrol.net
* Adding handle: conn: 0x801286300
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x801286300) send_pipe: 1, recv_pipe: 0
* About to connect() to www.malwarepatrol.net port 80 (#0)
* Trying 141.101.116.91...
* Connected to www.malwarepatrol.net (141.101.116.91) port 80 (#0)
* getpeername() failed with errno 57: Socket is not connected
> GET / HTTP/1.1
> User-Agent: curl/7.31.0
> Host: www.malwarepatrol.net
> Accept: */*
>
--cut--

If I add the host header manually and connect to the ip-address from
above it work:
--cut--
% curl -v -H 'host: www.malwarepatrol.net' 141.101.116.91
* About to connect() to 141.101.116.91 port 80 (#0)
* Trying 141.101.116.91...
* Adding handle: conn: 0x801286300
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x801286300) send_pipe: 1, recv_pipe: 0
   % Total % Received % Xferd Average Speed Time Time Time
Current
                                  Dload Upload Total Spent Left
Speed
* Connected to 141.101.116.91 (141.101.116.91) port 80 (#0)-:-- --:--:--
     0
> GET / HTTP/1.1
> User-Agent: curl/7.31.0
> Accept: */*
> host: www.malwarepatrol.net
>
< HTTP/1.1 200 OK
--cut--

Just by reference this is what happens when I use wget which also work:
--cut--
% wget --debug www.malwarepatrol.net
DEBUG output created by Wget 1.14 on freebsd8.4.

URI encoding = 'US-ASCII'
--2013-07-26 10:01:49-- http://www.malwarepatrol.net/
Resolving www.malwarepatrol.net (www.malwarepatrol.net)...
141.101.116.91,141.101.117.91
Caching www.malwarepatrol.net => 141.101.116.91 141.101.117.91
Connecting to www.malwarepatrol.net
(www.malwarepatrol.net)|141.101.116.91|:80..
                                                                          
                                                        . connected.
Created socket 3.
Releasing 0x0000000801404100 (new refcount 1).

---request begin---
GET / HTTP/1.1
User-Agent: Wget/1.14 (freebsd8.3)
Accept: */*
Host: www.malwarepatrol.net
Connection: Keep-Alive

---request end---
HTTP request sent, awaiting response...
---response begin---
HTTP/1.1 200 OK
--cut--

Please help me figure out why the first use case for curl fail?

Best regards
Henrik Larsson
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-07-26

These mail archives are generated by hypermail.

donate! Page updated May 06, 2013.
web site info

File upload with ASP.NET