Program: 30098
Project: 30098
Buggy source:
private void doService(final org.glassfish.grizzly.http.server.Request req,final Request request,final org.glassfish.grizzly.http.server.Response res,final Response response,final boolean v3Enabled) throws Exception {
  if (!connector.isEnabled()) {
    String msg=sm.getString("String_Node_Str",String.valueOf(connector.getPort()));
    if (log.isLoggable(Level.FINE)) {
      log.fine(msg);
    }
    response.sendError(HttpServletResponse.SC_NOT_FOUND,msg);
    return;
  }
  if (connector.isXpoweredBy()) {
    response.addHeader("String_Node_Str",POWERED_BY);
  }
  if (postParseRequest(req,request,res,response,v3Enabled)) {
    boolean authPassthroughEnabled=connector.getAuthPassthroughEnabled();
    ProxyHandler proxyHandler=connector.getProxyHandler();
    if (authPassthroughEnabled && proxyHandler != null) {
      if (proxyHandler.getSSLKeysize((HttpServletRequest)request.getRequest()) > 0) {
        request.setSecure(true);
      }
      X509Certificate[] certs=null;
      try {
        certs=proxyHandler.getSSLClientCertificateChain(request.getRequest());
      }
 catch (      CertificateException ce) {
        log.log(Level.SEVERE,sm.getString("String_Node_Str"),ce);
      }
      if (certs != null) {
        request.setAttribute(Globals.CERTIFICATES_ATTR,certs);
      }
    }
    if (serverName != null && !serverName.isEmpty()) {
      response.addHeader("String_Node_Str",serverName);
    }
    connector.requestStartEvent(request.getRequest(),request.getHost(),request.getContext());
    Container container=connector.getContainer();
    try {
      if (container.getPipeline().hasNonBasicValves() || container.hasCustomPipeline()) {
        container.getPipeline().invoke(request,response);
      }
 else {
        Host host=request.getHost();
        if (host == null) {
          response.sendError(HttpServletResponse.SC_BAD_REQUEST);
          response.setDetailMessage(sm.getString("String_Node_Str",request.getRequest().getServerName()));
          return;
        }
        if (host.getPipeline().hasNonBasicValves() || host.hasCustomPipeline()) {
          host.getPipeline().invoke(request,response);
        }
 else {
          GlassFishValve hostValve=host.getPipeline().getBasic();
          hostValve.invoke(request,response);
          hostValve.postInvoke(request,response);
        }
      }
    }
  finally {
      connector.requestEndEvent(request.getRequest(),request.getHost(),request.getContext(),response.getStatus());
    }
  }
}

Fixed version (ground truth):
private void doService(final org.glassfish.grizzly.http.server.Request req,final Request request,final org.glassfish.grizzly.http.server.Response res,final Response response,final boolean v3Enabled) throws Exception {
  if (!connector.isEnabled()) {
    String msg=sm.getString("String_Node_Str",String.valueOf(connector.getPort()));
    if (log.isLoggable(Level.FINE)) {
      log.fine(msg);
    }
    response.sendError(HttpServletResponse.SC_NOT_FOUND,msg);
    return;
  }
  if (connector.isXpoweredBy()) {
    response.addHeader("String_Node_Str",POWERED_BY);
  }
  if (postParseRequest(req,request,res,response,v3Enabled)) {
    boolean authPassthroughEnabled=connector.getAuthPassthroughEnabled();
    ProxyHandler proxyHandler=connector.getProxyHandler();
    if (authPassthroughEnabled && proxyHandler != null) {
      if (proxyHandler.getSSLKeysize((HttpServletRequest)request.getRequest()) > 0) {
        request.setSecure(true);
      }
      X509Certificate[] certs=null;
      try {
        certs=proxyHandler.getSSLClientCertificateChain(request.getRequest());
      }
 catch (      CertificateException ce) {
        log.log(Level.SEVERE,sm.getString("String_Node_Str"),ce);
      }
      if (certs != null) {
        request.setAttribute(Globals.CERTIFICATES_ATTR,certs);
      }
    }
    if (serverName != null && !serverName.isEmpty()) {
      response.addHeader("String_Node_Str",serverName);
    }
    connector.requestStartEvent(request.getRequest(),request.getHost(),request.getContext());
    Container container=connector.getContainer();
    try {
      request.lockSession();
      if (container.getPipeline().hasNonBasicValves() || container.hasCustomPipeline()) {
        container.getPipeline().invoke(request,response);
      }
 else {
        Host host=request.getHost();
        if (host == null) {
          response.sendError(HttpServletResponse.SC_BAD_REQUEST);
          response.setDetailMessage(sm.getString("String_Node_Str",request.getRequest().getServerName()));
          return;
        }
        if (host.getPipeline().hasNonBasicValves() || host.hasCustomPipeline()) {
          host.getPipeline().invoke(request,response);
        }
 else {
          GlassFishValve hostValve=host.getPipeline().getBasic();
          hostValve.invoke(request,response);
          hostValve.postInvoke(request,response);
        }
      }
    }
  finally {
      try {
        connector.requestEndEvent(request.getRequest(),request.getHost(),request.getContext(),response.getStatus());
      }
  finally {
        request.unlockSession();
      }
    }
  }
}