Commit 9fb42f36 authored by Grzegorz Pietrusza's avatar Grzegorz Pietrusza

fix proxying url

parent c900bd03
......@@ -187,7 +187,7 @@ webTasks:
- name: "Debugging task to remove"
description: "To nie jest zadanie"
url: "http://localhost:8082"
url: "http://localhost:8082/"
level: 9
flags:
- value: "flaga 1"
......
......@@ -52,7 +52,7 @@ public class TaskRequestContextBuilder
String query = ((ContainerRequest) containerRequestContext).getRequestUri().getQuery();
if (query != null) {
fullPath += query;
fullPath += "?" + query;
}
taskRequestContext.withPath(fullPath);
......
......@@ -4,13 +4,10 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.telephoners.krakyournet.ctf.beans.Flag;
import com.telephoners.krakyournet.ctf.helpers.StreamUtils;
import org.apache.http.Header;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.BasicHttpEntity;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.HttpEntityWrapper;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicHeader;
......@@ -61,13 +58,13 @@ public class WebTask extends Task
@Override
public TaskResponse getTaskResponse(TaskRequestContext taskRequestContext) throws IOException
{
String url = getUrl() + taskRequestContext.getPath();
CloseableHttpResponse response = proxyRequest(url, taskRequestContext);
String proxiedUrl = getTaskUrl() + taskRequestContext.getPath();
CloseableHttpResponse response = proxyRequest(proxiedUrl, taskRequestContext);
String text = StreamUtils.readStream(response.getEntity().getContent());
return new TaskResponse(text, buildHeadersMap(response.getAllHeaders()));
}
public String getUrl()
public String getTaskUrl()
{
return url;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment