Is this product supported by anyone or have a forum for questions?
I might be reading the browser request in a wrong way
Add a println to the code to show what is read into the line variable.
NormR1
Posting Expert
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
ready() Returns: True if the next read() is guaranteed not to block for input, false otherwise. Note that returning false does not guarantee that the next read will block.
As far as I can see that means that it will return false when you have read zero or more lines but the next line is not yet in the buffer - which is quite likely over a web link. So you will exit your read loop as soon as you catch up with the input, not when the input is complete. You need a better way to detect when the whole file has been read - I don't know what to suggest, other than some trial and error.
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
for the larger files I get everything but the data (including the content-length header)
That's strange. Can you show what you do get?
Here's the trace output from my server with a POST:run(): 9 connection accepted: Socket[addr=/127.0.0.1,port=3635,localport=8080] TO:0
HndlReq.run(). Thread 9 started processing.
8 getRawReq: maxCnt=100000, available=8192, in=java.net.SocketInputStream@107077e
8 getRawReq..end: #char=553, last c=10, maxCnt=99986, available=8192
HandleRequest.run(): request follows: >
POST /servlet/ReturnSomething HTTP/1.1
Host: 127.0.0.1:8080
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
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
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://127.0.0.1:8080/Testing/SendFile.html
Cookie: wowbb=%7C%7C%7C%7C-360
Content-Type: multipart/form-data; boundary=---------------------------182401216425542
Content-Length: 8591
< (end of request) <<<
NormR1
Posting Expert
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
Hey guys - sorry to butt in, but I really think I know what's wrong here. The read loop is terminating when the input buffer contains less than 1 line, guaranteed to before EOF if the file is > 1 TCP/IP block. Terminate the read loop only when readLine returns null or throws an Exception.
If I'm wrong please say so.
J
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
Sounds like something easy to test.
Otherwise add more debug to the read loop. Print out as much status as you can.
NormR1
Posting Expert
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
What about status like: available()
Look at your code. It looks like you are reading a line in two places and only testing at one place.
NormR1
Posting Expert
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
That's just an ordinary HTTP GET for the (site default) index.html file. No hint of anything being uploaded. It's waiting for you to send it index.html.
I think this is the wrong test case, or at least the wrong part of it.
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
What about status like: available()
For BufferedReader that would be the ready() call he used incorrectly before - it tells you if there are bytes sitting in a buffer waiting for you to read, but not if the source has finished sending any down the stream.
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073