Skip to content

Commit

Permalink
Use HTTP GET to download the db file and patch up multipart POST syntax
Browse files Browse the repository at this point in the history
The proposed changes fix adrian#19 issue, enabling the use
of HTTP GET method instead of static HTTP POST to download the database
file.

The use of LF (instead of CRLF) confuses CGI.pm if CGI.pm is used to
process HTTP uploads. The proposed changes enable processing of HTTP
uploads by a custom CGI script in addition to, or as a replacement of,
the current PHP scripts.
  • Loading branch information
Donald Rumata committed Jun 12, 2016
1 parent 67015ab commit 14fca7f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/com/u17od/upm/transport/HTTPTransport.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ public void put(String targetLocation, File file, String username, String passwo
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write("--".getBytes());
baos.write(BOUNDRY.getBytes());
baos.write("\n".getBytes());
baos.write("\r\n".getBytes());
baos.write(contentDisposition.getBytes());
baos.write("\n".getBytes());
baos.write("\r\n".getBytes());
baos.write(contentType.getBytes());
baos.write("\n".getBytes());
baos.write("\n".getBytes());
baos.write("\r\n".getBytes());
baos.write("\r\n".getBytes());
baos.write(Util.getBytesFromFile(file));
baos.write("\n".getBytes());
baos.write("\r\n".getBytes());
baos.write("--".getBytes());
baos.write(BOUNDRY.getBytes());
baos.write("--".getBytes());
Expand Down Expand Up @@ -166,7 +166,6 @@ public byte[] get(String urlToGet, String username, String password) throws Tran
conn.setRequestProperty ("Authorization", createAuthenticationString(username, password));
}

conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setRequestMethod("GET");
Expand Down

0 comments on commit 14fca7f

Please sign in to comment.