[twsocket] D2009 and HttpClient

2009-03-09 Thread wayne forrest
Hello,

I am getting some Chinese again, if I cast it to AnsiString, I do not see
that data that I am expecting:
( I presume it is either something that I am not doing or it is a bug)


Here is my code:

var
 lData: TStringStream;
 lDataOut : TMemoryStream;
 lResultPage: string;
 I : Integer;
begin
  lDataOut := TMemoryStream.Create;
  lData :=  TStringStream.Create();
  //A post request would use lDataout to post data to server
  lDataOut.Seek(0, soFromBeginning);
  httpcli1.SendStream := lDataOut;
  httpcli1.RcvdStream := lData;

  HttpCli1.URL := Edit1.Text;
  HttpCli1.URL := HttpCli1.URL +'?MESSAGE=HELLO';
  HttpCli1.Get;

  lResultPage := lData.DataString;
  Memo1.Lines.Add(lResultPage);

  for I := 0 to HttpCli1.RcvdHeader.Count - 1 do begin
  Memo1.Lines.Add((AnsiString(HttpCli1.RcvdHeader[I])));
  end;

  lDataOut.Free;
  lData.Free;
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] D2009 and HttpClient

2009-03-09 Thread Arno Garrels
wayne forrest wrote:
 Hello,
 
 I am getting some Chinese again, if I cast it to AnsiString, I do not
 see that data that I am expecting:
 ( I presume it is either something that I am not doing or it is a bug)

I just tried with current SVN version and it works fine.
The AnsiString cast should not matter if the received headers contain
valid chars.
How does lResultPage look, I guess it contains Chinese as well?
Is the server self-written or some public webserver?

I recall as well that there was a bug with the receive buffer not always 
cleared which led to garbage in some rare cases. A fix was checked in with
revision #271.
In order to test whether this bug bites or not you could try with a non
persistent connection.

--
Arno Garrels 


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be