FTP Bridge to HTTP service

Source: Internet
Author: User
First of all, I need to say: My Linode server recently FTP and SFTP is not connected, the port is blocked, only HTTP can access, I have no way to upload files.
Because I usually use beyond compare upload files, very convenient. So I want to be able to connect to the remote HTTP server by starting an FTP service locally, so that my beyond compare can continue to use.


The requirement is simple, just implement an extensible FTP server, and then rewrite the part of the read file to access the file system on the server through the remote HTTP interface.
After a few days of effort, the function has been fully realized.


Problems encountered:

1. Large files, for large files, the general HTTP server has the upload file size limit, I was uploaded by paragraph, so there will not be this problem. You can upload an issue of any size.


2. The above problem is derived from the new problem, if the file is too large, upload by segment may initiate a lot of HTTP requests, too many connections may run out of the local socket port,

A long connection of http1.1 is currently used to reduce the number of connections and to set the socket reuseaddress to true at the same time.


3. Multipart upload can not be too small, otherwise very slow, if too large, wasting memory, if you upload too many files, it is likely to quickly run out of virtual machine memory, because too late to release.
So adopt the policy of automatically resizing cache, start with a very small cache, each flush cache size will be expanded one time until the configured maximum value, the maximum is not more than 1M (configurable).

The general small file, basically does not need to expand.


4. In order to make the program as simple as possible, the beginning of uploading the use of paragraph data when the use of Base64 encoding, the test of large files feel slower, and later changed to chunked mode upload, speed can be increased several times.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

FTP Bridge to HTTP service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.