mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 09:46:16 +01:00
added content-length and content-type header
This commit is contained in:
@@ -110,6 +110,12 @@ public interface CGIExecutor
|
|||||||
/** Field description */
|
/** Field description */
|
||||||
public static final String ENV_SERVER_SOFTWARE = "SERVER_SOFTWARE";
|
public static final String ENV_SERVER_SOFTWARE = "SERVER_SOFTWARE";
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
public static final String REPSONSE_HEADER_CONTENT_LENGTH = "Content-Length";
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
public static final String REPSONSE_HEADER_CONTENT_TYPE = "Content-Type";
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
public static final String RESPONSE_HEADER_HTTP_PREFIX = "HTTP";
|
public static final String RESPONSE_HEADER_HTTP_PREFIX = "HTTP";
|
||||||
|
|
||||||
|
|||||||
@@ -291,11 +291,30 @@ public class DefaultCGIExecutor extends AbstractCGIExecutor
|
|||||||
String key = line.substring(0, k).trim();
|
String key = line.substring(0, k).trim();
|
||||||
String value = line.substring(k + 1).trim();
|
String value = line.substring(k + 1).trim();
|
||||||
|
|
||||||
if (RESPONSE_HEADER_LOCATION.equals(key))
|
if (RESPONSE_HEADER_LOCATION.equalsIgnoreCase(key))
|
||||||
{
|
{
|
||||||
response.sendRedirect(response.encodeRedirectURL(value));
|
response.sendRedirect(response.encodeRedirectURL(value));
|
||||||
}
|
}
|
||||||
else if (RESPONSE_HEADER_STATUS.equals(key))
|
else if (REPSONSE_HEADER_CONTENT_TYPE.equalsIgnoreCase(key))
|
||||||
|
{
|
||||||
|
response.setContentType(value);
|
||||||
|
}
|
||||||
|
else if (REPSONSE_HEADER_CONTENT_LENGTH.equalsIgnoreCase(key))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
response.setContentLength(Integer.parseInt(value));
|
||||||
|
}
|
||||||
|
catch (NumberFormatException ex)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug(
|
||||||
|
"could not convert content-length header to integer", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (RESPONSE_HEADER_STATUS.equalsIgnoreCase(key))
|
||||||
{
|
{
|
||||||
String[] token = value.split(" ");
|
String[] token = value.split(" ");
|
||||||
int status = Integer.parseInt(token[0]);
|
int status = Integer.parseInt(token[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user