Fix empty response error
This commit is contained in:
16
pom.xml
16
pom.xml
@@ -6,12 +6,26 @@
|
|||||||
|
|
||||||
<groupId>ovh.alexisdelhaie</groupId>
|
<groupId>ovh.alexisdelhaie</groupId>
|
||||||
<artifactId>EndPoint</artifactId>
|
<artifactId>EndPoint</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.1.5.3</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.release>15</maven.compiler.release>
|
<maven.compiler.release>15</maven.compiler.release>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<configuration>
|
||||||
|
<release>15</release>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
|
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class AboutDialog extends JDialog {
|
|||||||
public static final int WIDTH = 740;
|
public static final int WIDTH = 740;
|
||||||
public static final int HEIGHT = 500;
|
public static final int HEIGHT = 500;
|
||||||
|
|
||||||
public static final String VERSION = "0.1.5.2";
|
public static final String VERSION = "0.1.5.3";
|
||||||
|
|
||||||
private JPanel contentPane;
|
private JPanel contentPane;
|
||||||
private JLabel version;
|
private JLabel version;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package ovh.alexisdelhaie.endpoint.http;
|
package ovh.alexisdelhaie.endpoint.http;
|
||||||
|
|
||||||
import ovh.alexisdelhaie.endpoint.configuration.ConfigurationProperties;
|
import ovh.alexisdelhaie.endpoint.configuration.ConfigurationProperties;
|
||||||
|
import ovh.alexisdelhaie.endpoint.utils.MessageDialog;
|
||||||
|
|
||||||
import javax.net.ssl.*;
|
import javax.net.ssl.*;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
@@ -88,6 +89,8 @@ public class HttpClient {
|
|||||||
long time = end.toEpochMilli() - start.toEpochMilli();
|
long time = end.toEpochMilli() - start.toEpochMilli();
|
||||||
r.setRawRequest(request);
|
r.setRawRequest(request);
|
||||||
return Optional.of(new Response(b, time, downgraded, r));
|
return Optional.of(new Response(b, time, downgraded, r));
|
||||||
|
} catch (Exception e) {
|
||||||
|
MessageDialog.error("HTTP Error", e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,14 +29,18 @@ public class Response {
|
|||||||
headers = new HashMap<>();
|
headers = new HashMap<>();
|
||||||
rawResponse = new String(res, StandardCharsets.UTF_8);
|
rawResponse = new String(res, StandardCharsets.UTF_8);
|
||||||
int crlf = rawResponse.indexOf(DOUBLE_CRLF);
|
int crlf = rawResponse.indexOf(DOUBLE_CRLF);
|
||||||
rawHeaders = rawResponse.substring(0, crlf);
|
if (crlf > 0) {
|
||||||
parseHeaders();
|
rawHeaders = rawResponse.substring(0, crlf);
|
||||||
rawResponse = new String(res, getEncoding());
|
parseHeaders();
|
||||||
body = rawResponse.substring(crlf + DOUBLE_CRLF.length());
|
rawResponse = new String(res, getEncoding());
|
||||||
|
body = rawResponse.substring(crlf + DOUBLE_CRLF.length());
|
||||||
|
parseBody();
|
||||||
|
} else {
|
||||||
|
rawHeaders = rawResponse;
|
||||||
|
}
|
||||||
this.time = time;
|
this.time = time;
|
||||||
request = r;
|
request = r;
|
||||||
this.downgraded = downgraded;
|
this.downgraded = downgraded;
|
||||||
parseBody();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseHeaders() {
|
private void parseHeaders() {
|
||||||
|
|||||||
Reference in New Issue
Block a user