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()
304 if (stream) { in php_ftp_fopen_connect()
305 php_stream_close(stream); in php_ftp_fopen_connect()
313 static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, size_t ip_size, char **phosts… in php_fopen_do_pasv() argument
322 php_stream_write_string(stream, "EPSV\r\n"); in php_fopen_do_pasv()
323 result = GET_FTP_RESULT(stream); in php_fopen_do_pasv()
329 php_stream_write_string(stream, "PASV\r\n"); in php_fopen_do_pasv()
330 result = GET_FTP_RESULT(stream); in php_fopen_do_pasv()
406 php_stream *stream = NULL, *datastream = NULL; in php_stream_url_wrap_ftp() local
456 …stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &reso… in php_stream_url_wrap_ftp()
457 if (!stream) { in php_stream_url_wrap_ftp()
462 php_stream_write_string(stream, "TYPE I\r\n"); in php_stream_url_wrap_ftp()
463 result = GET_FTP_RESULT(stream); in php_stream_url_wrap_ftp()
468 php_stream_printf(stream, "SIZE %s\r\n", ZSTR_VAL(resource->path)); in php_stream_url_wrap_ftp()
471 result = GET_FTP_RESULT(stream); in php_stream_url_wrap_ftp()
497 php_stream_printf(stream, "DELE %s\r\n", ZSTR_VAL(resource->path)); in php_stream_url_wrap_ftp()
498 result = GET_FTP_RESULT(stream); in php_stream_url_wrap_ftp()
511 portno = php_fopen_do_pasv(stream, ip, sizeof(ip), &hoststart); in php_stream_url_wrap_ftp()
524 php_stream_printf(stream, "REST " ZEND_LONG_FMT "\r\n", Z_LVAL_P(tmpzval)); in php_stream_url_wrap_ftp()
525 result = GET_FTP_RESULT(stream); in php_stream_url_wrap_ftp()
541 …php_stream_printf(stream, "%s %s\r\n", tmp_line, (resource->path != NULL ? ZSTR_VAL(resource->path… in php_stream_url_wrap_ftp()
555 result = GET_FTP_RESULT(stream); in php_stream_url_wrap_ftp()
580 datastream->wrapperthis = stream; in php_stream_url_wrap_ftp()
589 if (stream) { in php_stream_url_wrap_ftp()
591 php_stream_close(stream); in php_stream_url_wrap_ftp()
605 static ssize_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count) in php_ftp_dirstream_read() argument
612 innerstream = ((php_ftp_dirstream_data *)stream->abstract)->datastream; in php_ftp_dirstream_read()
646 static int php_ftp_dirstream_close(php_stream *stream, int close_handle) in php_ftp_dirstream_close() argument
648 php_ftp_dirstream_data *data = stream->abstract; in php_ftp_dirstream_close()
660 stream->abstract = NULL; in php_ftp_dirstream_close()
684 php_stream *stream, *reuseid, *datastream = NULL; in php_stream_ftp_opendir() local
694 …stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &reso… in php_stream_ftp_opendir()
695 if (!stream) { in php_stream_ftp_opendir()
700 php_stream_write_string(stream, "TYPE A\r\n"); in php_stream_ftp_opendir()
701 result = GET_FTP_RESULT(stream); in php_stream_ftp_opendir()
709 portno = php_fopen_do_pasv(stream, ip, sizeof(ip), &hoststart); in php_stream_ftp_opendir()
725 …php_stream_printf(stream, "NLST %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")… in php_stream_ftp_opendir()
727 result = GET_FTP_RESULT(stream); in php_stream_ftp_opendir()
752 dirsdata->controlstream = stream; in php_stream_ftp_opendir()
761 if (stream) { in php_stream_ftp_opendir()
763 php_stream_close(stream); in php_stream_ftp_opendir()
775 php_stream *stream = NULL; in php_stream_ftp_url_stat() local
783 stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, context, NULL, &resource, NULL, NULL); in php_stream_ftp_url_stat()
784 if (!stream) { in php_stream_ftp_url_stat()
789 …php_stream_printf(stream, "CWD %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/"))… in php_stream_ftp_url_stat()
790 result = GET_FTP_RESULT(stream); in php_stream_ftp_url_stat()
797 …php_stream_write_string(stream, "TYPE I\r\n"); /* we need this since some servers refuse to accept… in php_stream_ftp_url_stat()
799 result = GET_FTP_RESULT(stream); in php_stream_ftp_url_stat()
805 …php_stream_printf(stream, "SIZE %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")… in php_stream_ftp_url_stat()
806 result = GET_FTP_RESULT(stream); in php_stream_ftp_url_stat()
820 …php_stream_printf(stream, "MDTM %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")… in php_stream_ftp_url_stat()
821 result = GET_FTP_RESULT(stream); in php_stream_ftp_url_stat()
879 php_stream_close(stream); in php_stream_ftp_url_stat()
887 if (stream) { in php_stream_ftp_url_stat()
888 php_stream_close(stream); in php_stream_ftp_url_stat()
897 php_stream *stream = NULL; in php_stream_ftp_unlink() local
902 stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, context, NULL, &resource, NULL, NULL); in php_stream_ftp_unlink()
903 if (!stream) { in php_stream_ftp_unlink()
918 php_stream_printf(stream, "DELE %s\r\n", ZSTR_VAL(resource->path)); in php_stream_ftp_unlink()
920 result = GET_FTP_RESULT(stream); in php_stream_ftp_unlink()
929 php_stream_close(stream); in php_stream_ftp_unlink()
936 if (stream) { in php_stream_ftp_unlink()
937 php_stream_close(stream); in php_stream_ftp_unlink()
946 php_stream *stream = NULL; in php_stream_ftp_rename() local
972 stream = php_ftp_fopen_connect(wrapper, url_from, "r", 0, NULL, context, NULL, NULL, NULL, NULL); in php_stream_ftp_rename()
973 if (!stream) { in php_stream_ftp_rename()
981 php_stream_printf(stream, "RNFR %s\r\n", ZSTR_VAL(resource_from->path)); in php_stream_ftp_rename()
983 result = GET_FTP_RESULT(stream); in php_stream_ftp_rename()
992 php_stream_printf(stream, "RNTO %s\r\n", ZSTR_VAL(resource_to->path)); in php_stream_ftp_rename()
994 result = GET_FTP_RESULT(stream); in php_stream_ftp_rename()
1004 php_stream_close(stream); in php_stream_ftp_rename()
1014 if (stream) { in php_stream_ftp_rename()
1015 php_stream_close(stream); in php_stream_ftp_rename()
1024 php_stream *stream = NULL; in php_stream_ftp_mkdir() local
1029 stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, context, NULL, &resource, NULL, NULL); in php_stream_ftp_mkdir()
1030 if (!stream) { in php_stream_ftp_mkdir()
1045 php_stream_printf(stream, "MKD %s\r\n", ZSTR_VAL(resource->path)); in php_stream_ftp_mkdir()
1046 result = GET_FTP_RESULT(stream); in php_stream_ftp_mkdir()
1057 php_stream_printf(stream, "CWD %s\r\n", strlen(buf) ? buf : "/"); in php_stream_ftp_mkdir()
1058 result = GET_FTP_RESULT(stream); in php_stream_ftp_mkdir()
1065 php_stream_printf(stream, "MKD %s\r\n", strlen(buf) ? buf : "/"); in php_stream_ftp_mkdir()
1066 result = GET_FTP_RESULT(stream); in php_stream_ftp_mkdir()
1076 php_stream_printf(stream, "MKD %s\r\n", buf); in php_stream_ftp_mkdir()
1077 result = GET_FTP_RESULT(stream); in php_stream_ftp_mkdir()
1093 php_stream_close(stream); in php_stream_ftp_mkdir()
1106 if (stream) { in php_stream_ftp_mkdir()
1107 php_stream_close(stream); in php_stream_ftp_mkdir()
1116 php_stream *stream = NULL; in php_stream_ftp_rmdir() local
1121 stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, context, NULL, &resource, NULL, NULL); in php_stream_ftp_rmdir()
1122 if (!stream) { in php_stream_ftp_rmdir()
1136 php_stream_printf(stream, "RMD %s\r\n", ZSTR_VAL(resource->path)); in php_stream_ftp_rmdir()
1137 result = GET_FTP_RESULT(stream); in php_stream_ftp_rmdir()
1147 php_stream_close(stream); in php_stream_ftp_rmdir()
1155 if (stream) { in php_stream_ftp_rmdir()
1156 php_stream_close(stream); in php_stream_ftp_rmdir()