You are not logged in.

#1 2009-06-22 10:55:22

rine
Member
From: Germany
Registered: 2008-03-04
Posts: 217

wget - Connection timed out when using "long" strings

I'm having a problem with a little script to change some settings for IP-phones. Here is the script:

#!/bin/bash
for i in "0" #"4"
do
    for j in $(seq 176 176)
    do
        wget --timeout=1 --tries=1 --keep-session-cookies --save-cookies cookies.txt --post-file=postfile http://192.168.$i.$j/dologin.htm
        wget --timeout=1 --tries=1 --load-cookies cookies.txt --post-file=postfile2 http://192.168.$i.$j/update.htm
    done
done

postfile looks like this and is just for logging in:

P2=<pass>&

postfile2 looks like this:

P270=123456&

The problem now is, when using it like above, everything works fine. But if I make the text in postfile2 one character longer, I get this:

Connecting to 192.168.0.176:80... connected.
HTTP request sent, awaiting response... Read error (Connection timed out) in headers.
Giving up.

It doesn't matter where I put the character to make the string longer (I can for example use P32=1234567& and it works). I have tested the script from different machines and used different phones, always the same. Any ideas?

Offline

#2 2009-06-23 20:52:04

daf666
Member
Registered: 2007-04-08
Posts: 470
Website

Re: wget - Connection timed out when using "long" strings

Please show the request (use wireshark).

Offline

#3 2009-06-24 15:44:37

rine
Member
From: Germany
Registered: 2008-03-04
Posts: 217

Re: wget - Connection timed out when using "long" strings

I made 2 tcpdumps, one working, the other not: http://www.iq-kunden.de/tcpdump/

Offline

#4 2009-06-24 17:21:51

daf666
Member
Registered: 2007-04-08
Posts: 470
Website

Re: wget - Connection timed out when using "long" strings

The two files look identical, are you sure that the "bad" one is actually a capture of the timed out session? (both have same data length and same value in the content-length header).
Anyway, this timeout might occur, if for some reason wget will say content length is 10 and send only 9 characters in the post request..

Offline

#5 2009-06-24 19:08:51

rine
Member
From: Germany
Registered: 2008-03-04
Posts: 217

Re: wget - Connection timed out when using "long" strings

daf666 wrote:

The two files look identical, are you sure that the "bad" one is actually a capture of the timed out session? (both have same data length and same value in the content-length header).

Yes, they are different and the bad is is from the timeout smile.

daf666 wrote:

Anyway, this timeout might occur, if for some reason wget will say content length is 10 and send only 9 characters in the post request..

Any idea what I can do about it? There is something fishy going on. I did this once before a few month ago when I wanted to change other settings. I tried to do the same thing again but even this doesn't work anymore. Maybe I should just try curl yikes.

Offline

#6 2009-06-24 19:29:57

daf666
Member
Registered: 2007-04-08
Posts: 470
Website

Re: wget - Connection timed out when using "long" strings

rine wrote:

Yes, they are different and the bad is is from the timeout smile.

kinda doesnt make sense, coz if you look at bad.trace, you can see a normal 200OK server reply, so wget had no reason to complain.

Offline

#7 2009-06-25 07:44:38

rine
Member
From: Germany
Registered: 2008-03-04
Posts: 217

Re: wget - Connection timed out when using "long" strings

daf666 wrote:
rine wrote:

Yes, they are different and the bad is is from the timeout smile.

kinda doesnt make sense, coz if you look at bad.trace, you can see a normal 200OK server reply, so wget had no reason to complain.

Well, it is as I said. Maybe I should say that the first wget works and the second doesn't? yikes

Offline

Board footer

Powered by FluxBB