diff --git a/.gitignore b/.gitignore
index 25d79a2..c9069ae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
.idea/
build/
run/
+out/
gradle/
gradlew
gradlew.bat
diff --git a/README.md b/README.md
index 56a5b1d..d7401af 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,17 @@
# MinimalFTP [![Build Status](https://travis-ci.org/Guichaguri/MinimalFTP.svg?branch=master)](https://travis-ci.org/Guichaguri/MinimalFTP)
A lightweight, simple FTP server. Pure Java, no libraries.
-Although it's named "minimal", it supports 53 FTP commands, TLS/SSL, custom file system, custom user authentication, custom commands, etc
+## Features
+Although it's named "minimal", it supports a bunch of features:
+
+* 100% Java, no libraries
+* Lightweight
+* Supports 55 FTP commands
+* TLS/SSL support
+* Custom File System support
+* Custom User Authentication support
+* Custom Commands support
+* Support to obsolete commands (some FTP clients might still use them)
## Specification Support
The required minimum implementation is already done, however, there are still commands that can be implemented.
@@ -22,29 +32,34 @@ The required minimum implementation is already done, however, there are still co
* [RFC 4217](https://tools.ietf.org/html/rfc4217) - Securing FTP with TLS
* [RFC 5797](https://tools.ietf.org/html/rfc5797) - FTP Command and Extension Registry
* [RFC 7151](https://tools.ietf.org/html/rfc7151) - File Transfer Protocol HOST Command for Virtual Hosts (0/1)
-* [draft-somers-ftp-mfxx-04](https://tools.ietf.org/html/draft-somers-ftp-mfxx-04) The "MFMT", "MFCT", and "MFF" Command Extensions for FTP (1/3)
+* [draft-twine-ftpmd5-00](https://tools.ietf.org/html/draft-twine-ftpmd5-00) - The "MD5" and "MMD5" FTP Command Extensions (1/2) (Obsolete)
+* [draft-somers-ftp-mfxx-04](https://tools.ietf.org/html/draft-somers-ftp-mfxx-04) - The "MFMT", "MFCT", and "MFF" Command Extensions for FTP (1/3)
+* [draft-bryan-ftpext-hash-02](https://tools.ietf.org/html/draft-bryan-ftpext-hash-02) - File Transfer Protocol HASH Command for Cryptographic Hashes (1/1)
+* [draft-bryan-ftp-range-08](https://tools.ietf.org/html/draft-bryan-ftp-range-08) - File Transfer Protocol RANG Command for Octet Ranges (0/1)
# Usage
### Dependency
+MinimalFTP is published on JCenter and Maven Central
+
#### Maven
```xml
com.guichaguri
minimalftp
- 1.0.3
+ 1.0.4
pom
```
#### Gradle
```groovy
-compile 'com.guichaguri:minimalftp:1.0.3'
+compile 'com.guichaguri:minimalftp:1.0.4'
```
#### Ivy
```xml
-
+
```
diff --git a/build.gradle b/build.gradle
index 81b973d..7bb06e6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,5 +1,5 @@
group 'com.guichaguri'
-version '1.0.3'
+version '1.0.4'
buildscript {
repositories {
@@ -26,20 +26,20 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
}
-def publishSettings = new Properties()
-def propFile = file('publish.properties');
-if(propFile.exists()) {
- publishSettings.load(new FileInputStream(propFile))
-}
-
bintray {
+ def publishSettings = new Properties()
+ def propFile = file('publish.properties')
+ if(propFile.exists()) {
+ publishSettings.load(new FileInputStream(propFile))
+ }
+
user = publishSettings.bintray_user
key = publishSettings.bintray_key
publications = ['MavenBuild']
pkg {
repo = 'maven'
name = 'MinimalFTP'
- licenses = ['GPL-3.0']
+ licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/Guichaguri/MinimalFTP.git'
version {
diff --git a/src/main/java/com/guichaguri/minimalftp/FTPConnection.java b/src/main/java/com/guichaguri/minimalftp/FTPConnection.java
index aa0457d..d56865b 100644
--- a/src/main/java/com/guichaguri/minimalftp/FTPConnection.java
+++ b/src/main/java/com/guichaguri/minimalftp/FTPConnection.java
@@ -463,12 +463,14 @@ protected void site(String cmd) {
* FEAT command
*/
protected void feat() {
- String list = "";
+ StringBuilder list = new StringBuilder();
+ list.append("- Supported Features:\r\n");
+
for(String feat : features) {
- list += feat + "\r\n";
+ list.append(' ').append(feat).append("\r\n");
}
- sendResponse(211, "- Supported Features:\r\n" + list);
+ sendResponse(211, list.toString());
sendResponse(211, "End");
}
@@ -486,7 +488,6 @@ protected void opts(String[] opts) {
if(!options.containsKey(option)) {
sendResponse(501, "No option found");
- return;
} else if(opts.length < 2) {
sendResponse(200, options.get(option));
} else {
diff --git a/src/main/java/com/guichaguri/minimalftp/Utils.java b/src/main/java/com/guichaguri/minimalftp/Utils.java
index 5ed4d39..b3869a3 100644
--- a/src/main/java/com/guichaguri/minimalftp/Utils.java
+++ b/src/main/java/com/guichaguri/minimalftp/Utils.java
@@ -105,6 +105,11 @@ public static String getPermission(IFileSystem fs, F file) {
}
public static String getFacts(IFileSystem fs, F file, String[] options) {
+ // Intended Format
+ // modify=20170808052431;size=7045120;type=file;perm=rfadw; video.mp4
+ // modify=20170526215012;size=380;type=file;perm=rfadw; data.txt
+ // modify=20171012082146;size=0;type=dir;perm=elfpcm; directory
+
String facts = "";
boolean dir = fs.isDirectory(file);
@@ -158,7 +163,7 @@ public static void write(OutputStream out, byte[] bytes, int len, boolean ascii)
}
public static InputStream readFileSystem(IFileSystem fs, F file, long start, boolean ascii) throws IOException {
- if(ascii) {
+ if(ascii && start > 0) {
InputStream in = new BufferedInputStream(fs.readFile(file, 0));
long offset = 0;