remove obsolete X_YACY... header declarations

not in use (no writes, only remove and try to read).
Obsolete parameter setupHttpClient
pull/93/head
reger 8 years ago
parent f72c99474e
commit 9db68acb4f

@ -108,11 +108,6 @@ public class HeaderFramework extends TreeMap<String, String> implements Map<Stri
public static final String X_ROBOTS = "X-Robots";
public static final String X_YACY_INDEX_CONTROL = "X-YaCy-Index-Control";
//public static final String X_YACY_PREVIOUS_REQUEST_LINE = "X-Previous-Request-Line";
public static final String X_YACY_KEEP_ALIVE_REQUEST_COUNT = "X-Keep-Alive-Request-Count";
public static final String X_YACY_ORIGINAL_REQUEST_LINE = "X-Original-Request-Line";
public static final String X_YACY_MEDIA_TITLE = "X-YaCy-Media-Title"; // can be attached to media files which do not have metadata; this will be used as title
public static final String X_YACY_MEDIA_KEYWORDS = "X-YaCy-Media-Keywords"; // can be attached to media files which do not have metadata; this will be used as keywords (space-separared list of words)
/** Added when generating legacy request header to allow template servlets to know the original request scheme : "http" or "https" */
public static final String X_YACY_REQUEST_SCHEME = "X-YaCy-Request-Scheme"; // TODO: after completing implementation of HttpServletRequest getScheme() should be used and this can be removed

@ -64,15 +64,15 @@ public class Jetty9YaCySecurityHandler extends ConstraintSecurityHandler {
String refererHost;
// update AccessTracker
final String remodeip = request.getRemoteAddr();
serverAccessTracker.track(remodeip, pathInContext);
final String remoteip = request.getRemoteAddr();
serverAccessTracker.track(remoteip, pathInContext);
try {
refererHost = new MultiProtocolURL(request.getHeader(RequestHeader.REFERER)).getHost();
} catch (MalformedURLException e) {
refererHost = null;
}
final boolean accessFromLocalhost = Domains.isLocalhost(remodeip) && (refererHost == null || refererHost.length() == 0 || Domains.isLocalhost(refererHost));
final boolean accessFromLocalhost = Domains.isLocalhost(remoteip) && (refererHost == null || refererHost.length() == 0 || Domains.isLocalhost(refererHost));
// ! note : accessFromLocalhost compares localhost ip pattern
final boolean grantedForLocalhost = adminAccountGrantedForLocalhost && accessFromLocalhost;
boolean protectedPage = adminAccountNeededForAllPages || (pathInContext.indexOf("_p.") > 0);

@ -426,15 +426,9 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
}
add(doc, CollectionSchema.collection_sxt, cs);
}
char doctype = Response.docType(responseHeader== null ? null : responseHeader.getContentType()); // null returns DT_UNKNOWN
List<String> titles = document.titles();
if (allAttr || contains(CollectionSchema.title)) {
if (doctype == Response.DT_IMAGE || doctype == Response.DT_AUDIO || doctype == Response.DT_MOVIE) {
String mediatitle = responseHeader.get(HeaderFramework.X_YACY_MEDIA_TITLE, "");
if (mediatitle.length() > 0) {
if (titles.size() == 0) titles.add(mediatitle); else titles.set(0, mediatitle);
}
}
add(doc, CollectionSchema.title, titles);
if ((allAttr || contains(CollectionSchema.title_exact_signature_l)) && titles.size() > 0) {
add(doc, CollectionSchema.title_exact_signature_l, EnhancedTextProfileSignature.getSignatureLong(titles.get(0)));
@ -496,9 +490,6 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
}
if (allAttr || contains(CollectionSchema.keywords)) {
String keywords = document.dc_subject(' ');
if (doctype == Response.DT_IMAGE || doctype == Response.DT_AUDIO || doctype == Response.DT_MOVIE) {
keywords = responseHeader.get(HeaderFramework.X_YACY_MEDIA_KEYWORDS, keywords);
}
add(doc, CollectionSchema.keywords, keywords);
}

@ -454,7 +454,7 @@ public final class HTTPDProxyHandler {
requestHeader.remove(HeaderFramework.HOST);
final HTTPClient client = setupHttpClient(requestHeader, agent, connectHost);
final HTTPClient client = setupHttpClient(requestHeader, agent);
// send request
try {
@ -773,10 +773,9 @@ public final class HTTPDProxyHandler {
* creates a new HttpClient and sets parameters according to proxy needs
*
* @param requestHeader
* @param connectHost may be 'host:port' or 'host:port/path'
* @return
*/
private static HTTPClient setupHttpClient(final RequestHeader requestHeader, final ClientIdentification.Agent agent, final String connectHost) {
private static HTTPClient setupHttpClient(final RequestHeader requestHeader, final ClientIdentification.Agent agent) {
// setup HTTP-client
final HTTPClient client = new HTTPClient(agent, timeout);
client.setHeader(requestHeader.entrySet());
@ -891,10 +890,6 @@ public final class HTTPDProxyHandler {
// remove transfer encoding header
headers.remove(HeaderFramework.TRANSFER_ENCODING);
//removing yacy status headers
headers.remove(HeaderFramework.X_YACY_KEEP_ALIVE_REQUEST_COUNT);
headers.remove(HeaderFramework.X_YACY_ORIGINAL_REQUEST_LINE);
}
private static void setViaHeader(final HeaderFramework header, final String httpVer) {

Loading…
Cancel
Save