public ProtocolVersion getProtocolVersion() {
   if (this.requestline != null) {
     return this.requestline.getProtocolVersion();
   } else {
     return HttpProtocolParams.getVersion(getParams());
   }
 }
Пример #2
0
  /**
   * Creates the CONNECT request for tunnelling. Called by {@link #createTunnelToTarget
   * createTunnelToTarget}.
   *
   * @param route the route to establish
   * @param context the context for request execution
   * @return the CONNECT request for tunnelling
   */
  protected HttpRequest createConnectRequest(HttpRoute route, HttpContext context) {
    // see RFC 2817, section 5.2 and
    // INTERNET-DRAFT: Tunneling TCP based protocols through
    // Web proxy servers

    HttpHost target = route.getTargetHost();

    String host = target.getHostName();
    int port = target.getPort();
    if (port < 0) {
      Scheme scheme = connManager.getSchemeRegistry().getScheme(target.getSchemeName());
      port = scheme.getDefaultPort();
    }

    StringBuilder buffer = new StringBuilder(host.length() + 6);
    buffer.append(host);
    buffer.append(':');
    buffer.append(Integer.toString(port));

    String authority = buffer.toString();
    ProtocolVersion ver = HttpProtocolParams.getVersion(params);
    HttpRequest req = new BasicHttpRequest("CONNECT", authority, ver);

    return req;
  }
 public RequestLine getRequestLine() {
   if (this.requestline != null) {
     return this.requestline;
   } else {
     ProtocolVersion ver = HttpProtocolParams.getVersion(getParams());
     return new BasicRequestLine(this.method, this.uri, ver);
   }
 }
 public ProtocolVersion getProtocolVersion() {
   return HttpProtocolParams.getVersion(this.getParams());
 }