@@ -300,19 +300,21 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, char *path
300
300
301
301
/* {{{ php_fopen_do_pasv
302
302
*/
303
- static unsigned short php_fopen_do_pasv (php_stream * stream , char * ip , int ip_size , char * * phoststart TSRMLS_DC )
303
+ static unsigned short php_fopen_do_pasv (php_stream * stream , char * ip , size_t ip_size , char * * phoststart TSRMLS_DC )
304
304
{
305
305
char tmp_line [512 ];
306
306
int result , i ;
307
307
unsigned short portno ;
308
308
char * tpath , * ttpath , * hoststart = NULL ;
309
309
310
+ #ifdef HAVE_IPV6
310
311
/* We try EPSV first, needed for IPv6 and works on some IPv4 servers */
311
312
php_stream_write_string (stream , "EPSV\r\n" );
312
313
result = GET_FTP_RESULT (stream );
313
314
314
315
/* check if we got a 229 response */
315
316
if (result != 229 ) {
317
+ #endif
316
318
/* EPSV failed, let's try PASV */
317
319
php_stream_write_string (stream , "PASV\r\n" );
318
320
result = GET_FTP_RESULT (stream );
@@ -357,6 +359,7 @@ static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, int ip_siz
357
359
tpath ++ ;
358
360
/* pull out the LSB of the port */
359
361
portno += (unsigned short ) strtoul (tpath , & ttpath , 10 );
362
+ #ifdef HAVE_IPV6
360
363
} else {
361
364
/* parse epsv command (|||6446|) */
362
365
for (i = 0 , tpath = tmp_line + 4 ; * tpath ; tpath ++ ) {
@@ -372,7 +375,7 @@ static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, int ip_siz
372
375
/* pull out the port */
373
376
portno = (unsigned short ) strtoul (tpath + 1 , & ttpath , 10 );
374
377
}
375
-
378
+ #endif
376
379
if (ttpath == NULL ) {
377
380
/* didn't get correct response from EPSV/PASV */
378
381
return 0 ;
0 commit comments