| View previous topic :: View next topic |
| Author |
Message |
Staffan Guest
|
Posted: Mon Dec 20, 2004 2:48 pm Post subject: Needs help with Indy and EncodeParams |
|
|
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
|
Posted: Mon Dec 20, 2004 9:06 pm Post subject: Re: Needs help with Indy and EncodeParams |
|
|
"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
|
Posted: Tue Dec 21, 2004 7:14 am Post subject: Re: Needs help with Indy and EncodeParams |
|
|
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 |
|
 |
|