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