diff options
author | Balint Reczey <balint@balintreczey.hu> | 2013-11-18 16:06:16 +0100 |
---|---|---|
committer | Balint Reczey <balint@balintreczey.hu> | 2013-11-18 18:24:15 +0100 |
commit | b0bd7fe1db93a1adde29587e12ed78726f962012 (patch) | |
tree | 6780ae162dfb6c59c8ffb5f0fbbb2bb6fe8c3dbd /include | |
parent | 8d8decf114aebf10188cfdf52a8479cd24d1e3e5 (diff) | |
download | libevent-b0bd7fe1db93a1adde29587e12ed78726f962012.tar.gz |
Allow registering callback for parsing HTTP headers
Slightly changed version of Espen Jürgensen's
commit 548141e72312126fa6121f6a5f436đ251c7fb1251 for forked-daapd.
Diffstat (limited to 'include')
-rw-r--r-- | include/event2/http.h | 9 | ||||
-rw-r--r-- | include/event2/http_struct.h | 8 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/event2/http.h b/include/event2/http.h index 466a5a86..068120c7 100644 --- a/include/event2/http.h +++ b/include/event2/http.h @@ -505,6 +505,15 @@ void evhttp_request_set_chunked_cb(struct evhttp_request *, void (*cb)(struct evhttp_request *, void *)); /** + * Register callback for additional parsing of request headers. + * @param cb will be called after receiving and parsing the full header. + * It allows analyzing the header and possibly closing the connection + * by returning a value < 0. + */ +void evhttp_request_set_header_cb(struct evhttp_request *, + int (*cb)(struct evhttp_request *, void *)); + +/** * The different error types supported by evhttp * * @see evhttp_request_set_error_cb() diff --git a/include/event2/http_struct.h b/include/event2/http_struct.h index 25e19bd9..4ca196ee 100644 --- a/include/event2/http_struct.h +++ b/include/event2/http_struct.h @@ -120,6 +120,14 @@ struct { * the regular callback. */ void (*chunk_cb)(struct evhttp_request *, void *); + + /* + * Callback added for forked-daapd so they can collect ICY + * (shoutcast) metadata from the http header. If return + * int is negative the connection will be closed. + */ + int (*header_cb)(struct evhttp_request *, void *); + /* * Error callback - called when error is occured. * @see evhttp_request_error for error types. |