I am trying to extract the TR069 XML data from the HTTP packets which I have filtered from a stream. The problem is the number of packets in a TCP flow are different. I cannot find an optimum filtering rule to terminate my XML extraction from a flow.Is there any kind of packet or keyword that is found at the end of the TCP stream?
2 回答
TCP connection is closed to one direction by sending a FIN packet, and getting an ACK response. Similarly for the other direction. The connection may be closed for one direction and open for the other. Wikipedia has a nice description of TCP protocol operation.
Typically HTTP connection operates on top of a single TCP connection, such that the client closes the client -> server direction after sending the HTTP request and server closes server -> client direction after sending the HTTP response.
How about reading the Content-Length
attribute from the HTTP header, then you know how many bytes to read until the end of the HTTP message.