[ARVADOS] created: dc706977b754f7b5b0e5835ef80a2b59bc1773f8
git at public.curoverse.com
git at public.curoverse.com
Tue Nov 25 17:54:48 EST 2014
at dc706977b754f7b5b0e5835ef80a2b59bc1773f8 (commit)
commit dc706977b754f7b5b0e5835ef80a2b59bc1773f8
Author: Tim Pierce <twp at curoverse.com>
Date: Tue Nov 25 17:52:05 2014 -0500
4621: implement lean_uri_escape
lean_uri_escape implements URI escaping as in URI::Escape, but with
substantially less RAM (at the cost of less error checking).
Also fixes a bug in crunch-job's strftime call.
diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job
index 0d35d53..0265a48 100755
--- a/sdk/cli/bin/crunch-job
+++ b/sdk/cli/bin/crunch-job
@@ -1702,7 +1702,7 @@ sub api_call {
if ($next_try_at < time) {
$retry_msg = "Retrying.";
} else {
- my $next_try_fmt = strftime("%Y-%m-%d %H:%M:%S", $next_try_at);
+ my $next_try_fmt = strftime("%Y-%m-%d %H:%M:%S", localtime($next_try_at));
$retry_msg = "Retrying at $next_try_fmt.";
}
Log(undef, "API method $method_name failed: $errmsg. $retry_msg");
diff --git a/sdk/perl/lib/Arvados/Request.pm b/sdk/perl/lib/Arvados/Request.pm
index 07ca763..f2a9b63 100644
--- a/sdk/perl/lib/Arvados/Request.pm
+++ b/sdk/perl/lib/Arvados/Request.pm
@@ -49,9 +49,9 @@ sub process_request
my $content;
while (($p, $v) = each %content) {
$content .= '&' unless $content eq '';
- $content .= uri_escape($p);
+ $content .= lean_uri_escape($p);
$content .= '=';
- $content .= uri_escape($v);
+ $content .= lean_uri_escape($v);
}
$self->{'req'}->content_type("application/x-www-form-urlencoded; charset='utf8'");
$self->{'req'}->content(Encode::encode('utf8', $content));
@@ -94,4 +94,12 @@ sub get_headers
""
}
+# lean_uri_escape consumes about half as much memory
+# as URI::Escape::uri_escape.
+sub lean_uri_escape {
+ my ($text) = @_;
+ $text =~ s/([^A-Za-z0-9\-\._~])/$URI::Escape::escapes{$&}/ge;
+ return $text;
+}
+
1;
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list