Updated Branches:
  refs/heads/master 0ce9ace8b -> 5fa4f0b3c

Add SI postfixes to mod_generator


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/5795931b
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/5795931b
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/5795931b

Branch: refs/heads/master
Commit: 5795931b92a9725d153cfdfd4a1fd8281e097e9e
Parents: 0ce9ace
Author: Leif Hedstrom <zw...@apache.org>
Authored: Thu Oct 31 11:46:13 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Wed Nov 6 18:11:22 2013 -0700

----------------------------------------------------------------------
 tools/lighttpd_mod_generator/mod_generator.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5795931b/tools/lighttpd_mod_generator/mod_generator.c
----------------------------------------------------------------------
diff --git a/tools/lighttpd_mod_generator/mod_generator.c 
b/tools/lighttpd_mod_generator/mod_generator.c
index e08d9b2..fe42aa4 100644
--- a/tools/lighttpd_mod_generator/mod_generator.c
+++ b/tools/lighttpd_mod_generator/mod_generator.c
@@ -245,6 +245,26 @@ URIHANDLER_FUNC(mod_generator_subrequest_handler) {
   // get the size in bytes form the url
   int64_t bytes = strtoll(start, &end, 10);
 
+  switch (*end) {
+  case 'k':
+  case 'K':
+    bytes *= 1024;
+    ++end;
+    break;
+  case 'm':
+  case 'M':
+    bytes *= 1024*1024;
+    ++end;
+    break;
+  case 'g':
+  case 'G':
+    bytes *= 1024*1024*1024;
+    ++end;
+    break;
+  default:
+    break;
+  }
+
   if (start == end && bytes <= 0 && *start != '-') {
     log_error_write(srv, __FILE__, __LINE__,  "s", "can't find size in bytes");
     return HANDLER_GO_ON;

Reply via email to