Emmanuel writes: 

---x8 snip

> 2. I've noticed one recurring error in my log files - in my 
> HttpRequestDecoder (extends MessageDecoderAdapter), I am throwing an 
> exception trying to parse up the headers - the code ends up getting "partial 
> line" headers (for example, the decoder attempts to parse a line "Content-Ty" 
> with nothing else on the line) - it seems like the HTTP packet is not 
> complete - should I be concerned about this? An exception is thrown, and the 
> caller will re-send anyways, but the error is seen a fair bit throughout the 
> logs, and I'm wondering if this might be contributing to the lock up issue 
> (?).
   
You have no guarantee that the messages sent by a client will be received 
fully. They can even been sent one byte at a time. It's up to you to gather all 
the incoming bytes until you have enough bytes to decode your protocol. In your 
case, however, you can use the TextLineDecoder which waits for a line feed to 
forward the decoded message to your handler.

---x8 snip

I am using a custom HttpRequestDecoder (which subclasses 
MessageDecoderAdaptor). The 'decodable' method looks correct, but then when 
'decode' gets called, the buffer is incomplete - I can't figure that out. 
Almost invariably, the 'decode' method fails on an incomplete header line - I 
see a truncated header 'Content-Ty' repeatedly in the logs. 

A lot of this code was written > 1 year ago and based on M1. Should I be 
decoding differently?

Thanks.

Brian Parkinson
ecobee.com



Reply via email to