Mailing List Archive

POST data for base64
Hello All,

Recently we've developed small web application which, for some cases,
receives data in base64 format, as value of one fields of POST
request.
I've noticed that probably there's something wrong with decoding of
such data. E.g. + will become spaces (it's ok) but %3D still intact.
So we using URI::Decode to finally get what we need.
Hope you will clear my misunderstanding here?
We have latest Catalyst-Runtime (.11).

Thanks, Sergey

--
Love never fails.

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
Re: POST data for base64 [ In reply to ]
On 13 Apr 2012, at 09:00, Сергей Дмитриев wrote:

> Hello All,
>
> Recently we've developed small web application which, for some cases,
> receives data in base64 format, as value of one fields of POST
> request.
> I've noticed that probably there's something wrong with decoding of
> such data. E.g. + will become spaces (it's ok) but %3D still intact.
> So we using URI::Decode to finally get what we need.

There is no module called URI::Decode?

Either way, I don't think this is a Catalyst problem, and you could probably demonstrate this with a trivial one-liner - given the module you're actually using to decode things..

Cheers
t0m


_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
Re: POST data for base64 [ In reply to ]
On 2012-04-13 Сергей Дмитриев <s_dmitriev@inbox.ru> wrote:
> Recently we've developed small web application which, for some cases,
> receives data in base64 format, as value of one fields of POST
> request.
> I've noticed that probably there's something wrong with decoding of
> such data. E.g. + will become spaces (it's ok) but %3D still intact.

That does not look very much like base64… it looks much more like the
URI encoding.

(example: the string "a simple example" would encode to
"YSBzaW1wbGUgZXhhbXBsZQ==" in base64, but to "a+simple+example" or
"a%20simple%20example" in a URI)

Incidentally, most browsers will send data URI-encoded for forms, not
base64-encoded.

So I suspect that you data is not really base64.

If I'm correct, than Catalyst should decode the data for you
automatically. How are you accessing the request data? Have you tried
just dumping (via Data::Dumper, or Data::Printer) the value of
$c->request->body_parameters ?

--
Dakkar - <Mobilis in mobile>
GPG public key fingerprint = A071 E618 DD2C 5901 9574
6FE2 40EA 9883 7519 3F88
key id = 0x75193F88

The old complaint that mass culture is designed for eleven-year-olds
is of course a shameful canard. The key age has traditionally been
more like fourteen.
-- Robert Christgau, "Esquire"
Re: POST data for base64 [ In reply to ]
Thank you t0m. Just needed to make sure for myself it's not Catalyst by design.
Sergey

2012/4/13 Tomas Doran <bobtfish@bobtfish.net>:
>
> On 13 Apr 2012, at 09:00, Сергей Дмитриев wrote:
>
>> Hello All,
>>
>> Recently we've developed small web application which, for some cases,
>> receives data in base64 format, as value of one fields of POST
>> request.
>> I've noticed that probably there's something wrong with decoding of
>> such data. E.g. + will become spaces (it's ok) but %3D still intact.
>> So we using URI::Decode to finally get what we need.
>
> There is no module called URI::Decode?
>
> Either way, I don't think this is a Catalyst problem, and you could probably demonstrate this with a trivial one-liner - given the module you're actually using to decode things..
>
> Cheers
> t0m
>
>
> _______________________________________________
> List: Catalyst@lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/



--
Love never fails.

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/