diff options
-rw-r--r-- | lib/http_client.c | 2 | ||||
-rw-r--r-- | lib/http_client.h | 1 | ||||
-rw-r--r-- | protocols/twitter/twitter_lib.c | 10 |
3 files changed, 13 insertions, 0 deletions
diff --git a/lib/http_client.c b/lib/http_client.c index 5fc7731f..793c5cc1 100644 --- a/lib/http_client.c +++ b/lib/http_client.c @@ -301,6 +301,8 @@ static gboolean http_incoming_data( gpointer data, int source, b_input_condition return FALSE; eof: + req->flags |= HTTPC_EOF; + /* Maybe if the webserver is overloaded, or when there's bad SSL support... */ if( req->bytes_read == 0 ) diff --git a/lib/http_client.h b/lib/http_client.h index 38175b70..48b711a4 100644 --- a/lib/http_client.h +++ b/lib/http_client.h @@ -40,6 +40,7 @@ struct http_request; typedef enum http_client_flags { HTTPC_STREAMING = 1, + HTTPC_EOF = 2, } http_client_flags_t; /* Your callback function should look like this: */ diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index ee19786a..d7e54392 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -731,6 +731,7 @@ static gboolean twitter_stream_handle_object(struct im_connection *ic, json_valu static void twitter_http_stream(struct http_request *req) { struct im_connection *ic = req->data; + struct twitter_data *td; json_value *parsed; int len = 0; char c, *nl; @@ -738,6 +739,15 @@ static void twitter_http_stream(struct http_request *req) if (!g_slist_find(twitter_connections, ic)) return; + td = ic->proto_data; + + if ((req->flags & HTTPC_EOF) || !req->reply_body) { + td->stream = NULL; + imcb_error(ic, "Stream closed (%s)", req->status_string); + imc_logout(ic, TRUE); + return; + } + printf( "%d bytes in stream\n", req->body_size ); /* MUST search for CRLF, not just LF: |