Mantis - Squeak
Viewing Issue Advanced Details
2119 Network minor always 10-24-05 21:30 07-12-06 22:35
closed 3.8  
none 3.9  
0002119: incorrect content length in HTTPSocket(class)>>httpPostDocument:args:accept:request:
In HTTPSocket (class)>>httpPostDocument:args:accept:request: the content length is sent as "argString size printString" and then a few lines later we see:

argString first = $? ifTrue: [ argString := argString copyFrom: 2 to: argString size].
    "umur - IE sends argString without a $? and swiki expects so"
    s sendCommand: argString.

This causes two less characters to be sent than we reported. The server's ability to handle this may vary but in my case, the last post variable has a CR included in its value.

I don't have the time to check if this is still an issue in 3.9 as I am at work but I didn't want this to get lost.

10-24-05 21:39   
I hadn't look at it in details, but the HTTPSocket class code is *awful*. Code is duplicated everywhere and would benefit from an extreme refactoring.

Concerning your precise point, I think the hack should be removed and callers must ensure that no '?' is ever passed with the meaning "beginning of arguments" at the beginning of argString.
10-24-05 22:17   
I agree, the code could definitely do with improvement in general.

As for removing the hack, this method generates the argString itself using HTTPSocket(class)>>argString: so that could be corrected to not include the ? and the relevent GET senders could add the ? in. Otherwise, the question mark *does* need to be removed to maintain compatibility. Even if the hack was moved to before the connection was made the content length would be correct. This is certainly by far the simplest fix.

It's almost certainly not the most "correct" fix but I'm not sure it's worth worrying about correctness much without starting a rewrite.
12-15-05 01:04   
I opted for the simplest fix discussed - moving the check up before sending the content length. I of course agree that this code is... well due for a real overhaul. But not tonight. :)
05-25-06 05:31   
Goran, could you revisit this one? It looks like your referenced change is in [^]

however attempting to merge that now into 3.9b-7032 appears to cause additional, I have to assume unrelated changes. However I'm not sure I'm looking at this correctly.
07-12-06 22:35   
in 3.9 for a long time