NE_GET_CONTENT_TYPE(3)

NAME
ne_get_content_type - retrieve content type of response

SYNOPSIS

#include <ne_basic.h>

typedef struct {
    const char *type, *subtype;
    const char *charset;
    char *value;
} ne_content_type;

int ne_get_content_type(ne_request *req, ne_content_type *ctype);

DESCRIPTION

The ne_get_content_type function retrieves and parses the Content-Type header from the response to request req. If successful, all fields of the ctype structure are set (and are never NULL). The value field must be freed by the caller using free after use.

RETURN VALUE

ne_get_content_type returns zero if the response had a valid Content-Type header, or non-zero on error. On error, the ctype structure is not altered.

HISTORY

A default charset value was returned for text/xml content-types in neon 0.36.0 and earlier; later versions use no default (per RFC 7303[1]).

SEE ALSO

ne_xml_dispatch_request(3), ne_request_dispatch(3)

COPYRIGHT
Copyright © 2001-2026 Joe Orton

REFERENCES

1.  RFC 7303
    https://www.rfc-editor.org/rfc/rfc7303