FTPAPI using HTTP Proxy

Discussions related to FTPAPI (An FTP client package for RPG programming.) http://www.scottklement.com/ftpapi/
Post Reply
basim
Posts: 1
Joined: Tue Oct 07, 2025 7:33 pm

FTPAPI using HTTP Proxy

Post by basim »

All,
I m try to use a ftp connection through an HTTP proxy but i got always the following error when i try to retrieve data from the final destination.
I try to investigate the error
First of all i apply some change to the setProxy procedure some %parms checking are not correct
P FTP_setProxy B export
D PI 10i 0
D peProxy 256A varying const
D pePort 10i 0 const options(*nopass:*omit)
D peUser 2048A varying const options(*nopass:*omit)
D pePass 2048A varying const options(*nopass:omit)
C0N01Factor1+++++++Opcode&ExtFactor2+++++++Result++++++++Len++D+HiLoEq
c eval wkProxHost = peProxy
c eval wkProxPort = 0
c eval wkProxUser = ''
c eval wkProxPass = ''

c if %parms >= 4 and %addr(pePort) <> *null shoud be if %parms >= 2
c eval wkProxPort = pePort
c endif

c if %parms >= 5 and %addr(peUser) <> *null should be if %parms >= 3
c eval wkProxUser = peUser
c endif

c if %parms >= 6 and %addr(pePass) <> *null should be if %parms >= 4
c eval wkProxPass = pePass
c endif

c return 0
P E

After that this line under TCP_Conn seems are not correct . I see that pehost and peport are filled in with the PROXY ip not the final destination one
Pehost and Peport are coming from variable wwhost and wwport in subroutine try_epsv procedure ftptcp_getPeerAddr,


9016 5 * connect to remote site
9017 6 c if ftptcp_connect( wwSocket
9018 7 c : %trim(peHost)
9019 8 c : pePort
9020 9 c : wkProxHost
9021 0 c : wkProxPort

Can someone tell me how change this procedure ?
Thanks

Basilio Merlino
Post Reply