mirror of
https://github.com/curl/curl.git
synced 2026-08-24 12:33:37 +03:00
writeout: support to generate JSON output
This commit adds support to generate JSON via the writeout feature:
-w "%{json}"
It leverages the existing infrastructure as much as possible. Thus,
generating the JSON on STDERR is possible by:
-w "%{stderr}%{json}"
This implements a variant of
https://github.com/curl/curl/wiki/JSON#--write-out-json.
Closes #4870
This commit is contained in:
parent
d83402813b
commit
04c03416e6
8 changed files with 361 additions and 83 deletions
|
|
@ -127,6 +127,16 @@ char *curl_version(void)
|
|||
int i = 0;
|
||||
int j;
|
||||
|
||||
#ifdef DEBUGBUILD
|
||||
/* Override version string when environment variable CURL_VERSION is set */
|
||||
const char *debugversion = getenv("CURL_VERSION");
|
||||
if(debugversion) {
|
||||
strncpy(out, debugversion, sizeof(out)-1);
|
||||
out[sizeof(out)-1] = '\0';
|
||||
return out;
|
||||
}
|
||||
#endif
|
||||
|
||||
src[i++] = LIBCURL_NAME "/" LIBCURL_VERSION;
|
||||
#ifdef USE_SSL
|
||||
Curl_ssl_version(ssl_version, sizeof(ssl_version));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue