NetTalk Central

Author Topic: Possible Bug in p_web.GetValue  (Read 2919 times)

Mark Sarson

  • Newbie
  • *
  • Posts: 33
    • View Profile
    • Email
Possible Bug in p_web.GetValue
« on: May 30, 2011, 04:33:55 PM »
Hi,

I'm testing the SagePay payment gateway. All is going quite well apart from a problem with the returned information from Sage.

They use Base64 encoding of a simple xor encryption, and this is a small snippet of what they return for a value called Crypt:

MQVW5mDy8cLwV3cWEqXHt3b0AUdx8+Yj08eFFoFF4K

However when I use MyVar =  p_web.GetValue('Crypt'), MyVar contains

MQVW5mDy8cLwV3cWEqXHt3b0AUdx8 Yj08eFFoFF4K

Notice the + has been replaced by a space.

Now I have fixed my code up to replace the spaces GetValue returns with the + and I can decode without any problem.

So my question is, is this expected behavior or is there a bug?

Kinds regards

Mark

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Possible Bug in p_web.GetValue
« Reply #1 on: May 30, 2011, 07:27:22 PM »
You don't specify where the value is coming from ( cookie, URL or post-data) but yes, this is expected, and probably correct behavior.

Data received into the value queue is URL-encoded, meaning that spaces are sent as a +, and every other non-alpha-numeric (including a +) is encoded using the %XX technique.

Cheers
Bruce

Mark Sarson

  • Newbie
  • *
  • Posts: 33
    • View Profile
    • Email
Re: Possible Bug in p_web.GetValue
« Reply #2 on: May 31, 2011, 12:02:32 AM »
Hi Bruce

Thanks for the reply.

The data was coming from the URL.

I was just confused for a little while as my decode of the data was not returning the results as expected.

It was easy to solve when I worked out that I needed to replace the spaces back to pluses.

Cheers

Mark