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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
bf197fd7ee
commit
e31316263a
7
http.h
7
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.
|
||||
|
Reference in New Issue
Block a user