HTTP Post received at Servlet contains CRLF
Hi, I have a midlet which send data via HTTP POST to a servlet. The data is written from a byte array via:
connector = (HttpConnection)Connector.open(aHostURL, Connector.READ_WRITE,true);
connector.setRequestMethod(HttpConnection.POST);
connector.setRequestProperty("User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0");
connector.setRequestProperty("Content-Language","en-CA");
connector.setRequestProperty("Content-length",Integer.toString(this.length()));
connector.setRequestProperty("Content-Type","application/binary");
connector.setRequestProperty("Accept","application/octet-stream" );
connector.setRequestProperty("Connection","close" );
outStream = connector.openOutputStream();
outStream.write(byteArray);
outStream.flush();
and then the data is read from a servlet via:
ServletInputStream sin = request.getInputStream();
byte[] data =newbyte[80];
int amountRead = sin.read(data, 0, data.length);
while (amountRead > 0){
for (int i=0; i<amountRead; i++){
System.out.print(data[i]);
}
totalAmountRead = totalAmountRead + amountRead;
amountRead = sin.read(data, 0, data.length);
}
Here is the data sent:
999999999999999999999999999999
and the data received:
491011310999999999999999999999
The frustrating thing is that at the beginning of the data read (from the servlet), there is a "491011310" (the "1310" being a crlf) before any of my data. I have researched the newsgoups, and tried various different parameters with no luck. It appears to be part of HTTP, but this should not be appearing in the POST data. Can someone give me some ideas to try out?
thanks
Don
>

