Problems with wget & curl?

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
al_c
DD-WRT Guru


Joined: 13 Apr 2013
Posts: 2134
Location: Ottawa Canada

PostPosted: Sun Jun 12, 2016 13:45    Post subject: Problems with wget & curl? Reply with quote
I have am running DD-WRT v3.0-r29362 on my router (with BusyBox v1.24.2).

When I open a PuTTY window and enter the command:
Code:
wget "usage-monitoring.com/current/YAMon3/Setup/gfmd.php" -U "YAMon-Setup" -qO "/tmp/yamonsetup.txt"


I get the response:
Code:
wget: error getting response: Connection reset by peer


If I run the command again, it works????
If I wait for several minutes, and try again, the first call fails again.

The URL works properly when you open it in a browser and if I replace the URL at my site with something like google.ca, the call works the first time but I'm still testing that.

I'm chasing my ISP to see if the problems are at their end.

Any suggestions on how to check whether the problem might be occurring elsewhere along the route?

Thx

Al
Sponsor
Psyxroid
DD-WRT User


Joined: 24 Jan 2016
Posts: 130
Location: Midwest, US

PostPosted: Mon Jun 13, 2016 0:28    Post subject: Reply with quote
2 thoughts here:

- try without the "-q" option in order to get more meaningful output that may reveal the actual error message. It could be http 500 internal server error for example. Busybox version of wget unfortunately does not have the -S option which prints the http headers for troubleshooting purposes.

- Any reason for using this specific user-agent? It is possible the web server is looking for certain browsers or user-agents.

_________________
Buffalo WZR‑600DHP (WZR-HP-AG300H)
al_c
DD-WRT Guru


Joined: 13 Apr 2013
Posts: 2134
Location: Ottawa Canada

PostPosted: Mon Jun 13, 2016 15:50    Post subject: Reply with quote
Psyxroid wrote:
2 thoughts here:

- try without the "-q" option in order to get more meaningful output that may reveal the actual error message. It could be http 500 internal server error for example. Busybox version of wget unfortunately does not have the -S option which prints the http headers for troubleshooting purposes.

- Any reason for using this specific user-agent? It is possible the web server is looking for certain browsers or user-agents.


Thanks for the suggestions.

Removing the `q` flag shows that it is getting bounced at the IP address for my site.

Removing the user agent did not help either.

I wrote the PHP page that the call requests. There is no logic on the page that checks the User Agent.

What is particularly intersting is that the first call fails but then the next ones do not (until you wait for several minutes and then the pattern repeats)

Al
Psyxroid
DD-WRT User


Joined: 24 Jan 2016
Posts: 130
Location: Midwest, US

PostPosted: Mon Jun 13, 2016 20:03    Post subject: Reply with quote
If the error shows the ip address of the webserver, then there is something not quite right.
I captured http headers while browsing the url by the ip address, then by the fqdn.
It seems that this is shared hosting webserver, and that the redirects are not working correctly with wget, only the browser works. (the shared hosting is running nginx, which reverse proxy to the apache webserver)

You may want to check with the webhost provider to see if they can help investigate. Though, my hunch is that the issue is with wget, not the webserver.


Code:
http://x.x.x.x/current/YAMon3/Setup/gfmd.php

GET /current/YAMon3/Setup/gfmd.php HTTP/1.1
Host: x.x.x.x
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive

HTTP/1.1 502 Bad Gateway
Server: nginx
Date: Mon, 13 Jun 2016 19:33:32 GMT
Content-Type: application/octet-stream
Transfer-Encoding: chunked
Connection: keep-alive
----------------------------------------------------------
http://usage-monitoring.com/current/YAMon3/Setup/gfmd.php

GET /current/YAMon3/Setup/gfmd.php HTTP/1.1
Host: usage-monitoring.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive

HTTP/1.1 200 OK
Date: Mon, 13 Jun 2016 19:33:45 GMT
Content-Type: text/html
Connection: keep-alive
Server: Apache/2
X-Powered-By: PHP/5.3.29
Vary: Accept-Encoding
Age: 0
Transfer-Encoding: chunked

_________________
Buffalo WZR‑600DHP (WZR-HP-AG300H)
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum