This repository was archived by the owner on Jan 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ var usage = `
39
39
40
40
You should have received a copy of the GNU General Public License
41
41
along with this program. If not, see <http://www.gnu.org/licenses/>.
42
-
42
+
43
43
Example:
44
44
check_nsc_web -p "password" -u "https://<SERVER_RUNNING_NSCLIENT>:8443" check_cpu
45
45
@@ -137,24 +137,26 @@ func main() {
137
137
urlStruct .Path += "/query/" + flag .Arg (0 )
138
138
} else {
139
139
urlStruct .Path += "/query/" + flag .Arg (0 )
140
- parameters := url. Values {}
140
+ var param bytes. Buffer
141
141
for i , a := range flag .Args () {
142
142
if i == 0 {
143
143
continue
144
+ } else if i > 1 {
145
+ param .WriteString ("&" )
144
146
}
147
+
145
148
p := strings .SplitN (a , "=" , 2 )
146
149
if len (p ) == 1 {
147
- // FIXME it is unclear if a trailing "=" e.g. on show-all can lead to errors
148
- parameters .Add (p [0 ], "" )
150
+ param .WriteString (url .QueryEscape (p [0 ]))
149
151
} else {
150
- parameters . Add ( p [0 ], p [1 ])
152
+ param . WriteString ( url . QueryEscape ( p [0 ]) + "=" + url . QueryEscape ( p [1 ]) )
151
153
}
152
154
if err != nil {
153
155
fmt .Println ("UNKNOWN: " + err .Error ())
154
156
os .Exit (3 )
155
157
}
156
158
}
157
- urlStruct .RawQuery = parameters . Encode ()
159
+ urlStruct .RawQuery = param . String ()
158
160
}
159
161
160
162
var hTransport = & http.Transport {
You can’t perform that action at this time.
0 commit comments