Lines Matching refs:curlstream
57 php_curl_stream *curlstream = (php_curl_stream *) stream->abstract; in on_data_available() local
65 if (curlstream->readbuffer.writepos == 0) { in on_data_available()
72 *sym = *curlstream->headers; in on_data_available()
77 php_stream_seek(curlstream->readbuffer.buf, curlstream->readbuffer.writepos, SEEK_SET); in on_data_available()
78 wrote = php_stream_write(curlstream->readbuffer.buf, data, size * nmemb); in on_data_available()
79 curlstream->readbuffer.writepos = php_stream_tell(curlstream->readbuffer.buf); in on_data_available()
91 php_curl_stream *curlstream = (php_curl_stream *) stream->abstract; in on_header_available() local
113 zend_hash_next_index_insert(Z_ARRVAL_P(curlstream->headers), &header, sizeof(zval *), NULL); in on_header_available()
141 php_curl_stream *curlstream = (php_curl_stream *) stream->abstract; in php_curl_stream_write() local
143 if (curlstream->writebuffer.buf) { in php_curl_stream_write()
144 return php_stream_write(curlstream->writebuffer.buf, buf, count); in php_curl_stream_write()
152 php_curl_stream *curlstream = (php_curl_stream *) stream->abstract; in php_curl_stream_read() local
155 if (curlstream->readbuffer.readpos >= curlstream->readbuffer.writepos && curlstream->pending) { in php_curl_stream_read()
160 if (curlstream->readbuffer.writepos == 0) { in php_curl_stream_read()
161 while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform(curlstream->multi, &curlstream->pending)); in php_curl_stream_read()
165 FD_ZERO(&curlstream->readfds); in php_curl_stream_read()
166 FD_ZERO(&curlstream->writefds); in php_curl_stream_read()
167 FD_ZERO(&curlstream->excfds); in php_curl_stream_read()
170 …curl_multi_fdset(curlstream->multi, &curlstream->readfds, &curlstream->writefds, &curlstream->excf… in php_curl_stream_read()
177 switch ((curlstream->maxfd < 0) ? 1 : in php_curl_stream_read()
178 …select(curlstream->maxfd + 1, &curlstream->readfds, &curlstream->writefds, &curlstream->excfds, &t… in php_curl_stream_read()
188 curlstream->mcode = curl_multi_perform(curlstream->multi, &curlstream->pending); in php_curl_stream_read()
189 } while (curlstream->mcode == CURLM_CALL_MULTI_PERFORM); in php_curl_stream_read()
191 } while (curlstream->maxfd >= 0 && in php_curl_stream_read()
192 curlstream->readbuffer.readpos >= curlstream->readbuffer.writepos && curlstream->pending > 0); in php_curl_stream_read()
197 …if (curlstream->readbuffer.writepos > 0 && curlstream->readbuffer.readpos < curlstream->readbuffer… in php_curl_stream_read()
198 php_stream_seek(curlstream->readbuffer.buf, curlstream->readbuffer.readpos, SEEK_SET); in php_curl_stream_read()
199 didread = php_stream_read(curlstream->readbuffer.buf, buf, count); in php_curl_stream_read()
200 curlstream->readbuffer.readpos = php_stream_tell(curlstream->readbuffer.buf); in php_curl_stream_read()
212 php_curl_stream *curlstream = (php_curl_stream *) stream->abstract; in php_curl_stream_close() local
217 curl_multi_remove_handle(curlstream->multi, curlstream->curl); in php_curl_stream_close()
218 curl_easy_cleanup(curlstream->curl); in php_curl_stream_close()
219 curl_multi_cleanup(curlstream->multi); in php_curl_stream_close()
221 if (curlstream->headers_slist) { in php_curl_stream_close()
222 curl_slist_free_all(curlstream->headers_slist); in php_curl_stream_close()
228 efree(curlstream->url); in php_curl_stream_close()
229 efree(curlstream); in php_curl_stream_close()
237 php_curl_stream *curlstream = (php_curl_stream *) stream->abstract; in php_curl_stream_flush() local
252 php_curl_stream *curlstream = (php_curl_stream *) stream->abstract; in php_curl_stream_cast() local
254 return php_stream_cast(curlstream->readbuffer.buf, castas, ret, 0); in php_curl_stream_cast()
273 php_curl_stream *curlstream; in php_curl_stream_opener() local
276 curlstream = emalloc(sizeof(php_curl_stream)); in php_curl_stream_opener()
277 memset(curlstream, 0, sizeof(php_curl_stream)); in php_curl_stream_opener()
279 stream = php_stream_alloc(&php_curl_stream_ops, curlstream, 0, mode); in php_curl_stream_opener()
282 curlstream->curl = curl_easy_init(); in php_curl_stream_opener()
283 curlstream->multi = curl_multi_init(); in php_curl_stream_opener()
284 curlstream->pending = 1; in php_curl_stream_opener()
285 curlstream->headers_slist = NULL; in php_curl_stream_opener()
293 curlstream->readbuffer.buf = php_stream_fopen_tmpfile(); in php_curl_stream_opener()
297 curlstream->readbuffer.buf = php_stream_temp_new(); in php_curl_stream_opener()
301 curlstream->url = estrdup(filename); in php_curl_stream_opener()
302 curl_easy_setopt(curlstream->curl, CURLOPT_URL, curlstream->url); in php_curl_stream_opener()
305 curl_easy_setopt(curlstream->curl, CURLOPT_WRITEFUNCTION, on_data_available); in php_curl_stream_opener()
306 curl_easy_setopt(curlstream->curl, CURLOPT_FILE, stream); in php_curl_stream_opener()
309 curl_easy_setopt(curlstream->curl, CURLOPT_HEADERFUNCTION, on_header_available); in php_curl_stream_opener()
310 curl_easy_setopt(curlstream->curl, CURLOPT_WRITEHEADER, stream); in php_curl_stream_opener()
312 curl_easy_setopt(curlstream->curl, CURLOPT_ERRORBUFFER, curlstream->errstr); in php_curl_stream_opener()
313 curl_easy_setopt(curlstream->curl, CURLOPT_VERBOSE, 0); in php_curl_stream_opener()
316 curl_easy_setopt(curlstream->curl, CURLOPT_PROGRESSFUNCTION, on_progress_avail); in php_curl_stream_opener()
317 curl_easy_setopt(curlstream->curl, CURLOPT_PROGRESSDATA, stream); in php_curl_stream_opener()
318 curl_easy_setopt(curlstream->curl, CURLOPT_NOPROGRESS, 0); in php_curl_stream_opener()
320 …curl_easy_setopt(curlstream->curl, CURLOPT_USERAGENT, FG(user_agent) ? FG(user_agent) : "PHP/" PHP… in php_curl_stream_opener()
327 curl_easy_setopt(curlstream->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); in php_curl_stream_opener()
329 curl_easy_setopt(curlstream->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); in php_curl_stream_opener()
334 curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYHOST, 2); in php_curl_stream_opener()
336 curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYHOST, 0); in php_curl_stream_opener()
339 curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYPEER, 1); in php_curl_stream_opener()
341 curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYPEER, 0); in php_curl_stream_opener()
346 curl_easy_setopt(curlstream->curl, CURLOPT_USERAGENT, Z_STRVAL_PP(ctx_opt)); in php_curl_stream_opener()
358 curlstream->headers_slist = curl_slist_append(curlstream->headers_slist, Z_STRVAL_PP(header)); in php_curl_stream_opener()
368 curlstream->headers_slist = curl_slist_append(curlstream->headers_slist, trimmed); in php_curl_stream_opener()
374 if (curlstream->headers_slist) { in php_curl_stream_opener()
375 curl_easy_setopt(curlstream->curl, CURLOPT_HTTPHEADER, curlstream->headers_slist); in php_curl_stream_opener()
381 curl_easy_setopt(curlstream->curl, CURLOPT_NOBODY, 1); in php_curl_stream_opener()
384 curl_easy_setopt(curlstream->curl, CURLOPT_POST, 1); in php_curl_stream_opener()
386 curl_easy_setopt(curlstream->curl, CURLOPT_CUSTOMREQUEST, Z_STRVAL_PP(ctx_opt)); in php_curl_stream_opener()
389 curl_easy_setopt(curlstream->curl, CURLOPT_POSTFIELDS, Z_STRVAL_PP(ctx_opt)); in php_curl_stream_opener()
390 curl_easy_setopt(curlstream->curl, CURLOPT_POSTFIELDSIZE, (long)Z_STRLEN_PP(ctx_opt)); in php_curl_stream_opener()
396 curl_easy_setopt(curlstream->curl, CURLOPT_PROXY, Z_STRVAL_PP(ctx_opt)); in php_curl_stream_opener()
407 curl_easy_setopt(curlstream->curl, CURLOPT_FOLLOWLOCATION, 0); in php_curl_stream_opener()
409 curl_easy_setopt(curlstream->curl, CURLOPT_FOLLOWLOCATION, 1); in php_curl_stream_opener()
411 curl_easy_setopt(curlstream->curl, CURLOPT_MAXREDIRS, mr); in php_curl_stream_opener()
415 curl_easy_setopt(curlstream->curl, CURLOPT_FOLLOWLOCATION, 0); in php_curl_stream_opener()
417 curl_easy_setopt(curlstream->curl, CURLOPT_FOLLOWLOCATION, 1); in php_curl_stream_opener()
419 curl_easy_setopt(curlstream->curl, CURLOPT_MAXREDIRS, 20L); in php_curl_stream_opener()
423 curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYHOST, 2); in php_curl_stream_opener()
425 curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYHOST, 0); in php_curl_stream_opener()
428 curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYPEER, 1); in php_curl_stream_opener()
430 curl_easy_setopt(curlstream->curl, CURLOPT_SSL_VERIFYPEER, 0); in php_curl_stream_opener()
435 curl_multi_add_handle(curlstream->multi, curlstream->curl); in php_curl_stream_opener()
447 MAKE_STD_ZVAL(curlstream->headers); in php_curl_stream_opener()
448 array_init(curlstream->headers); in php_curl_stream_opener()
450 add_assoc_zval(stream->wrapperdata, "headers", curlstream->headers); in php_curl_stream_opener()
453 php_stream_to_zval(curlstream->readbuffer.buf, tmp); in php_curl_stream_opener()
464 curl_easy_perform(curlstream->curl); in php_curl_stream_opener()
475 …while (CURLM_CALL_MULTI_PERFORM == (m = curl_multi_perform(curlstream->multi, &curlstream->pending… in php_curl_stream_opener()
490 while ((msg = curl_multi_info_read(curlstream->multi, &msgs_left))) { in php_curl_stream_opener()