BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Needs help with Indy and EncodeParams

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
Staffan
Guest





PostPosted: Mon Dec 20, 2004 2:48 pm    Post subject: Needs help with Indy and EncodeParams Reply with quote



Hi all,

I have a client app that is supposed to authenticate a mobile-phone using
its number like in the following client-code:

try
IdHTTP1 := TIdHTTP.Create(Self);

request :=
'http://MyServer/scripts/Authenticate.dll/Authenticate?prm1=+461112223&Datab
ase=FireBird'
response := IdHTTP1.Get(request);
finally
FreeAndNil(IdHTTP1);
end;

Checking the IdHTTP1 .HttpOptions I found it to be [hoForceEncodeParams]


On the server-side I use Web-Broker and log the incoming request like this:

procedure TWebModule2.WebModule2AuthenticateAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
reqList : TStringList;
begin
try
reqList := TStringList.Create;
if Request.MethodType = mtPost then
Request.ExtractContentFields(reqList)
else
Request.ExtractQueryFields(reqList);

WriteToLog(LogFileName, reqList.Text);

and find it to be: prm1=461112223

My question: where did the '+'-sign go?
I thought that ForceEncodeParams whould make the request transparent to '+'

Regards
Staffan


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Mon Dec 20, 2004 9:06 pm    Post subject: Re: Needs help with Indy and EncodeParams Reply with quote




"Staffan" <Staffan.Bergbom (AT) lm (DOT) se> wrote


Quote:
request :=

'http://MyServer/scripts/Authenticate.dll/Authenticate?prm1=+461112223&Datab
ase=FireBird'

That request is not valid. It needs to be this instead:

request :=
'http://MyServer/scripts/Authenticate.dll/Authenticate?prm1=%2B461112223&Dat
abase=FireBird'

"+" is not a legal character. It is your own responsibility to pass a valid
URL to Get().

Quote:
I thought that ForceEncodeParams whould make the request transparent to
'+'


hoForceEncodeParams only applies to Post(), not Get().


Gambit



Back to top
Staffan
Guest





PostPosted: Tue Dec 21, 2004 7:14 am    Post subject: Re: Needs help with Indy and EncodeParams Reply with quote



Thanks for your answer. That explains quite a lot to me.

Is there any routine I could use to assure that illegal characters are
converted properly to compose a valid URL?

Regards
Staffan

"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> skrev i meddelandet
news:41c73eae$1 (AT) newsgroups (DOT) borland.com...
Quote:

"Staffan" <Staffan.Bergbom (AT) lm (DOT) se> wrote in message
news:41c6e628$1 (AT) newsgroups (DOT) borland.com...

request :=


'http://MyServer/scripts/Authenticate.dll/Authenticate?prm1=+461112223&Datab
ase=FireBird'

That request is not valid. It needs to be this instead:

request :=

'http://MyServer/scripts/Authenticate.dll/Authenticate?prm1=%2B461112223&Dat
abase=FireBird'

"+" is not a legal character. It is your own responsibility to pass a
valid
URL to Get().

I thought that ForceEncodeParams whould make the request transparent to
'+'

hoForceEncodeParams only applies to Post(), not Get().


Gambit





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.