/soc/2013/ankitkv/gobjectification: 47b5d67e923f: Merged default...
Ankit Vani
a at nevitus.org
Tue Jul 30 05:43:23 EDT 2013
Changeset: 47b5d67e923f8f4d55416fe263e33bb251189184
Author: Ankit Vani <a at nevitus.org>
Date: 2013-07-30 15:11 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/47b5d67e923f
Description:
Merged default branch
diffstat:
libpurple/http.c | 37 ++++++++++++++++++++-----------------
1 files changed, 20 insertions(+), 17 deletions(-)
diffs (84 lines):
diff --git a/libpurple/http.c b/libpurple/http.c
--- a/libpurple/http.c
+++ b/libpurple/http.c
@@ -114,7 +114,6 @@ struct _PurpleHttpConnection
gboolean contents_reader_requested;
int redirects_count;
- int data_length_got;
int length_expected, length_got;
@@ -917,15 +916,20 @@ static gboolean _purple_http_recv_header
static gboolean _purple_http_recv_body_data(PurpleHttpConnection *hc,
const gchar *buf, int len)
{
- int current_offset = hc->data_length_got;
-
+ int current_offset = hc->length_got;
+
+ if (hc->length_expected >= 0 &&
+ len + hc->length_got > hc->length_expected)
+ {
+ len = hc->length_expected - hc->length_got;
+ }
if (hc->request->max_length >= 0) {
- if (hc->data_length_got + len > hc->request->max_length) {
- len = hc->request->max_length - hc->data_length_got;
- hc->length_expected = hc->length_got;
+ if (hc->length_got + len > hc->request->max_length) {
+ len = hc->request->max_length - hc->length_got;
+ hc->length_expected = hc->request->max_length;
}
}
- hc->data_length_got += len;
+ hc->length_got += len;
if (len == 0)
return TRUE;
@@ -1043,15 +1047,7 @@ static gboolean _purple_http_recv_body(P
const gchar *buf, int len)
{
if (hc->is_chunked)
- {
- hc->length_got += len;
return _purple_http_recv_body_chunked(hc, buf, len);
- }
-
- if (hc->length_expected >= 0 &&
- len + hc->length_got > hc->length_expected)
- len = hc->length_expected - hc->length_got;
- hc->length_got += len;
return _purple_http_recv_body_data(hc, buf, len);
}
@@ -1126,12 +1122,20 @@ static gboolean _purple_http_recv_loopbo
return FALSE;
}
- if (hc->is_chunked && hc->chunks_done)
+ if (hc->is_chunked && hc->chunks_done && hc->length_expected < 0)
hc->length_expected = hc->length_got;
if (hc->length_expected >= 0 && hc->length_got >= hc->length_expected) {
const gchar *redirect;
+ if (hc->is_chunked && !hc->chunks_done) {
+ if (purple_debug_is_verbose()) {
+ purple_debug_misc("http",
+ "I need the terminating empty chunk\n");
+ }
+ return TRUE;
+ }
+
if (!hc->headers_got) {
hc->response->code = 0;
purple_debug_warning("http", "No headers got\n");
@@ -1427,7 +1431,6 @@ static gboolean _purple_http_reconnect(P
g_string_free(hc->response->contents, TRUE);
hc->response->contents = NULL;
hc->length_got = 0;
- hc->data_length_got = 0;
hc->length_expected = -1;
hc->is_chunked = FALSE;
hc->in_chunk = FALSE;
More information about the Commits
mailing list