myGengo/mygengo-perl — Issue #1: "/" in job payload doesn't authenticate
Author: aemsley
Created: 2011-11-21 02:57:40+00:00
State: open

Via Zendesk:

Hello all,
I have found the following problem when trying to send a POST job request via the Perl library.
As soon as there is a "/" in the to-be-encrypted data (to generate the HMAC key), authentication will not pass.

Here is an example:

```perl

# ------------------------------
my $config = myGengo::Config::getInstance();
my $api_key = $config->api_key;
my $private_key = $config->private_key;

# get an instance of Jobs Client
my $job = myGengo::Api::factory('job');

my %job = (
"type" => "text",
"body_src" => "any text with forward slash / in it",
"lc_src" => "en",
"lc_tgt" => "de",
"tier" => "machine",
"use_preferred" => 0,
"auto_approve" => "true",
);

my %jobs = ("job" => \%job);

# sort jobs
tie my %sorted_jobs, 'Tie::Hash::Sorted', 'Hash' => \%jobs;

# Setup our base query parameters
my %params = (
"api_key" => $api_key,
"ts" => "".time()."",
"_method" => "post",
"data" => JSON::XS->new->ascii->encode(\%sorted_jobs)
);

# sort vars for mygengo encryption using private key
tie my %sorted_params, 'Tie::Hash::Sorted', 'Hash' => \%params;

# Send it...
$job->postJob('json', \%sorted_params);

# echo back server response
print $job->getResponseBody();

# ----------------------------------------
```

When I remove the forward slash from the text to be translated, it works fine.

========

We have tried double escaping and it does not solve the issue. I'd suggest we pump the Perl lib up to v1.1 to solve this