Date: 07/30/98
- Next message: Lars Torben Wilson: "[PHP-DEV] HTML proxy support"
- Previous message: Bug Database: "[PHP-DEV] Bug #568 Updated: pg_loreadall does not output all of the data"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Find attached a patch that addresses bug # 588: write files thru ftp.
The patch was generated against 3.0.2a.
ck
*** fopen-wrappers.c Thu Jul 30 12:48:20 1998
--- fopen-wrappers.c.orig Mon Jul 20 07:56:05 1998
***************
*** 610,616 ****
*socketd = 0;
return NULL;
}
-
/* find out the size of the file (verifying it exists) */
SOCK_WRITE("SIZE ", *socketd);
SOCK_WRITE(resource->path, *socketd);
--- 610,615 ----
***************
*** 618,645 ****
/* read the response */
result = _php3_getftpresult(*socketd);
! if (mode[0] == 'r') {
! /* when reading file, it must exist */
! if (result > 299 || result < 200) {
! php3_error(E_WARNING, "File not found");
! free_url(resource);
! SOCK_FCLOSE(*socketd);
! *socketd = 0;
! errno = ENOENT;
! return NULL;
! }
! } else {
! /* when writing file, it must NOT exist */
! if (result <= 299 && result >= 200) {
! php3_error(E_WARNING, "File already exists");
! free_url(resource);
! SOCK_FCLOSE(*socketd);
! *socketd = 0;
! errno = EEXIST;
! return NULL;
! }
}
-
/* set the connection to be binary */
SOCK_WRITE("TYPE I\n", *socketd);
result = _php3_getftpresult(*socketd);
--- 617,628 ----
/* read the response */
result = _php3_getftpresult(*socketd);
! if (result > 299 || result < 200) {
! free_url(resource);
! SOCK_FCLOSE(*socketd);
! *socketd = 0;
! return NULL;
}
/* set the connection to be binary */
SOCK_WRITE("TYPE I\n", *socketd);
result = _php3_getftpresult(*socketd);
***************
*** 714,734 ****
*socketd = 0;
return NULL;
}
!
! if (mode[0] == 'r') {
! /* retrieve file */
! SOCK_WRITE("RETR ", *socketd);
! } else {
! /* store file */
! SOCK_WRITE("STOR ", *socketd);
! }
if (resource->path != NULL) {
SOCK_WRITE(resource->path, *socketd);
} else {
SOCK_WRITE("/", *socketd);
}
-
- /* close control connection */
SOCK_WRITE("\nQUIT\n", *socketd);
SOCK_FCLOSE(*socketd);
--- 697,710 ----
*socketd = 0;
return NULL;
}
! /* finally, send a message to start retrieving the file, and
! close the command connection */
! SOCK_WRITE("RETR ", *socketd);
if (resource->path != NULL) {
SOCK_WRITE(resource->path, *socketd);
} else {
SOCK_WRITE("/", *socketd);
}
SOCK_WRITE("\nQUIT\n", *socketd);
SOCK_FCLOSE(*socketd);
***************
*** 758,773 ****
return NULL;
}
#if 0
! if (mode[0] == 'r') {
! if ((fp = fdopen(*socketd, "r+")) == NULL) {
! free_url(resource);
! return NULL;
! }
! } else {
! if ((fp = fdopen(*socketd, "w+")) == NULL) {
! free_url(resource);
! return NULL;
! }
}
#ifdef HAVE_SETVBUF
if ((setvbuf(fp, NULL, _IONBF, 0)) != 0) {
--- 734,742 ----
return NULL;
}
#if 0
! if ((fp = fdopen(*socketd, "r+")) == NULL) {
! free_url(resource);
! return NULL;
}
#ifdef HAVE_SETVBUF
if ((setvbuf(fp, NULL, _IONBF, 0)) != 0) {
- Next message: Lars Torben Wilson: "[PHP-DEV] HTML proxy support"
- Previous message: Bug Database: "[PHP-DEV] Bug #568 Updated: pg_loreadall does not output all of the data"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

