Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,19 @@ public Map<String, String> getHeaders() {
//Header for file upload
params.put("Content-Disposition", "attachment; filename=" + filename);

try {
URL url = new URL(this.getUrl());
final String authority = url.getUserInfo();

if (authority != null) {
String auth = "Basic " + Base64.getEncoder().encodeToString(authority.getBytes());
params.put("Authorization", auth);
}
} catch(Exception e) {
// FIXME: Do something saner with this
System.out.println("url parsing failure");
}

if (mGzipEnabled) {
params.put(HEADER_ENCODING, ENCODING_GZIP);
}
Expand Down Expand Up @@ -228,4 +241,4 @@ protected void deliverResponse(T response) {
public String getBodyContentType() {
return "multipart/form-data;boundary=" + boundary;
}
}
}