Lines Matching refs:stream
68 #define GET_FTP_RESULT(stream) get_ftp_result((stream), tmp_line, sizeof(tmp_line)) argument
77 static inline int get_ftp_result(php_stream *stream, char *buffer, size_t buffer_size) in get_ftp_result() argument
80 while (php_stream_gets(stream, buffer, buffer_size-1) && in get_ftp_result()
88 static int php_stream_ftp_stream_stat(php_stream_wrapper *wrapper, php_stream *stream, php_stream_s… in php_stream_ftp_stream_stat() argument
97 static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper, php_stream *stream) in php_stream_ftp_stream_close() argument
99 php_stream *controlstream = stream->wrapperthis; in php_stream_ftp_stream_close()
103 if (strpbrk(stream->mode, "wa+")) { in php_stream_ftp_stream_close()
117 stream->wrapperthis = NULL; in php_stream_ftp_stream_close()
129 php_stream *stream = NULL, *reuseid = NULL; in php_ftp_fopen_connect() local
151 …stream = php_stream_xport_create(transport, transport_len, REPORT_ERRORS, STREAM_XPORT_CLIENT | ST… in php_ftp_fopen_connect()
153 if (stream == NULL) { in php_ftp_fopen_connect()
158 php_stream_context_set(stream, context); in php_ftp_fopen_connect()
162 result = GET_FTP_RESULT(stream); in php_ftp_fopen_connect()
171 php_stream_write_string(stream, "AUTH TLS\r\n"); in php_ftp_fopen_connect()
174 result = GET_FTP_RESULT(stream); in php_ftp_fopen_connect()
177 php_stream_write_string(stream, "AUTH SSL\r\n"); in php_ftp_fopen_connect()
180 result = GET_FTP_RESULT(stream); in php_ftp_fopen_connect()
187 reuseid = stream; in php_ftp_fopen_connect()
198 if (php_stream_xport_crypto_setup(stream, in php_ftp_fopen_connect()
200 || php_stream_xport_crypto_enable(stream, 1) < 0) { in php_ftp_fopen_connect()
202 php_stream_close(stream); in php_ftp_fopen_connect()
203 stream = NULL; in php_ftp_fopen_connect()
208 php_stream_write_string(stream, "PBSZ 0\r\n"); in php_ftp_fopen_connect()
211 result = GET_FTP_RESULT(stream); in php_ftp_fopen_connect()
215 php_stream_write_string(stream, "PROT P\r\n"); in php_ftp_fopen_connect()
218 result = GET_FTP_RESULT(stream); in php_ftp_fopen_connect()
221 php_stream_write_string(stream, "PROT C\r\n"); in php_ftp_fopen_connect()
224 result = GET_FTP_RESULT(stream); in php_ftp_fopen_connect()
245 php_stream_printf(stream, "USER %s\r\n", ZSTR_VAL(resource->user)); in php_ftp_fopen_connect()
247 php_stream_write_string(stream, "USER anonymous\r\n"); in php_ftp_fopen_connect()
251 result = GET_FTP_RESULT(stream); in php_ftp_fopen_connect()
262 php_stream_printf(stream, "PASS %s\r\n", ZSTR_VAL(resource->pass)); in php_ftp_fopen_connect()
267 php_stream_printf(stream, "PASS %s\r\n", FG(from_address)); in php_ftp_fopen_connect()
269 php_stream_write_string(stream, "PASS anonymous\r\n"); in php_ftp_fopen_connect()
274 result = GET_FTP_RESULT(stream); in php_ftp_fopen_connect()
299 return stream; in php_ftp_fopen_connect()
306 if (stream) { in php_ftp_fopen_connect()
307 php_stream_close(stream); in php_ftp_fopen_connect()
315 static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, size_t ip_size, char **phosts… in php_fopen_do_pasv() argument
324 php_stream_write_string(stream, "EPSV\r\n"); in php_fopen_do_pasv()
325 result = GET_FTP_RESULT(stream); in php_fopen_do_pasv()
331 php_stream_write_string(stream, "PASV\r\n"); in php_fopen_do_pasv()
332 result = GET_FTP_RESULT(stream); in php_fopen_do_pasv()
408 php_stream *stream = NULL, *datastream = NULL; in php_stream_url_wrap_ftp() local
458 …stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &reso… in php_stream_url_wrap_ftp()
459 if (!stream) { in php_stream_url_wrap_ftp()
464 php_stream_write_string(stream, "TYPE I\r\n"); in php_stream_url_wrap_ftp()
465 result = GET_FTP_RESULT(stream); in php_stream_url_wrap_ftp()
470 php_stream_printf(stream, "SIZE %s\r\n", ZSTR_VAL(resource->path)); in php_stream_url_wrap_ftp()
473 result = GET_FTP_RESULT(stream); in php_stream_url_wrap_ftp()
499 php_stream_printf(stream, "DELE %s\r\n", ZSTR_VAL(resource->path)); in php_stream_url_wrap_ftp()
500 result = GET_FTP_RESULT(stream); in php_stream_url_wrap_ftp()
513 portno = php_fopen_do_pasv(stream, ip, sizeof(ip), &hoststart); in php_stream_url_wrap_ftp()
526 php_stream_printf(stream, "REST " ZEND_LONG_FMT "\r\n", Z_LVAL_P(tmpzval)); in php_stream_url_wrap_ftp()
527 result = GET_FTP_RESULT(stream); in php_stream_url_wrap_ftp()
543 …php_stream_printf(stream, "%s %s\r\n", tmp_line, (resource->path != NULL ? ZSTR_VAL(resource->path… in php_stream_url_wrap_ftp()
557 result = GET_FTP_RESULT(stream); in php_stream_url_wrap_ftp()
582 datastream->wrapperthis = stream; in php_stream_url_wrap_ftp()
591 if (stream) { in php_stream_url_wrap_ftp()
593 php_stream_close(stream); in php_stream_url_wrap_ftp()
607 static ssize_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count) in php_ftp_dirstream_read() argument
614 innerstream = ((php_ftp_dirstream_data *)stream->abstract)->datastream; in php_ftp_dirstream_read()
647 static int php_ftp_dirstream_close(php_stream *stream, int close_handle) in php_ftp_dirstream_close() argument
649 php_ftp_dirstream_data *data = stream->abstract; in php_ftp_dirstream_close()
661 stream->abstract = NULL; in php_ftp_dirstream_close()
685 php_stream *stream, *reuseid, *datastream = NULL; in php_stream_ftp_opendir() local
695 …stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &reso… in php_stream_ftp_opendir()
696 if (!stream) { in php_stream_ftp_opendir()
701 php_stream_write_string(stream, "TYPE A\r\n"); in php_stream_ftp_opendir()
702 result = GET_FTP_RESULT(stream); in php_stream_ftp_opendir()
710 portno = php_fopen_do_pasv(stream, ip, sizeof(ip), &hoststart); in php_stream_ftp_opendir()
726 …php_stream_printf(stream, "NLST %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")… in php_stream_ftp_opendir()
728 result = GET_FTP_RESULT(stream); in php_stream_ftp_opendir()
753 dirsdata->controlstream = stream; in php_stream_ftp_opendir()
762 if (stream) { in php_stream_ftp_opendir()
764 php_stream_close(stream); in php_stream_ftp_opendir()
776 php_stream *stream = NULL; in php_stream_ftp_url_stat() local
784 stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, context, NULL, &resource, NULL, NULL); in php_stream_ftp_url_stat()
785 if (!stream) { in php_stream_ftp_url_stat()
790 …php_stream_printf(stream, "CWD %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/"))… in php_stream_ftp_url_stat()
791 result = GET_FTP_RESULT(stream); in php_stream_ftp_url_stat()
798 …php_stream_write_string(stream, "TYPE I\r\n"); /* we need this since some servers refuse to accept… in php_stream_ftp_url_stat()
800 result = GET_FTP_RESULT(stream); in php_stream_ftp_url_stat()
806 …php_stream_printf(stream, "SIZE %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")… in php_stream_ftp_url_stat()
807 result = GET_FTP_RESULT(stream); in php_stream_ftp_url_stat()
821 …php_stream_printf(stream, "MDTM %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")… in php_stream_ftp_url_stat()
822 result = GET_FTP_RESULT(stream); in php_stream_ftp_url_stat()
880 php_stream_close(stream); in php_stream_ftp_url_stat()
888 if (stream) { in php_stream_ftp_url_stat()
889 php_stream_close(stream); in php_stream_ftp_url_stat()
898 php_stream *stream = NULL; in php_stream_ftp_unlink() local
903 stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, context, NULL, &resource, NULL, NULL); in php_stream_ftp_unlink()
904 if (!stream) { in php_stream_ftp_unlink()
919 …php_stream_printf(stream, "DELE %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")… in php_stream_ftp_unlink()
921 result = GET_FTP_RESULT(stream); in php_stream_ftp_unlink()
930 php_stream_close(stream); in php_stream_ftp_unlink()
937 if (stream) { in php_stream_ftp_unlink()
938 php_stream_close(stream); in php_stream_ftp_unlink()
947 php_stream *stream = NULL; in php_stream_ftp_rename() local
973 stream = php_ftp_fopen_connect(wrapper, url_from, "r", 0, NULL, context, NULL, NULL, NULL, NULL); in php_stream_ftp_rename()
974 if (!stream) { in php_stream_ftp_rename()
982 …php_stream_printf(stream, "RNFR %s\r\n", (resource_from->path != NULL ? ZSTR_VAL(resource_from->pa… in php_stream_ftp_rename()
984 result = GET_FTP_RESULT(stream); in php_stream_ftp_rename()
993 …php_stream_printf(stream, "RNTO %s\r\n", (resource_to->path != NULL ? ZSTR_VAL(resource_to->path) … in php_stream_ftp_rename()
995 result = GET_FTP_RESULT(stream); in php_stream_ftp_rename()
1005 php_stream_close(stream); in php_stream_ftp_rename()
1015 if (stream) { in php_stream_ftp_rename()
1016 php_stream_close(stream); in php_stream_ftp_rename()
1025 php_stream *stream = NULL; in php_stream_ftp_mkdir() local
1030 stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, context, NULL, &resource, NULL, NULL); in php_stream_ftp_mkdir()
1031 if (!stream) { in php_stream_ftp_mkdir()
1046 php_stream_printf(stream, "MKD %s\r\n", ZSTR_VAL(resource->path)); in php_stream_ftp_mkdir()
1047 result = GET_FTP_RESULT(stream); in php_stream_ftp_mkdir()
1058 php_stream_printf(stream, "CWD %s\r\n", strlen(buf) ? buf : "/"); in php_stream_ftp_mkdir()
1059 result = GET_FTP_RESULT(stream); in php_stream_ftp_mkdir()
1066 php_stream_printf(stream, "MKD %s\r\n", strlen(buf) ? buf : "/"); in php_stream_ftp_mkdir()
1067 result = GET_FTP_RESULT(stream); in php_stream_ftp_mkdir()
1077 php_stream_printf(stream, "MKD %s\r\n", buf); in php_stream_ftp_mkdir()
1078 result = GET_FTP_RESULT(stream); in php_stream_ftp_mkdir()
1094 php_stream_close(stream); in php_stream_ftp_mkdir()
1107 if (stream) { in php_stream_ftp_mkdir()
1108 php_stream_close(stream); in php_stream_ftp_mkdir()
1117 php_stream *stream = NULL; in php_stream_ftp_rmdir() local
1122 stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, context, NULL, &resource, NULL, NULL); in php_stream_ftp_rmdir()
1123 if (!stream) { in php_stream_ftp_rmdir()
1137 php_stream_printf(stream, "RMD %s\r\n", ZSTR_VAL(resource->path)); in php_stream_ftp_rmdir()
1138 result = GET_FTP_RESULT(stream); in php_stream_ftp_rmdir()
1148 php_stream_close(stream); in php_stream_ftp_rmdir()
1156 if (stream) { in php_stream_ftp_rmdir()
1157 php_stream_close(stream); in php_stream_ftp_rmdir()