0

In my project, I need to do this:

server1 ---http-download (curl)---> my pc ---http-upload(curl)---> server2

This is obviously duplicating traffic. I wonder if there is a method to direct server1 to do http upload files to server2 like the following:

my pc ---http-request---> server1 ----http-upload---> server2

Is it possible using existing web servers?

Please note that both servers are not within my system, in other words, server 1 and server 2 are not under my control.

TieDad
  • 274
  • 5
  • 13
  • Simply convert your current curl upload command line to a CGI script or code something similar in another language? Or avoid the whole webserver and use scp, sftp or rsync and transfer files directly between systems. – HBruijn May 29 '14 at 09:17
  • Please note that both servers are not within my system. – TieDad May 29 '14 at 09:30

2 Answers2

2

Possible options:

  • Update the receiving script on server2, such that instead of receiving an uploaded file, it can be given a URL of a file on server1, that it has to go fetch.
  • Put a script on server1, which can be given information about how to upload the file to server2. This is likely more complicated, as uploading requires more than just a URL.
  • Use FTP instead of HTTP, because what you are asking is actually possible to do with FTP. Though there is a risk that one of the sites has a firewall blocking that sort of transfer.

If none of the above are supported, and you don't have sufficient access to either server to get it supported, then the answer is: No, you cannot transfer the file directly.

The intermediate storage for the file doesn't have to be the PC you are sitting at. If you need to do this sort of transfer frequently, you may be better off using a strategically located VPS for the intermediate storage.

kasperd
  • 30,455
  • 17
  • 76
  • 124
1

If you have control of the servers (which you don't) you'd rsync, or even have server2 wget the file from server 1.

As you don't have access, you must download the file from one, and upload it to the other. As you have no way of making server 2 make a request to server 1 for the file.

i-CONICA
  • 648
  • 1
  • 9
  • 22