Christian Wiese
13 years ago
committed by
Christian Wiese
1 changed files with 89 additions and 0 deletions
@ -0,0 +1,89 @@
|
||||
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
||||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
||||
#
|
||||
# Filename: package/.../nginx/mod_rrd_graph-0.2.0-0001-space-quoting.diff
|
||||
# Copyright (C) 2012 The OpenSDE Project
|
||||
#
|
||||
# More information can be found in the files COPYING and README.
|
||||
#
|
||||
# This patch file is dual-licensed. It is available under the license the
|
||||
# patched project is licensed under, as long as it is an OpenSource license
|
||||
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
|
||||
# of the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option) any later
|
||||
# version.
|
||||
# --- SDE-COPYRIGHT-NOTE-END ---
|
||||
|
||||
From a67111a39ed3505e29bfe4133e449d61e9a50679 Mon Sep 17 00:00:00 2001
|
||||
From: Evan Miller <emmiller+github@gmail.com>
|
||||
Date: Wed, 16 May 2012 17:36:20 -0500
|
||||
Subject: [PATCH] Support spaces with quotation marks around strings
|
||||
|
||||
---
|
||||
README | 2 ++
|
||||
ngx_http_rrd_graph_module.c | 18 ++++++++++++++----
|
||||
2 files changed, 16 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/README b/README
|
||||
index a123ee7..b334248 100644
|
||||
--- a/README
|
||||
+++ b/README
|
||||
@@ -32,6 +32,8 @@ becomes:
|
||||
|
||||
http://mysite.com/rrdtool--start%20now-300s%20--end%20now%20DEF%3Ads0%3Dtest.rrd%3Areading%3AAVERAGE%20LINE1%3Ads0%2300FF00
|
||||
|
||||
+If you need spaces in arguments, put quotation marks ("") around the string.
|
||||
+
|
||||
The module supports all the features of your copy of RRDtool. It can output
|
||||
PNG, PDF, SVG, and EPS graphics (see the --imgformat option of rrdgraph(1)).
|
||||
|
||||
diff --git a/ngx_http_rrd_graph_module.c b/ngx_http_rrd_graph_module.c
|
||||
index ad305e3..f43cd7e 100644
|
||||
--- a/ngx_http_rrd_graph_module.c
|
||||
+++ b/ngx_http_rrd_graph_module.c
|
||||
@@ -151,7 +151,7 @@ static ngx_int_t
|
||||
ngx_http_rrd_graph_parse_uri(ngx_http_request_t *r, int *argc_ptr,
|
||||
char ***argv_ptr, size_t **argv_len_ptr)
|
||||
{
|
||||
- int i, argc = 3;
|
||||
+ int i, argc = 3, in_quote = 0;
|
||||
char **argv;
|
||||
size_t *argv_len;
|
||||
char *tmp, *p;
|
||||
@@ -174,9 +174,16 @@ ngx_http_rrd_graph_parse_uri(ngx_http_request_t *r, int *argc_ptr,
|
||||
uri_copy[r->uri.len] = '\0'; /* RRDtool needs null-terminated strings */
|
||||
p = (char *)uri_copy + clcf->name.len;
|
||||
|
||||
- while(*p++)
|
||||
- if (*p == ' ')
|
||||
+ while(*p++) {
|
||||
+ if (*p == '"') {
|
||||
+ in_quote = !in_quote;
|
||||
+ } else if (*p == ' ' && !in_quote) {
|
||||
argc++;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (in_quote)
|
||||
+ return NGX_ERROR;
|
||||
|
||||
argv = ngx_palloc(r->pool, argc*sizeof(char *));
|
||||
argv_len = ngx_pcalloc(r->pool, argc*sizeof(size_t));
|
||||
@@ -185,10 +192,13 @@ ngx_http_rrd_graph_parse_uri(ngx_http_request_t *r, int *argc_ptr,
|
||||
argv[2] = p = (char *)uri_copy + clcf->name.len;
|
||||
argc = 3;
|
||||
while (*p) {
|
||||
- if (*p == ' ') {
|
||||
+ if (*p == ' ' && !in_quote) {
|
||||
*p = '\0';
|
||||
argv[argc++] = p+1;
|
||||
} else {
|
||||
+ if (*p == '"')
|
||||
+ in_quote = !in_quote;
|
||||
+
|
||||
argv_len[argc-1]++;
|
||||
}
|
||||
p++;
|
||||
--
|
||||
1.6.6.2
|
||||
|
Loading…
Reference in new issue