[Simpleweb-Support] Folded headers
Brought to you by:
niallg
From: Richard B. <Ric...@se...> - 2007-12-18 14:22:47
|
Hi I am using a JBoss SAAJ client making requests in a simpleweb server. The requests are multipart and the content-type is a folded value. In my simple service when I inspect the headers it would seem the content-type header is truncated by several characters. I have used a 'packet sniffer' and the actual requests contains the correct information. Taking a look at the simpleweb code it would seem the request header parsing is deficient in respect to folded values. I believe the value method in the HeaderParser class should be changed to: private void value() { whitespace(); =20 value.off =3D off; value.len =3D 0; =20 for(int mark=3D 0; count < len;){ if(terminal(buf[off])) { /* CR or LF */ > for(int i =3D 1; count < len; i++){ if(buf[off] =3D=3D 10) { count++; /* skip the LF */ off++; =20 if(space(buf[off])) { value.len +=3D i; /* acount for bytes examined */ > mark +=3D i; break; /* folding line */ }=20 return; /* not a folding line */ }=20 count++; off++; } =20 } else { if(!space(buf[off])){ value.len=3D ++mark; } else { mark++; } count++; off++; =20 } } =20 } NB The lines prefixed with > have changed. =20 Prior to the change the value token length was only temporarily increased as the next line would overwrite it with the value from 'mark'. With this change mark is also increased to take into account the bytes examined and the count of bytes examined starts from 1 instead of 0. Can you tell me whether my change is valid? Cheers, Rich. |