|
62 | 62 |
|
63 | 63 | .http.init:{ |
64 | 64 | if[.http.cfg.cacheProxy; |
65 | | - .log.info "Querying environment variables for HTTP / HTTPS proxy settings"; |
| 65 | + .log.if.info "Querying environment variables for HTTP / HTTPS proxy settings"; |
66 | 66 | .http.proxy:.http.i.getProxyConfig[]; |
67 | 67 | ]; |
68 | 68 |
|
|
71 | 71 | .http.userAgent:"-" sv string `kdbplus,.z.K,.z.k,.z.i; |
72 | 72 | ]; |
73 | 73 |
|
74 | | - .log.info "Send user agent with HTTP requests enabled [ User Agent: ",.http.userAgent," ]"; |
| 74 | + .log.if.info "Send user agent with HTTP requests enabled [ User Agent: ",.http.userAgent," ]"; |
75 | 75 | ]; |
76 | 76 |
|
77 | 77 | .http.gzAvailable:.ns.isSet `.Q.gz; |
78 | | - .log.info "HTTP compression with GZIP [ Available: ",string[`no`yes .http.gzAvailable]," ]"; |
| 78 | + .log.if.info "HTTP compression with GZIP [ Available: ",string[`no`yes .http.gzAvailable]," ]"; |
79 | 79 | }; |
80 | 80 |
|
81 | 81 |
|
|
154 | 154 | location:response[`headers] key[response`headers] first where `location = lower key response`headers; |
155 | 155 |
|
156 | 156 | if[0 < count location; |
157 | | - .log.info "Following HTTP redirect as configured [ Original URL: ",url," ] [ New URL: ",location," ]"; |
| 157 | + .log.if.info "Following HTTP redirect as configured [ Original URL: ",url," ] [ New URL: ",location," ]"; |
158 | 158 | response:.http.send[method; location; body; contentType; headers]; |
159 | 159 | ]; |
160 | 160 | ]; |
|
188 | 188 | urlArgs:"=" vs/: "&" vs urlArgs; |
189 | 189 |
|
190 | 190 | if[not all 2 = count each urlArgs; |
191 | | - .log.error "URL query string is invalid, must be ampersand separated 'key=value' pairs [ URL: ",urlParts[`path]," ]"; |
| 191 | + .log.if.error "URL query string is invalid, must be ampersand separated 'key=value' pairs [ URL: ",urlParts[`path]," ]"; |
192 | 192 | '"InvalidUrlQueryStringException"; |
193 | 193 | ]; |
194 | 194 |
|
|
269 | 269 | .http.i.send:{[urlParts; requestStr] |
270 | 270 | if[any urlParts[`scheme] like/: string[.http.cfg.tlsSchemes],\:"://"; |
271 | 271 | if[not .util.isTlsAvailable[]; |
272 | | - .log.error "Cannot open TLS-based connection as TLS is not available in the current process"; |
| 272 | + .log.if.error "Cannot open TLS-based connection as TLS is not available in the current process"; |
273 | 273 | '"TlsNotAvailableException"; |
274 | 274 | ]; |
275 | 275 | ]; |
276 | 276 |
|
277 | 277 | urlForLog:.http.i.urlForLog urlParts; |
278 | 278 |
|
279 | | - .log.info "Sending HTTP request [ URL: ",urlForLog," ] [ Via Proxy: ",string[`no`yes urlParts`proxy]," ]"; |
280 | | - .log.trace "HTTP request:\n",requestStr; |
| 279 | + .log.if.info "Sending HTTP request [ URL: ",urlForLog," ] [ Via Proxy: ",string[`no`yes urlParts`proxy]," ]"; |
| 280 | + .log.if.trace "HTTP request:\n",requestStr; |
281 | 281 |
|
282 | 282 | httpResp:@[urlParts`hp; requestStr; { (`HTTP_REQUEST_FAIL; x) }]; |
283 | 283 |
|
284 | 284 | if[`HTTP_REQUEST_FAIL ~ first httpResp; |
285 | | - .log.error "Failed to connect to HTTP endpoint [ URL: ",urlForLog," ]. Error - ",last httpResp; |
| 285 | + .log.if.error "Failed to connect to HTTP endpoint [ URL: ",urlForLog," ]. Error - ",last httpResp; |
286 | 286 | '"HttpConnectionFailedException"; |
287 | 287 | ]; |
288 | 288 |
|
289 | | - .log.info "HTTP request returned OK [ URL: ",urlForLog," ]"; |
| 289 | + .log.if.info "HTTP request returned OK [ URL: ",urlForLog," ]"; |
290 | 290 |
|
291 | 291 | :httpResp; |
292 | 292 | }; |
|
344 | 344 | proxyHp:.http.proxy `$urlParts`scheme; |
345 | 345 |
|
346 | 346 | if["" ~ proxyHp; |
347 | | - .log.trace "HTTP access request will route direct (no proxy config) [ Base URL: ",urlParts[`baseUrl]," ]"; |
| 347 | + .log.if.trace "HTTP access request will route direct (no proxy config) [ Base URL: ",urlParts[`baseUrl]," ]"; |
348 | 348 | :`proxy`hp!(0b; `$":",raze urlParts`scheme`baseUrl); |
349 | 349 | ]; |
350 | 350 |
|
351 | 351 | if[urlParts[`baseUrl] in .http.proxy`bypass; |
352 | | - .log.trace "HTTP access request will bypass proxy due to 'NO_PROXY' match [ Base URL: ",urlParts[`baseUrl]," ]"; |
| 352 | + .log.if.trace "HTTP access request will bypass proxy due to 'NO_PROXY' match [ Base URL: ",urlParts[`baseUrl]," ]"; |
353 | 353 | :`proxy`hp!(0b; `$":",raze urlParts`scheme`baseUrl); |
354 | 354 | ]; |
355 | 355 |
|
356 | | - .log.trace "HTTP access request will route via proxy [ Base URL: ",urlParts[`baseUrl]," ] [ Proxy: ",proxyHp," ]"; |
| 356 | + .log.if.trace "HTTP access request will route via proxy [ Base URL: ",urlParts[`baseUrl]," ] [ Proxy: ",proxyHp," ]"; |
357 | 357 | :`proxy`hp!(1b; `$":",proxyHp); |
358 | 358 | }; |
359 | 359 |
|
|
397 | 397 | ]; |
398 | 398 |
|
399 | 399 | if[not[.http.gzAvailable] | not "gzip" ~ ppHeaders`contentEncoding; |
400 | | - .log.error "Invalid content encoding in HTTP response [ Specified: ",ppHeaders[`contentEncoding]," ] [ Supported: ",string[`none`gzip .http.gzAvailable]," ]"; |
| 400 | + .log.if.error "Invalid content encoding in HTTP response [ Specified: ",ppHeaders[`contentEncoding]," ] [ Supported: ",string[`none`gzip .http.gzAvailable]," ]"; |
401 | 401 |
|
402 | 402 | if[.http.cfg.errorOnInvaildContentEncoding; |
403 | 403 | '"InvalidContentEncodingException"; |
|
0 commit comments