summaryrefslogtreecommitdiffstats
path: root/main/php/curl-flush.patch
blob: 14fc31a0bc92188412d4048784ed885aa38353eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--- /repository/php-src/ext/curl/interface.c	2009/06/15 12:38:11	1.62.2.14.2.57
+++ /repository/php-src/ext/curl/interface.c	2009/06/28 10:00:28	1.62.2.14.2.58
@@ -1827,6 +1827,14 @@
 	if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.len > 0) {
 		smart_str_0(&ch->handlers->write->buf);
 		RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 1);
+	}
+
+	/* flush the file handle, so any remaining data is synched to disk */
+	if (ch->handlers->write->method == PHP_CURL_FILE && ch->handlers->write->fp) {
+		fflush(ch->handlers->write->fp);
+	}
+	if (ch->handlers->write_header->method == PHP_CURL_FILE && ch->handlers->write_header->fp) {
+		fflush(ch->handlers->write_header->fp);
 	}
 
 	if (ch->handlers->write->method == PHP_CURL_RETURN) {