mirror of https://github.com/apache/archiva.git
ensure we send a User-Agent header when requesting a remote repository
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1519362 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
02fc935ac9
commit
5d29b0e6ba
|
@ -20,8 +20,13 @@ package org.apache.archiva.webdav;
|
|||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* UnauthenticatedRepositoryServlet
|
||||
|
@ -46,4 +51,18 @@ public class UnauthenticatedRepositoryServlet
|
|||
UnauthenticatedDavSessionProvider sessionProvider = new UnauthenticatedDavSessionProvider();
|
||||
setDavSessionProvider( sessionProvider );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void service( HttpServletRequest request, HttpServletResponse response )
|
||||
throws ServletException, IOException
|
||||
{
|
||||
String userAgent = request.getHeader( "User-Agent" );
|
||||
|
||||
if ( StringUtils.isEmpty( userAgent ))
|
||||
{
|
||||
throw new ServletException( "User-Agent is not configured" );
|
||||
}
|
||||
|
||||
super.service( request, response );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue