summaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-08-09 11:40:28 -0700
committerNick Mathewson <nickm@torproject.org>2010-09-27 12:31:13 -0400
commitddcb59bb70457e203247931aaad3a3ff8b923f97 (patch)
tree803eac2d836936d44043b7793f4e6706208504cd /src/or/connection.c
parent5279036148ca158f7c60f793f401604060b1c1ba (diff)
downloadtor-ddcb59bb70457e203247931aaad3a3ff8b923f97.tar.gz
tor-ddcb59bb70457e203247931aaad3a3ff8b923f97.zip
Fix more remaining users of inbuf/outbuf to handle bufferevents instead.
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