From e31316263af98c4583be39b469f3152a23eba91d Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 22 May 2014 05:30:05 -0400 Subject: http: optionally extract charset parameter from content-type Since the previous commit, we now give a sanitized, shortened version of the content-type header to any callers who ask for it. This patch adds back a way for them to cleanly access specific parameters to the type. We could easily extract all parameters and make them available via a string_list, but: 1. That complicates the interface and memory management. 2. In practice, no planned callers care about anything except the charset. This patch therefore goes with the simplest thing, and we can expand or change the interface later if it becomes necessary. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- http.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'http.h') diff --git a/http.h b/http.h index e64084fe6..473179b14 100644 --- a/http.h +++ b/http.h @@ -143,6 +143,13 @@ struct http_get_options { /* If non-NULL, returns the content-type of the response. */ struct strbuf *content_type; + /* + * If non-NULL, and content_type above is non-NULL, returns + * the charset parameter from the content-type. If none is + * present, returns an empty string. + */ + struct strbuf *charset; + /* * If non-NULL, returns the URL we ended up at, including any * redirects we followed. -- cgit v1.2.1