LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   curl and wget error 400 bad request (https://www.linuxquestions.org/questions/linux-networking-3/curl-and-wget-error-400-bad-request-843203/)

repo 11-09-2010 06:49 AM

curl and wget error 400 bad request
 
I use slackware current, and curl and wget give the following errors:

Code:

repo@cannabis ~]$ wget -r http://users.telenet.be/reggersjans
--2010-11-09 13:48:14--  http://users.telenet.be/reggersjans
Resolving users.telenet.be (users.telenet.be)... ::ffff:74.117.221.11, 74.117.221.11
Connecting to users.telenet.be (users.telenet.be)|::ffff:74.117.221.11|:80... connected.
HTTP request sent, awaiting response... 400 Bad Request
2010-11-09 13:48:16 ERROR 400: Bad Request.

repo@cannabis ~]$ curl http://users.telenet.be/reggersjans
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
    <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <META http-equiv="Refresh" content="0;url=http://www.directnicparking.com/">
</HEAD>

<BODY>
    <!-- 400 Bad Request -->
    <!-- The hostname specified (users.telenet.be) was not found on this server. -->
    <!-- tigershark/3.0.128 at <A href="http://www.directnic.com/">dn-fh20.directnic.com</A> -->

    <!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -->
    <!-- XXXXXX  Extra bytes to force IE to display this page  XXXXXX -->
    <!-- XXXXXX      (instead of its internal error page)      XXXXXX -->
    <!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -->

</BODY>
</HTML>
repo@cannabis ~]$

I can surf the sites with no problem.
Some sites work ok, others give the 400 error.
However, when I use puppy in VM, there is no problem with wget or curl

Any thoughts?


Thank you

bathory 11-09-2010 07:18 AM

Wrong dns resolution?
Quote:

host users.telenet.be
users.telenet.be has address 195.130.132.86
users.telenet.be has address 195.130.132.85

host 74.117.221.11
11.221.117.74.in-addr.arpa domain name pointer dn-fh20.directnic.com.

host 195.130.132.86
86.132.130.195.in-addr.arpa domain name pointer webcluster2b.telenet-ops.be
FYI both wget and curl work here (also Slackware current), using my local dns.

Regards

repo 11-09-2010 07:28 AM

Hi,

My local DNS gives the same output
Code:

root@cannabis repo]# host users.telenet.be
users.telenet.be has address 195.130.132.85
users.telenet.be has address 195.130.132.86
root@cannabis repo]#

Any idea why wget goes to 74.17.221.11 ?
I tried to change the DNS, but no go

Thank you

bathory 11-09-2010 07:50 AM

Do you have an entry for users.telenet.be in /etc/hosts?

repo 11-09-2010 10:42 AM

Quote:

Originally Posted by bathory (Post 4153597)
Do you have an entry for users.telenet.be in /etc/hosts?

No
But I added
Code:

195.130.132.85        users.telenet.be
And now it works.

But I don't understand why wget and curl don't use the global dns server, and why it goes to
74.117.221.11
The problem is with several sites.
ALso linuxquestions.org is redirected to 74.117.221.11
Other sites work ok


Kind regards

bathory 11-09-2010 04:04 PM

Hi,

wget and curl follow the order of the hosts line in /etc/nsswitch.conf. The default is "hosts: files dns", so they use first /etc/hosts and then dns trying to resolve a hostname. You can revert the order, so they use dns first and the hosts file afterwards, but it's better to leave it as is.

Anyway, take a look at /etc/resolv.conf and add you local dns first, as it can resolve the hostname in question. Maybe the existing 1st dns server cache is corrupted.

Regards

repo 11-10-2010 02:55 AM

Thank you bathory
The problem was /etc/resolv.conf
I had
Code:

search beginnerslinux.org
as the first entry
After deleting this, everything works OK

Kind regards


All times are GMT -5. The time now is 11:34 AM.