diff options
author | Daniel Stenberg <daniel@haxx.se> | 2015-06-02 11:50:00 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-06-24 23:44:42 +0200 |
commit | a384f28ca61e5631f81b209a2994eb13b9ac12df (patch) | |
tree | a0c8ba571a061afda0a701e4ab46420db3317593 | |
parent | bf445b6e12f0a01959edbb3ca6fb548837289718 (diff) |
http2: curl_pushheader_byname now takes a const char *
-rw-r--r-- | docs/libcurl/opts/CURLMOPT_PUSHFUNCTION.3 | 15 | ||||
-rw-r--r-- | include/curl/multi.h | 3 | ||||
-rw-r--r-- | lib/http2.c | 2 |
3 files changed, 10 insertions, 10 deletions
diff --git a/docs/libcurl/opts/CURLMOPT_PUSHFUNCTION.3 b/docs/libcurl/opts/CURLMOPT_PUSHFUNCTION.3 index 0e4e3326e..3d87e2344 100644 --- a/docs/libcurl/opts/CURLMOPT_PUSHFUNCTION.3 +++ b/docs/libcurl/opts/CURLMOPT_PUSHFUNCTION.3 @@ -22,13 +22,13 @@ .\" .TH CURLMOPT_PUSHFUNCTION 3 "1 Jun 2015" "libcurl 7.44.0" "curl_multi_setopt options" .SH NAME -CURLMOPT_PUSHFUNCTION \- approve or deny server pushes +CURLMOPT_PUSHFUNCTION \- callback that approves or denies server pushes .SH SYNOPSIS .nf #include <curl/curl.h> char *curl_pushheader_bynum(push_headers, int num); -char *curl_pushheader_byname(push_headers, char *name); +char *curl_pushheader_byname(push_headers, const char *name); int curl_push_callback(CURL *parent, CURL *easy, @@ -46,13 +46,13 @@ pushes will be denied automatically. .SH CALLBACK DESCRIPTION The callback gets its arguments like this: -\fIeasy\fP is a newly created handle that represents this new transfer. - \fIparent\fP is the handle of the stream on which this push arrives. The new handle has been duphandle()d from the parent, meaning that it has gotten all its options inherited. It is then up to the application to alter any options if desired. +\fIeasy\fP is a newly created handle that represents this upcoming transfer. + \fInum_headers\fP is the number of name+value pairs that was received and can be accessed @@ -71,12 +71,13 @@ functions. These functions can only be used from within this callback and they can only access the PUSH_PROMISE headers. The normal response headers will be pased to the header callback for pushed streams just as for normal streams. .IP curl_pushheader_bynum -Returns the header at index 'num' (or NULL). The returned pointer points -to a "name:value" string that will be freed when this callback returns. +Returns the header at index 'num' (or NULL). The returned pointer points to a +"name:value" string that will be freed when this callback returns. .IP curl_pushheader_byname Returns the value for the given header name (or NULL). This is a shortcut so that the application doesn't have to loop through all headers to find the one -it is interested in. +it is interested in. The data pointed will be freed when this callback +returns. .SH CALLBACK RETURN VALUE .IP "CURL_PUSH_OK (0)" The application has accepted the stream and it can now start receiving data, diff --git a/include/curl/multi.h b/include/curl/multi.h index b2670e254..d34694c4c 100644 --- a/include/curl/multi.h +++ b/include/curl/multi.h @@ -298,9 +298,8 @@ struct curl_pushheaders; /* forward declaration only */ CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h, size_t num); - CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h, - char *name); + const char *name); typedef int (*curl_push_callback)(CURL *parent, CURL *easy, diff --git a/lib/http2.c b/lib/http2.c index 5587b3d2b..4eae850c6 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -236,7 +236,7 @@ char *curl_pushheader_bynum(struct curl_pushheaders *h, size_t num) /* * push header access function. Only to be used from within the push callback */ -char *curl_pushheader_byname(struct curl_pushheaders *h, char *header) +char *curl_pushheader_byname(struct curl_pushheaders *h, const char *header) { /* Verify that we got a good easy handle in the push header struct, mostly to detect rubbish input fast(er). */ |