From 9cdb30b8e03eeb8e1a1bd18b5af88dd0a969f716 Mon Sep 17 00:00:00 2001 From: KiralyCraft Date: Mon, 11 May 2020 16:51:35 +0300 Subject: [PATCH] Changed content-type, allows custom port now --- .../kiralycraft/faweschematichost/ConnectionHandler.java | 2 +- .../src/com/kiralycraft/faweschematichost/Main.java | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/FAWESchematicHost/src/com/kiralycraft/faweschematichost/ConnectionHandler.java b/FAWESchematicHost/src/com/kiralycraft/faweschematichost/ConnectionHandler.java index 6104f6c..27aede5 100644 --- a/FAWESchematicHost/src/com/kiralycraft/faweschematichost/ConnectionHandler.java +++ b/FAWESchematicHost/src/com/kiralycraft/faweschematichost/ConnectionHandler.java @@ -358,7 +358,7 @@ private void writeUploadOK() throws IOException private void writeHeaders(File toSend) throws IOException { os.write(new String("HTTP/1.1 200 OK\r\n").getBytes()); - os.write(new String("Content-Type: image\r\n").getBytes()); + os.write(new String("Content-Type: application/gzip\r\n").getBytes()); os.write(new String("Connection: close\r\n").getBytes()); os.write(new String("Content-Disposition: inline; filename=\""+toSend.getName()+".schematic\"\r\n").getBytes()); os.write(new String("Content-Length: "+toSend.length()+"\r\n").getBytes()); diff --git a/FAWESchematicHost/src/com/kiralycraft/faweschematichost/Main.java b/FAWESchematicHost/src/com/kiralycraft/faweschematichost/Main.java index 31c0001..bf66b84 100644 --- a/FAWESchematicHost/src/com/kiralycraft/faweschematichost/Main.java +++ b/FAWESchematicHost/src/com/kiralycraft/faweschematichost/Main.java @@ -11,7 +11,14 @@ public static void main(String[] args) { theFolder = args[0]; } - HostingServer hs = new HostingServer(25532,new File(theFolder)); + + int port = 25532; + if (args.length >= 2) + { + port = Integer.parseInt(args[1]); + } + + HostingServer hs = new HostingServer(port,new File(theFolder)); hs.start(); }