MCPcopy Create free account
hub / github.com/apache/httpd / md_json_read_http

Function md_json_read_http

modules/md/md_json.c:1185–1205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1183/* http get */
1184
1185apr_status_t md_json_read_http(md_json_t **pjson, apr_pool_t *pool, const md_http_response_t *res)
1186{
1187 apr_status_t rv = APR_ENOENT;
1188 const char *ctype, *p;
1189 apr_size_t ctype_len;
1190
1191 *pjson = NULL;
1192 if (!res->body) goto cleanup;
1193 ctype = md_util_parse_ct(res->req->pool, apr_table_get(res->headers, "content-type"));
1194 if (!ctype) goto cleanup;
1195 ctype_len = strlen(ctype);
1196 if (ctype_len < sizeof("/json")) goto cleanup;
1197 p = ctype + ctype_len + 1; /* point to the terminating 0 */
1198 if (!strcmp(p - sizeof("/json"), "/json") ||
1199 !strcmp(p - sizeof("+json"), "+json") ||
1200 !strcmp(ctype, "text/plain")) {
1201 rv = md_json_readb(pjson, pool, res->body);
1202 }
1203cleanup:
1204 return rv;
1205}
1206
1207typedef struct {
1208 apr_status_t rv;

Callers 4

json_resp_cbFunction · 0.85
inspect_problemFunction · 0.85
on_responseFunction · 0.85
update_directoryFunction · 0.85

Calls 2

md_util_parse_ctFunction · 0.85
md_json_readbFunction · 0.85

Tested by

no test coverage detected