I have a problem with my simple http server related to the size of the received request.
The following is a code snippet of the bit that handles the request.
Something strange is happening once the received packet hits 536 bytes, if I increase the sent data by just 1 byte, the browser errors with CONNECTION RESET.
But the stranger thing is, even increasing the transmitted by 1 or more bytes, the print() statement always shows 536 bytes, and even more strange is that the received data in the same print statement is not truncated and is 100% complete.
This is obviously something to do with the way I am reading the data.
I have spent several hours today tracking this down and would really appreciate some help ?!
Code: Select all
while True: conn, addr = self.sock.accept() raw = conn.recv(1024).decode('UTF-8') if not raw: print('Null Request.',addr) self.close(conn) else: print(raw,len(raw)) self.request(conn,raw)