curl-library
RE: "pull" aspect of multi interface not quite working properly
Date: Mon, 2 Jul 2007 09:24:15 -0400
> Well, for maximum efficiency (and avoiding this work) you
> could also say that
> your write callback should be able to cache some extra data
> in case you'd get
> called more than once...
That's great until your application becomes memory constrained. Then the
need for extra buffer space will make it disastrously slow, assuming it will
work at all.
> But if you think this is a worthwhile project, I'd like to
> see a patch from
> you that takes more aspects into account so that we can test
> etc and see that
> things still work fine in other areas when introducing this
> calling limit. I
> don't have any plans to work on this myself.
Attached and enclosed.
Note this also includes my modification to set
CURLINFO_CONTENT_LENGTH_DOWNLOAD at the same time the Content-Length header
is parsed, rather than waiting until all headers have been received.
diff -w -u C:\sources\curl-7.16.2\lib/multi.c ./multi.c
--- C:\sources\curl-7.16.2\lib/multi.c 2007-06-21 16:48:32.622025600 -0400
+++ ./multi.c 2007-07-02 09:06:04.623347200 -0400
@@ -1359,7 +1359,10 @@
}
}
- } while (easy->easy_handle->change.url_changed);
+ } while (0);
+
+ if (easy->easy_handle->change.url_changed || (easy->easy_conn &&
Curl_ssl_data_pending(easy->easy_conn, FIRSTSOCKET)))
+ return CURLM_CALL_MULTI_PERFORM;
if ((CURLM_STATE_COMPLETED == easy->state) && !easy->msg) {
if(easy->easy_handle->dns.hostcachetype == HCACHE_MULTI) {
diff -w -u C:\sources\curl-7.16.2\lib/transfer.c ./transfer.c
--- C:\sources\curl-7.16.2\lib/transfer.c 2007-06-21
14:53:58.324866600 -0400
+++ ./transfer.c 2007-06-28 21:15:45.870207300 -0400
@@ -342,7 +342,7 @@
the stream was rewound (in which case we have data in a
buffer) */
if((k->keepon & KEEP_READ) &&
- ((select_res & CSELECT_IN) || conn->bits.stream_was_rewound)) {
+ ((select_res & CSELECT_IN) || conn->bits.stream_was_rewound) ||
data_pending(conn)) {
/* read */
bool is_empty_data = FALSE;
@@ -849,6 +849,7 @@
if(contentlength >= 0) {
k->size = contentlength;
k->maxdownload = k->size;
+ Curl_pgrsSetDownloadSize(data, k->size);
}
else {
/* Negative Content-Length is really odd, and we know it
@@ -1344,7 +1345,7 @@
k->keepon &= ~KEEP_READ;
}
- } while(data_pending(conn));
+ } while(0);
} /* if( read from socket ) */
- application/octet-stream attachment: libcurl-limit-buf.diff