diff options
-rw-r--r-- | src/lachttp.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lachttp.c b/src/lachttp.c index a4603b8..9babbe7 100644 --- a/src/lachttp.c +++ b/src/lachttp.c @@ -1385,9 +1385,6 @@ request_emit_begin_content (LacHttpRequest *request, request_queue_event (request, event); } -/* FIXME: consider making this function take a LacByteQueue, - * to avoid copying the data, if possible - */ static void request_emit_content (LacHttpRequest *request, gsize length, @@ -1395,7 +1392,6 @@ request_emit_content (LacHttpRequest *request, { gint bytes_to_emit; LacHttpEvent *event = g_new (LacHttpEvent, 1); - const gchar *data = lac_byte_queue_peek (queue, NULL); if (!request->sent_begin_content) request_emit_begin_content (request, -1); @@ -1412,6 +1408,8 @@ request_emit_content (LacHttpRequest *request, if (bytes_to_emit > 0) { + const gchar *data = lac_byte_queue_peek (queue, NULL); + data = data + (length - bytes_to_emit); event->type = LAC_HTTP_EVENT_CONTENT; @@ -1901,7 +1899,9 @@ static void http_host_cancel_request (HttpHost *host, LacHttpRequest *request) { if (request->transport) + { http_transport_cancel_request (request->transport, request); + } else { /* request should be in the unsent queue */ @@ -1979,9 +1979,16 @@ server_choked_on_pipeline (HttpTransport *transport, guint recover_time) * giving up on pipelining completely) * * The alternative: report back to the user that the data - * he already received was useless, is not nice. FIXME: + * he already received was useless, is not nice. + * + * FIXME: * hmm, why not? Just tell the application that the request * failed and it should retry. Seems a lot simpler to me ... + * + * It does increase the complexity of the application. But the + * whole "retry and ignore some bytes" could easily be done in + * a layer on top (much easier than here in lachttp), so we really + * should remove it. */ LacHttpRequest *request = transport->current; gsize n_bytes; |