Problems Returning an HTTP 200 Ok Message

samwyse samwyse at gmail.com
Mon Jul 14 22:45:21 CEST 2008


On Jul 10, 4:10 pm, Guy Davidson <GDavids... at gmail.com> wrote:

> I try to send the following message, using the socket.send() command:
>
> 'HTTP/1.1 200 OK\r\nDate: Thu, 10 July 2008 14:07:50 GMT\r\nServer:
> Apache/2.2.8 (Fedora)\r\nX-Powered-By: PHP/5.2.4\r\nContent-Length: 4\r
> \nConnection: close\r\nContent-Type: text/html; charset=UTF-8\r\n\r
> \n[0]\n'
>
> However, when I snoop on the packets in wireshark, here's what I see:
>
> HTTP/1.1 200 Ok:
>
> HTTP/1.1 200 OK
> Date: Wed, 09 July 2008 14:55:50 GMT
> Server: Apache/2.2.8 (Fedora)
> X-Powered-By:
>
> Continuation or non-HTTP traffic:
>
> PHP/5.2.4
> Content-Length: 4
> Connection: close
> Content-Type: text/html; charset=UTF-8
>
> [0]
>
> It splits into two packages, which the meter can't read, and the
> communication breaks down there.

OK, it looks like a single TCP segment is being sent by you (which is
consistent with only one socket.send() command being needed), but
something along the way to the meter is using an MTU (Maximum
Transmission Unit) of about 100 bytes, producing two IP datagrams.
How many hops are there between the PC and the meter?  Are you
sniffing on the same subnet as the PC, the meter, or somewhere in
between?  MTU is normally set to about 1500 (and MSS is generally
MTU-40), but you can generally change these values.

You should be able to set the do-not-fragment flag on your IP packets,
but that may cause them to get dropped instead of sent.  You could
also try setting a smaller ICP MSS (Maximum Segment Size), which the
meter might be able to assemble, even if it can't handle fragmented IP
datagrams.  Try http://www.cisco.com/en/US/tech/tk870/tk877/tk880/technologies_tech_note09186a008011a218.shtml#prob_desc
for more help.

You really need to get a networking guru involved if you want to go
down this path.  I used to be one, but that was years ago.  Or, you
can take Gabriel Genellina's advice and try coding smaller responses.



More information about the Python-list mailing list