summaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 54b9911391..e6b4bc3d18 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -2785,6 +2785,24 @@ connection_fetch_from_buf_line(connection_t *conn, char *data,
}
}
+/** As fetch_from_buf_http, but fetches from a conncetion's input buffer_t or
+ * its bufferevent as appropriate. */
+int
+connection_fetch_from_buf_http(connection_t *conn,
+ char **headers_out, size_t max_headerlen,
+ char **body_out, size_t *body_used,
+ size_t max_bodylen, int force_complete)
+{
+ IF_HAS_BUFFEREVENT(conn, {
+ struct evbuffer *input = bufferevent_get_input(conn->bufev);
+ return fetch_from_evbuffer_http(input, headers_out, max_headerlen,
+ body_out, body_used, max_bodylen, force_complete);
+ }) ELSE_IF_NO_BUFFEREVENT {
+ return fetch_from_buf_http(conn->inbuf, headers_out, max_headerlen,
+ body_out, body_used, max_bodylen, force_complete);
+ }
+}
+
/** Return conn-\>outbuf_flushlen: how many bytes conn wants to flush
* from its outbuf. */
int