Lines Matching refs:stream
70 #define GET_FTP_RESULT(stream) get_ftp_result((stream), tmp_line, sizeof(tmp_line)) argument
80 static inline int get_ftp_result(php_stream *stream, char *buffer, size_t buffer_size) in get_ftp_result() argument
83 while (php_stream_gets(stream, buffer, buffer_size-1) && in get_ftp_result()
92 static int php_stream_ftp_stream_stat(php_stream_wrapper *wrapper, php_stream *stream, php_stream_s… in php_stream_ftp_stream_stat() argument
102 static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper, php_stream *stream) in php_stream_ftp_stream_close() argument
104 php_stream *controlstream = stream->wrapperthis; in php_stream_ftp_stream_close()
108 if (strpbrk(stream->mode, "wa+")) { in php_stream_ftp_stream_close()
122 stream->wrapperthis = NULL; in php_stream_ftp_stream_close()
135 php_stream *stream = NULL, *reuseid = NULL; in php_ftp_fopen_connect() local
157 …stream = php_stream_xport_create(transport, transport_len, REPORT_ERRORS, STREAM_XPORT_CLIENT | ST… in php_ftp_fopen_connect()
159 if (stream == NULL) { in php_ftp_fopen_connect()
164 php_stream_context_set(stream, context); in php_ftp_fopen_connect()
168 result = GET_FTP_RESULT(stream); in php_ftp_fopen_connect()
177 php_stream_write_string(stream, "AUTH TLS\r\n"); in php_ftp_fopen_connect()
180 result = GET_FTP_RESULT(stream); in php_ftp_fopen_connect()
183 php_stream_write_string(stream, "AUTH SSL\r\n"); in php_ftp_fopen_connect()
186 result = GET_FTP_RESULT(stream); in php_ftp_fopen_connect()
193 reuseid = stream; in php_ftp_fopen_connect()
204 if (php_stream_xport_crypto_setup(stream, in php_ftp_fopen_connect()
206 || php_stream_xport_crypto_enable(stream, 1) < 0) { in php_ftp_fopen_connect()
208 php_stream_close(stream); in php_ftp_fopen_connect()
209 stream = NULL; in php_ftp_fopen_connect()
214 php_stream_write_string(stream, "PBSZ 0\r\n"); in php_ftp_fopen_connect()
217 result = GET_FTP_RESULT(stream); in php_ftp_fopen_connect()
221 php_stream_write_string(stream, "PROT P\r\n"); in php_ftp_fopen_connect()
224 result = GET_FTP_RESULT(stream); in php_ftp_fopen_connect()
227 php_stream_write_string(stream, "PROT C\r\n"); in php_ftp_fopen_connect()
230 result = GET_FTP_RESULT(stream); in php_ftp_fopen_connect()
251 php_stream_printf(stream, "USER %s\r\n", ZSTR_VAL(resource->user)); in php_ftp_fopen_connect()
253 php_stream_write_string(stream, "USER anonymous\r\n"); in php_ftp_fopen_connect()
257 result = GET_FTP_RESULT(stream); in php_ftp_fopen_connect()
268 php_stream_printf(stream, "PASS %s\r\n", ZSTR_VAL(resource->pass)); in php_ftp_fopen_connect()
273 php_stream_printf(stream, "PASS %s\r\n", FG(from_address)); in php_ftp_fopen_connect()
275 php_stream_write_string(stream, "PASS anonymous\r\n"); in php_ftp_fopen_connect()
280 result = GET_FTP_RESULT(stream); in php_ftp_fopen_connect()
305 return stream; in php_ftp_fopen_connect()
312 if (stream) { in php_ftp_fopen_connect()
313 php_stream_close(stream); in php_ftp_fopen_connect()
322 static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, size_t ip_size, char **phosts… in php_fopen_do_pasv() argument
331 php_stream_write_string(stream, "EPSV\r\n"); in php_fopen_do_pasv()
332 result = GET_FTP_RESULT(stream); in php_fopen_do_pasv()
338 php_stream_write_string(stream, "PASV\r\n"); in php_fopen_do_pasv()
339 result = GET_FTP_RESULT(stream); in php_fopen_do_pasv()
416 php_stream *stream = NULL, *datastream = NULL; in php_stream_url_wrap_ftp() local
466 …stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &reso… in php_stream_url_wrap_ftp()
467 if (!stream) { in php_stream_url_wrap_ftp()
472 php_stream_write_string(stream, "TYPE I\r\n"); in php_stream_url_wrap_ftp()
473 result = GET_FTP_RESULT(stream); in php_stream_url_wrap_ftp()
478 php_stream_printf(stream, "SIZE %s\r\n", ZSTR_VAL(resource->path)); in php_stream_url_wrap_ftp()
481 result = GET_FTP_RESULT(stream); in php_stream_url_wrap_ftp()
507 php_stream_printf(stream, "DELE %s\r\n", ZSTR_VAL(resource->path)); in php_stream_url_wrap_ftp()
508 result = GET_FTP_RESULT(stream); in php_stream_url_wrap_ftp()
521 portno = php_fopen_do_pasv(stream, ip, sizeof(ip), &hoststart); in php_stream_url_wrap_ftp()
534 php_stream_printf(stream, "REST " ZEND_LONG_FMT "\r\n", Z_LVAL_P(tmpzval)); in php_stream_url_wrap_ftp()
535 result = GET_FTP_RESULT(stream); in php_stream_url_wrap_ftp()
551 …php_stream_printf(stream, "%s %s\r\n", tmp_line, (resource->path != NULL ? ZSTR_VAL(resource->path… in php_stream_url_wrap_ftp()
565 result = GET_FTP_RESULT(stream); in php_stream_url_wrap_ftp()
590 datastream->wrapperthis = stream; in php_stream_url_wrap_ftp()
599 if (stream) { in php_stream_url_wrap_ftp()
601 php_stream_close(stream); in php_stream_url_wrap_ftp()
616 static ssize_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count) in php_ftp_dirstream_read() argument
623 innerstream = ((php_ftp_dirstream_data *)stream->abstract)->datastream; in php_ftp_dirstream_read()
657 static int php_ftp_dirstream_close(php_stream *stream, int close_handle) in php_ftp_dirstream_close() argument
659 php_ftp_dirstream_data *data = stream->abstract; in php_ftp_dirstream_close()
671 stream->abstract = NULL; in php_ftp_dirstream_close()
696 php_stream *stream, *reuseid, *datastream = NULL; in php_stream_ftp_opendir() local
706 …stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &reso… in php_stream_ftp_opendir()
707 if (!stream) { in php_stream_ftp_opendir()
712 php_stream_write_string(stream, "TYPE A\r\n"); in php_stream_ftp_opendir()
713 result = GET_FTP_RESULT(stream); in php_stream_ftp_opendir()
721 portno = php_fopen_do_pasv(stream, ip, sizeof(ip), &hoststart); in php_stream_ftp_opendir()
737 …php_stream_printf(stream, "NLST %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")… in php_stream_ftp_opendir()
739 result = GET_FTP_RESULT(stream); in php_stream_ftp_opendir()
764 dirsdata->controlstream = stream; in php_stream_ftp_opendir()
773 if (stream) { in php_stream_ftp_opendir()
775 php_stream_close(stream); in php_stream_ftp_opendir()
788 php_stream *stream = NULL; in php_stream_ftp_url_stat() local
796 stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, context, NULL, &resource, NULL, NULL); in php_stream_ftp_url_stat()
797 if (!stream) { in php_stream_ftp_url_stat()
802 …php_stream_printf(stream, "CWD %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/"))… in php_stream_ftp_url_stat()
803 result = GET_FTP_RESULT(stream); in php_stream_ftp_url_stat()
810 …php_stream_write_string(stream, "TYPE I\r\n"); /* we need this since some servers refuse to accept… in php_stream_ftp_url_stat()
812 result = GET_FTP_RESULT(stream); in php_stream_ftp_url_stat()
818 …php_stream_printf(stream, "SIZE %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")… in php_stream_ftp_url_stat()
819 result = GET_FTP_RESULT(stream); in php_stream_ftp_url_stat()
833 …php_stream_printf(stream, "MDTM %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")… in php_stream_ftp_url_stat()
834 result = GET_FTP_RESULT(stream); in php_stream_ftp_url_stat()
892 php_stream_close(stream); in php_stream_ftp_url_stat()
900 if (stream) { in php_stream_ftp_url_stat()
901 php_stream_close(stream); in php_stream_ftp_url_stat()
911 php_stream *stream = NULL; in php_stream_ftp_unlink() local
916 stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, context, NULL, &resource, NULL, NULL); in php_stream_ftp_unlink()
917 if (!stream) { in php_stream_ftp_unlink()
932 …php_stream_printf(stream, "DELE %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")… in php_stream_ftp_unlink()
934 result = GET_FTP_RESULT(stream); in php_stream_ftp_unlink()
943 php_stream_close(stream); in php_stream_ftp_unlink()
950 if (stream) { in php_stream_ftp_unlink()
951 php_stream_close(stream); in php_stream_ftp_unlink()
961 php_stream *stream = NULL; in php_stream_ftp_rename() local
987 stream = php_ftp_fopen_connect(wrapper, url_from, "r", 0, NULL, context, NULL, NULL, NULL, NULL); in php_stream_ftp_rename()
988 if (!stream) { in php_stream_ftp_rename()
996 …php_stream_printf(stream, "RNFR %s\r\n", (resource_from->path != NULL ? ZSTR_VAL(resource_from->pa… in php_stream_ftp_rename()
998 result = GET_FTP_RESULT(stream); in php_stream_ftp_rename()
1007 …php_stream_printf(stream, "RNTO %s\r\n", (resource_to->path != NULL ? ZSTR_VAL(resource_to->path) … in php_stream_ftp_rename()
1009 result = GET_FTP_RESULT(stream); in php_stream_ftp_rename()
1019 php_stream_close(stream); in php_stream_ftp_rename()
1029 if (stream) { in php_stream_ftp_rename()
1030 php_stream_close(stream); in php_stream_ftp_rename()
1040 php_stream *stream = NULL; in php_stream_ftp_mkdir() local
1045 stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, context, NULL, &resource, NULL, NULL); in php_stream_ftp_mkdir()
1046 if (!stream) { in php_stream_ftp_mkdir()
1061 php_stream_printf(stream, "MKD %s\r\n", ZSTR_VAL(resource->path)); in php_stream_ftp_mkdir()
1062 result = GET_FTP_RESULT(stream); in php_stream_ftp_mkdir()
1073 php_stream_printf(stream, "CWD %s\r\n", strlen(buf) ? buf : "/"); in php_stream_ftp_mkdir()
1074 result = GET_FTP_RESULT(stream); in php_stream_ftp_mkdir()
1081 php_stream_printf(stream, "MKD %s\r\n", strlen(buf) ? buf : "/"); in php_stream_ftp_mkdir()
1082 result = GET_FTP_RESULT(stream); in php_stream_ftp_mkdir()
1092 php_stream_printf(stream, "MKD %s\r\n", buf); in php_stream_ftp_mkdir()
1093 result = GET_FTP_RESULT(stream); in php_stream_ftp_mkdir()
1109 php_stream_close(stream); in php_stream_ftp_mkdir()
1122 if (stream) { in php_stream_ftp_mkdir()
1123 php_stream_close(stream); in php_stream_ftp_mkdir()
1133 php_stream *stream = NULL; in php_stream_ftp_rmdir() local
1138 stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, context, NULL, &resource, NULL, NULL); in php_stream_ftp_rmdir()
1139 if (!stream) { in php_stream_ftp_rmdir()
1153 php_stream_printf(stream, "RMD %s\r\n", ZSTR_VAL(resource->path)); in php_stream_ftp_rmdir()
1154 result = GET_FTP_RESULT(stream); in php_stream_ftp_rmdir()
1164 php_stream_close(stream); in php_stream_ftp_rmdir()
1172 if (stream) { in php_stream_ftp_rmdir()
1173 php_stream_close(stream); in php_stream_ftp_rmdir()