类com.squareup.okhttp.internal.http.RawHeaders源码实例Demo

下面列出了怎么用com.squareup.okhttp.internal.http.RawHeaders的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: L.TileLayer.Cordova   文件: TunnelRequest.java
/**
 * If we're creating a TLS tunnel, send only the minimum set of headers.
 * This avoids sending potentially sensitive data like HTTP cookies to
 * the proxy unencrypted.
 */
RawHeaders getRequestHeaders() {
  RawHeaders result = new RawHeaders();
  result.setRequestLine("CONNECT " + host + ":" + port + " HTTP/1.1");

  // Always set Host and User-Agent.
  result.set("Host", port == getDefaultPort("https") ? host : (host + ":" + port));
  result.set("User-Agent", userAgent);

  // Copy over the Proxy-Authorization header if it exists.
  if (proxyAuthorization != null) {
    result.set("Proxy-Authorization", proxyAuthorization);
  }

  // Always set the Proxy-Connection to Keep-Alive for the benefit of
  // HTTP/1.0 proxies like Squid.
  result.set("Proxy-Connection", "Keep-Alive");
  return result;
}
 
private void update(CacheResponse conditionalCacheHit, HttpURLConnection httpConnection)
    throws IOException {
  HttpEngine httpEngine = getHttpEngine(httpConnection);
  URI uri = httpEngine.getUri();
  ResponseHeaders response = httpEngine.getResponseHeaders();
  RawHeaders varyHeaders =
      httpEngine.getRequestHeaders().getHeaders().getAll(response.getVaryFields());
  Entry entry = new Entry(uri, varyHeaders, httpConnection);
  DiskLruCache.Snapshot snapshot = (conditionalCacheHit instanceof EntryCacheResponse)
      ? ((EntryCacheResponse) conditionalCacheHit).snapshot
      : ((EntrySecureCacheResponse) conditionalCacheHit).snapshot;
  DiskLruCache.Editor editor = null;
  try {
    editor = snapshot.edit(); // returns null if snapshot is not current
    if (editor != null) {
      entry.writeTo(editor);
      editor.commit();
    }
  } catch (IOException e) {
    abortQuietly(editor);
  }
}
 
源代码3 项目: CordovaYoutubeVideoPlayer   文件: TunnelRequest.java
/**
 * If we're creating a TLS tunnel, send only the minimum set of headers.
 * This avoids sending potentially sensitive data like HTTP cookies to
 * the proxy unencrypted.
 */
RawHeaders getRequestHeaders() {
  RawHeaders result = new RawHeaders();
  result.setRequestLine("CONNECT " + host + ":" + port + " HTTP/1.1");

  // Always set Host and User-Agent.
  result.set("Host", port == getDefaultPort("https") ? host : (host + ":" + port));
  result.set("User-Agent", userAgent);

  // Copy over the Proxy-Authorization header if it exists.
  if (proxyAuthorization != null) {
    result.set("Proxy-Authorization", proxyAuthorization);
  }

  // Always set the Proxy-Connection to Keep-Alive for the benefit of
  // HTTP/1.0 proxies like Squid.
  result.set("Proxy-Connection", "Keep-Alive");
  return result;
}
 
源代码4 项目: IoTgo_Android_App   文件: TunnelRequest.java
/**
 * If we're creating a TLS tunnel, send only the minimum set of headers.
 * This avoids sending potentially sensitive data like HTTP cookies to
 * the proxy unencrypted.
 */
RawHeaders getRequestHeaders() {
  RawHeaders result = new RawHeaders();
  result.setRequestLine("CONNECT " + host + ":" + port + " HTTP/1.1");

  // Always set Host and User-Agent.
  result.set("Host", port == getDefaultPort("https") ? host : (host + ":" + port));
  result.set("User-Agent", userAgent);

  // Copy over the Proxy-Authorization header if it exists.
  if (proxyAuthorization != null) {
    result.set("Proxy-Authorization", proxyAuthorization);
  }

  // Always set the Proxy-Connection to Keep-Alive for the benefit of
  // HTTP/1.0 proxies like Squid.
  result.set("Proxy-Connection", "Keep-Alive");
  return result;
}
 
源代码5 项目: IoTgo_Android_App   文件: HttpResponseCache.java
private void update(CacheResponse conditionalCacheHit, HttpURLConnection httpConnection)
    throws IOException {
  HttpEngine httpEngine = getHttpEngine(httpConnection);
  URI uri = httpEngine.getUri();
  ResponseHeaders response = httpEngine.getResponseHeaders();
  RawHeaders varyHeaders =
      httpEngine.getRequestHeaders().getHeaders().getAll(response.getVaryFields());
  Entry entry = new Entry(uri, varyHeaders, httpConnection);
  DiskLruCache.Snapshot snapshot = (conditionalCacheHit instanceof EntryCacheResponse)
      ? ((EntryCacheResponse) conditionalCacheHit).snapshot
      : ((EntrySecureCacheResponse) conditionalCacheHit).snapshot;
  DiskLruCache.Editor editor = null;
  try {
    editor = snapshot.edit(); // returns null if snapshot is not current
    if (editor != null) {
      entry.writeTo(editor);
      editor.commit();
    }
  } catch (IOException e) {
    abortQuietly(editor);
  }
}
 
源代码6 项目: IoTgo_Android_App   文件: HttpResponseCache.java
public Entry(URI uri, RawHeaders varyHeaders, HttpURLConnection httpConnection)
    throws IOException {
  this.uri = uri.toString();
  this.varyHeaders = varyHeaders;
  this.requestMethod = httpConnection.getRequestMethod();
  this.responseHeaders = RawHeaders.fromMultimap(httpConnection.getHeaderFields(), true);

  SSLSocket sslSocket = getSslSocket(httpConnection);
  if (sslSocket != null) {
    cipherSuite = sslSocket.getSession().getCipherSuite();
    Certificate[] peerCertificatesNonFinal = null;
    try {
      peerCertificatesNonFinal = sslSocket.getSession().getPeerCertificates();
    } catch (SSLPeerUnverifiedException ignored) {
    }
    peerCertificates = peerCertificatesNonFinal;
    localCertificates = sslSocket.getSession().getLocalCertificates();
  } else {
    cipherSuite = null;
    peerCertificates = null;
    localCertificates = null;
  }
}
 
源代码7 项目: android-discourse   文件: TunnelRequest.java
/**
 * If we're creating a TLS tunnel, send only the minimum set of headers.
 * This avoids sending potentially sensitive data like HTTP cookies to
 * the proxy unencrypted.
 */
RawHeaders getRequestHeaders() {
    RawHeaders result = new RawHeaders();
    result.setRequestLine("CONNECT " + host + ":" + port + " HTTP/1.1");

    // Always set Host and User-Agent.
    result.set("Host", port == getDefaultPort("https") ? host : (host + ":" + port));
    result.set("User-Agent", userAgent);

    // Copy over the Proxy-Authorization header if it exists.
    if (proxyAuthorization != null) {
        result.set("Proxy-Authorization", proxyAuthorization);
    }

    // Always set the Proxy-Connection to Keep-Alive for the benefit of
    // HTTP/1.0 proxies like Squid.
    result.set("Proxy-Connection", "Keep-Alive");
    return result;
}
 
public Entry(URI uri, RawHeaders varyHeaders, HttpURLConnection httpConnection)
    throws IOException {
  this.uri = uri.toString();
  this.varyHeaders = varyHeaders;
  this.requestMethod = httpConnection.getRequestMethod();
  this.responseHeaders = RawHeaders.fromMultimap(httpConnection.getHeaderFields(), true);

  SSLSocket sslSocket = getSslSocket(httpConnection);
  if (sslSocket != null) {
    cipherSuite = sslSocket.getSession().getCipherSuite();
    Certificate[] peerCertificatesNonFinal = null;
    try {
      peerCertificatesNonFinal = sslSocket.getSession().getPeerCertificates();
    } catch (SSLPeerUnverifiedException ignored) {
    }
    peerCertificates = peerCertificatesNonFinal;
    localCertificates = sslSocket.getSession().getLocalCertificates();
  } else {
    cipherSuite = null;
    peerCertificates = null;
    localCertificates = null;
  }
}
 
源代码9 项目: android-discourse   文件: HttpResponseCache.java
private void update(CacheResponse conditionalCacheHit, HttpURLConnection httpConnection) throws IOException {
    HttpEngine httpEngine = getHttpEngine(httpConnection);
    URI uri = httpEngine.getUri();
    ResponseHeaders response = httpEngine.getResponseHeaders();
    RawHeaders varyHeaders = httpEngine.getRequestHeaders().getHeaders().getAll(response.getVaryFields());
    Entry entry = new Entry(uri, varyHeaders, httpConnection);
    DiskLruCache.Snapshot snapshot = (conditionalCacheHit instanceof EntryCacheResponse) ? ((EntryCacheResponse) conditionalCacheHit).snapshot : ((EntrySecureCacheResponse) conditionalCacheHit).snapshot;
    DiskLruCache.Editor editor = null;
    try {
        editor = snapshot.edit(); // returns null if snapshot is not current
        if (editor != null) {
            entry.writeTo(editor);
            editor.commit();
        }
    } catch (IOException e) {
        abortQuietly(editor);
    }
}
 
源代码10 项目: android-discourse   文件: HttpResponseCache.java
public Entry(URI uri, RawHeaders varyHeaders, HttpURLConnection httpConnection) throws IOException {
    this.uri = uri.toString();
    this.varyHeaders = varyHeaders;
    this.requestMethod = httpConnection.getRequestMethod();
    this.responseHeaders = RawHeaders.fromMultimap(httpConnection.getHeaderFields(), true);

    SSLSocket sslSocket = getSslSocket(httpConnection);
    if (sslSocket != null) {
        cipherSuite = sslSocket.getSession().getCipherSuite();
        Certificate[] peerCertificatesNonFinal = null;
        try {
            peerCertificatesNonFinal = sslSocket.getSession().getPeerCertificates();
        } catch (SSLPeerUnverifiedException ignored) {
        }
        peerCertificates = peerCertificatesNonFinal;
        localCertificates = sslSocket.getSession().getLocalCertificates();
    } else {
        cipherSuite = null;
        peerCertificates = null;
        localCertificates = null;
    }
}
 
private void update(CacheResponse conditionalCacheHit, HttpURLConnection httpConnection)
    throws IOException {
  HttpEngine httpEngine = getHttpEngine(httpConnection);
  URI uri = httpEngine.getUri();
  ResponseHeaders response = httpEngine.getResponseHeaders();
  RawHeaders varyHeaders =
      httpEngine.getRequestHeaders().getHeaders().getAll(response.getVaryFields());
  Entry entry = new Entry(uri, varyHeaders, httpConnection);
  DiskLruCache.Snapshot snapshot = (conditionalCacheHit instanceof EntryCacheResponse)
      ? ((EntryCacheResponse) conditionalCacheHit).snapshot
      : ((EntrySecureCacheResponse) conditionalCacheHit).snapshot;
  DiskLruCache.Editor editor = null;
  try {
    editor = snapshot.edit(); // returns null if snapshot is not current
    if (editor != null) {
      entry.writeTo(editor);
      editor.commit();
    }
  } catch (IOException e) {
    abortQuietly(editor);
  }
}
 
源代码12 项目: wildfly-samples   文件: TunnelRequest.java
/**
 * If we're creating a TLS tunnel, send only the minimum set of headers.
 * This avoids sending potentially sensitive data like HTTP cookies to
 * the proxy unencrypted.
 */
RawHeaders getRequestHeaders() {
  RawHeaders result = new RawHeaders();
  result.setRequestLine("CONNECT " + host + ":" + port + " HTTP/1.1");

  // Always set Host and User-Agent.
  result.set("Host", port == getDefaultPort("https") ? host : (host + ":" + port));
  result.set("User-Agent", userAgent);

  // Copy over the Proxy-Authorization header if it exists.
  if (proxyAuthorization != null) {
    result.set("Proxy-Authorization", proxyAuthorization);
  }

  // Always set the Proxy-Connection to Keep-Alive for the benefit of
  // HTTP/1.0 proxies like Squid.
  result.set("Proxy-Connection", "Keep-Alive");
  return result;
}
 
源代码13 项目: bluemix-parking-meter   文件: HttpResponseCache.java
private void update(CacheResponse conditionalCacheHit, HttpURLConnection httpConnection)
    throws IOException {
  HttpEngine httpEngine = getHttpEngine(httpConnection);
  URI uri = httpEngine.getUri();
  ResponseHeaders response = httpEngine.getResponseHeaders();
  RawHeaders varyHeaders =
      httpEngine.getRequestHeaders().getHeaders().getAll(response.getVaryFields());
  Entry entry = new Entry(uri, varyHeaders, httpConnection);
  DiskLruCache.Snapshot snapshot = (conditionalCacheHit instanceof EntryCacheResponse)
      ? ((EntryCacheResponse) conditionalCacheHit).snapshot
      : ((EntrySecureCacheResponse) conditionalCacheHit).snapshot;
  DiskLruCache.Editor editor = null;
  try {
    editor = snapshot.edit(); // returns null if snapshot is not current
    if (editor != null) {
      entry.writeTo(editor);
      editor.commit();
    }
  } catch (IOException e) {
    abortQuietly(editor);
  }
}
 
源代码14 项目: bluemix-parking-meter   文件: HttpResponseCache.java
public Entry(URI uri, RawHeaders varyHeaders, HttpURLConnection httpConnection)
    throws IOException {
  this.uri = uri.toString();
  this.varyHeaders = varyHeaders;
  this.requestMethod = httpConnection.getRequestMethod();
  this.responseHeaders = RawHeaders.fromMultimap(httpConnection.getHeaderFields(), true);

  SSLSocket sslSocket = getSslSocket(httpConnection);
  if (sslSocket != null) {
    cipherSuite = sslSocket.getSession().getCipherSuite();
    Certificate[] peerCertificatesNonFinal = null;
    try {
      peerCertificatesNonFinal = sslSocket.getSession().getPeerCertificates();
    } catch (SSLPeerUnverifiedException ignored) {
    }
    peerCertificates = peerCertificatesNonFinal;
    localCertificates = sslSocket.getSession().getLocalCertificates();
  } else {
    cipherSuite = null;
    peerCertificates = null;
    localCertificates = null;
  }
}
 
源代码15 项目: reader   文件: TunnelRequest.java
/**
 * If we're creating a TLS tunnel, send only the minimum set of headers.
 * This avoids sending potentially sensitive data like HTTP cookies to
 * the proxy unencrypted.
 */
RawHeaders getRequestHeaders() {
  RawHeaders result = new RawHeaders();
  result.setRequestLine("CONNECT " + host + ":" + port + " HTTP/1.1");

  // Always set Host and User-Agent.
  result.set("Host", port == getDefaultPort("https") ? host : (host + ":" + port));
  result.set("User-Agent", userAgent);

  // Copy over the Proxy-Authorization header if it exists.
  if (proxyAuthorization != null) {
    result.set("Proxy-Authorization", proxyAuthorization);
  }

  // Always set the Proxy-Connection to Keep-Alive for the benefit of
  // HTTP/1.0 proxies like Squid.
  result.set("Proxy-Connection", "Keep-Alive");
  return result;
}
 
源代码16 项目: reader   文件: HttpResponseCache.java
private void update(CacheResponse conditionalCacheHit, HttpURLConnection httpConnection)
    throws IOException {
  HttpEngine httpEngine = getHttpEngine(httpConnection);
  URI uri = httpEngine.getUri();
  ResponseHeaders response = httpEngine.getResponseHeaders();
  RawHeaders varyHeaders =
      httpEngine.getRequestHeaders().getHeaders().getAll(response.getVaryFields());
  Entry entry = new Entry(uri, varyHeaders, httpConnection);
  DiskLruCache.Snapshot snapshot = (conditionalCacheHit instanceof EntryCacheResponse)
      ? ((EntryCacheResponse) conditionalCacheHit).snapshot
      : ((EntrySecureCacheResponse) conditionalCacheHit).snapshot;
  DiskLruCache.Editor editor = null;
  try {
    editor = snapshot.edit(); // returns null if snapshot is not current
    if (editor != null) {
      entry.writeTo(editor);
      editor.commit();
    }
  } catch (IOException e) {
    abortQuietly(editor);
  }
}
 
源代码17 项目: wildfly-samples   文件: HttpResponseCache.java
private void update(CacheResponse conditionalCacheHit, HttpURLConnection httpConnection)
    throws IOException {
  HttpEngine httpEngine = getHttpEngine(httpConnection);
  URI uri = httpEngine.getUri();
  ResponseHeaders response = httpEngine.getResponseHeaders();
  RawHeaders varyHeaders =
      httpEngine.getRequestHeaders().getHeaders().getAll(response.getVaryFields());
  Entry entry = new Entry(uri, varyHeaders, httpConnection);
  DiskLruCache.Snapshot snapshot = (conditionalCacheHit instanceof EntryCacheResponse)
      ? ((EntryCacheResponse) conditionalCacheHit).snapshot
      : ((EntrySecureCacheResponse) conditionalCacheHit).snapshot;
  DiskLruCache.Editor editor = null;
  try {
    editor = snapshot.edit(); // returns null if snapshot is not current
    if (editor != null) {
      entry.writeTo(editor);
      editor.commit();
    }
  } catch (IOException e) {
    abortQuietly(editor);
  }
}
 
源代码18 项目: reader   文件: HttpResponseCache.java
public Entry(URI uri, RawHeaders varyHeaders, HttpURLConnection httpConnection)
    throws IOException {
  this.uri = uri.toString();
  this.varyHeaders = varyHeaders;
  this.requestMethod = httpConnection.getRequestMethod();
  this.responseHeaders = RawHeaders.fromMultimap(httpConnection.getHeaderFields(), true);

  SSLSocket sslSocket = getSslSocket(httpConnection);
  if (sslSocket != null) {
    cipherSuite = sslSocket.getSession().getCipherSuite();
    Certificate[] peerCertificatesNonFinal = null;
    try {
      peerCertificatesNonFinal = sslSocket.getSession().getPeerCertificates();
    } catch (SSLPeerUnverifiedException ignored) {
    }
    peerCertificates = peerCertificatesNonFinal;
    localCertificates = sslSocket.getSession().getLocalCertificates();
  } else {
    cipherSuite = null;
    peerCertificates = null;
    localCertificates = null;
  }
}
 
源代码19 项目: cordova-android-chromeview   文件: TunnelRequest.java
/**
 * If we're creating a TLS tunnel, send only the minimum set of headers.
 * This avoids sending potentially sensitive data like HTTP cookies to
 * the proxy unencrypted.
 */
RawHeaders getRequestHeaders() {
  RawHeaders result = new RawHeaders();
  result.setRequestLine("CONNECT " + host + ":" + port + " HTTP/1.1");

  // Always set Host and User-Agent.
  result.set("Host", port == getDefaultPort("https") ? host : (host + ":" + port));
  result.set("User-Agent", userAgent);

  // Copy over the Proxy-Authorization header if it exists.
  if (proxyAuthorization != null) {
    result.set("Proxy-Authorization", proxyAuthorization);
  }

  // Always set the Proxy-Connection to Keep-Alive for the benefit of
  // HTTP/1.0 proxies like Squid.
  result.set("Proxy-Connection", "Keep-Alive");
  return result;
}
 
源代码20 项目: crosswalk-cordova-android   文件: TunnelRequest.java
/**
 * If we're creating a TLS tunnel, send only the minimum set of headers.
 * This avoids sending potentially sensitive data like HTTP cookies to
 * the proxy unencrypted.
 */
RawHeaders getRequestHeaders() {
  RawHeaders result = new RawHeaders();
  result.setRequestLine("CONNECT " + host + ":" + port + " HTTP/1.1");

  // Always set Host and User-Agent.
  result.set("Host", port == getDefaultPort("https") ? host : (host + ":" + port));
  result.set("User-Agent", userAgent);

  // Copy over the Proxy-Authorization header if it exists.
  if (proxyAuthorization != null) {
    result.set("Proxy-Authorization", proxyAuthorization);
  }

  // Always set the Proxy-Connection to Keep-Alive for the benefit of
  // HTTP/1.0 proxies like Squid.
  result.set("Proxy-Connection", "Keep-Alive");
  return result;
}
 
源代码21 项目: reader   文件: HttpResponseCache.java
public Entry(URI uri, RawHeaders varyHeaders, HttpURLConnection httpConnection)
    throws IOException {
  this.uri = uri.toString();
  this.varyHeaders = varyHeaders;
  this.requestMethod = httpConnection.getRequestMethod();
  this.responseHeaders = RawHeaders.fromMultimap(httpConnection.getHeaderFields(), true);

  SSLSocket sslSocket = getSslSocket(httpConnection);
  if (sslSocket != null) {
    cipherSuite = sslSocket.getSession().getCipherSuite();
    Certificate[] peerCertificatesNonFinal = null;
    try {
      peerCertificatesNonFinal = sslSocket.getSession().getPeerCertificates();
    } catch (SSLPeerUnverifiedException ignored) {
    }
    peerCertificates = peerCertificatesNonFinal;
    localCertificates = sslSocket.getSession().getLocalCertificates();
  } else {
    cipherSuite = null;
    peerCertificates = null;
    localCertificates = null;
  }
}
 
private void update(CacheResponse conditionalCacheHit, HttpURLConnection httpConnection)
    throws IOException {
  HttpEngine httpEngine = getHttpEngine(httpConnection);
  URI uri = httpEngine.getUri();
  ResponseHeaders response = httpEngine.getResponseHeaders();
  RawHeaders varyHeaders =
      httpEngine.getRequestHeaders().getHeaders().getAll(response.getVaryFields());
  Entry entry = new Entry(uri, varyHeaders, httpConnection);
  DiskLruCache.Snapshot snapshot = (conditionalCacheHit instanceof EntryCacheResponse)
      ? ((EntryCacheResponse) conditionalCacheHit).snapshot
      : ((EntrySecureCacheResponse) conditionalCacheHit).snapshot;
  DiskLruCache.Editor editor = null;
  try {
    editor = snapshot.edit(); // returns null if snapshot is not current
    if (editor != null) {
      entry.writeTo(editor);
      editor.commit();
    }
  } catch (IOException e) {
    abortQuietly(editor);
  }
}
 
源代码23 项目: cordova-amazon-fireos   文件: HttpResponseCache.java
private void update(CacheResponse conditionalCacheHit, HttpURLConnection httpConnection)
    throws IOException {
  HttpEngine httpEngine = getHttpEngine(httpConnection);
  URI uri = httpEngine.getUri();
  ResponseHeaders response = httpEngine.getResponseHeaders();
  RawHeaders varyHeaders =
      httpEngine.getRequestHeaders().getHeaders().getAll(response.getVaryFields());
  Entry entry = new Entry(uri, varyHeaders, httpConnection);
  DiskLruCache.Snapshot snapshot = (conditionalCacheHit instanceof EntryCacheResponse)
      ? ((EntryCacheResponse) conditionalCacheHit).snapshot
      : ((EntrySecureCacheResponse) conditionalCacheHit).snapshot;
  DiskLruCache.Editor editor = null;
  try {
    editor = snapshot.edit(); // returns null if snapshot is not current
    if (editor != null) {
      entry.writeTo(editor);
      editor.commit();
    }
  } catch (IOException e) {
    abortQuietly(editor);
  }
}
 
源代码24 项目: cordova-amazon-fireos   文件: HttpResponseCache.java
public Entry(URI uri, RawHeaders varyHeaders, HttpURLConnection httpConnection)
    throws IOException {
  this.uri = uri.toString();
  this.varyHeaders = varyHeaders;
  this.requestMethod = httpConnection.getRequestMethod();
  this.responseHeaders = RawHeaders.fromMultimap(httpConnection.getHeaderFields(), true);

  SSLSocket sslSocket = getSslSocket(httpConnection);
  if (sslSocket != null) {
    cipherSuite = sslSocket.getSession().getCipherSuite();
    Certificate[] peerCertificatesNonFinal = null;
    try {
      peerCertificatesNonFinal = sslSocket.getSession().getPeerCertificates();
    } catch (SSLPeerUnverifiedException ignored) {
    }
    peerCertificates = peerCertificatesNonFinal;
    localCertificates = sslSocket.getSession().getLocalCertificates();
  } else {
    cipherSuite = null;
    peerCertificates = null;
    localCertificates = null;
  }
}
 
源代码25 项目: phonegapbootcampsite   文件: TunnelRequest.java
/**
 * If we're creating a TLS tunnel, send only the minimum set of headers.
 * This avoids sending potentially sensitive data like HTTP cookies to
 * the proxy unencrypted.
 */
RawHeaders getRequestHeaders() {
  RawHeaders result = new RawHeaders();
  result.setRequestLine("CONNECT " + host + ":" + port + " HTTP/1.1");

  // Always set Host and User-Agent.
  result.set("Host", port == getDefaultPort("https") ? host : (host + ":" + port));
  result.set("User-Agent", userAgent);

  // Copy over the Proxy-Authorization header if it exists.
  if (proxyAuthorization != null) {
    result.set("Proxy-Authorization", proxyAuthorization);
  }

  // Always set the Proxy-Connection to Keep-Alive for the benefit of
  // HTTP/1.0 proxies like Squid.
  result.set("Proxy-Connection", "Keep-Alive");
  return result;
}
 
源代码26 项目: wildfly-samples   文件: HttpResponseCache.java
public Entry(URI uri, RawHeaders varyHeaders, HttpURLConnection httpConnection)
    throws IOException {
  this.uri = uri.toString();
  this.varyHeaders = varyHeaders;
  this.requestMethod = httpConnection.getRequestMethod();
  this.responseHeaders = RawHeaders.fromMultimap(httpConnection.getHeaderFields(), true);

  SSLSocket sslSocket = getSslSocket(httpConnection);
  if (sslSocket != null) {
    cipherSuite = sslSocket.getSession().getCipherSuite();
    Certificate[] peerCertificatesNonFinal = null;
    try {
      peerCertificatesNonFinal = sslSocket.getSession().getPeerCertificates();
    } catch (SSLPeerUnverifiedException ignored) {
    }
    peerCertificates = peerCertificatesNonFinal;
    localCertificates = sslSocket.getSession().getLocalCertificates();
  } else {
    cipherSuite = null;
    peerCertificates = null;
    localCertificates = null;
  }
}
 
源代码27 项目: phonegapbootcampsite   文件: HttpResponseCache.java
public Entry(URI uri, RawHeaders varyHeaders, HttpURLConnection httpConnection)
    throws IOException {
  this.uri = uri.toString();
  this.varyHeaders = varyHeaders;
  this.requestMethod = httpConnection.getRequestMethod();
  this.responseHeaders = RawHeaders.fromMultimap(httpConnection.getHeaderFields(), true);

  SSLSocket sslSocket = getSslSocket(httpConnection);
  if (sslSocket != null) {
    cipherSuite = sslSocket.getSession().getCipherSuite();
    Certificate[] peerCertificatesNonFinal = null;
    try {
      peerCertificatesNonFinal = sslSocket.getSession().getPeerCertificates();
    } catch (SSLPeerUnverifiedException ignored) {
    }
    peerCertificates = peerCertificatesNonFinal;
    localCertificates = sslSocket.getSession().getLocalCertificates();
  } else {
    cipherSuite = null;
    peerCertificates = null;
    localCertificates = null;
  }
}
 
源代码28 项目: L.TileLayer.Cordova   文件: Job.java
HttpEngine newEngine(Connection connection) throws IOException {
  String protocol = request.url().getProtocol();
  RawHeaders requestHeaders = request.rawHeaders();
  if (protocol.equals("http")) {
    return new HttpEngine(client, this, request.method(), requestHeaders, connection, null);
  } else if (protocol.equals("https")) {
    return new HttpsEngine(client, this, request.method(), requestHeaders, connection, null);
  } else {
    throw new AssertionError();
  }
}
 
源代码29 项目: L.TileLayer.Cordova   文件: Response.java
private Response(Builder builder) {
  this.request = builder.request;
  this.code = builder.code;
  this.headers = new RawHeaders(builder.headers);
  this.body = builder.body;
  this.redirectedBy = builder.redirectedBy;
}
 
源代码30 项目: IoTgo_Android_App   文件: Job.java
HttpEngine newEngine(Connection connection) throws IOException {
  String protocol = request.url().getProtocol();
  RawHeaders requestHeaders = request.rawHeaders();
  if (protocol.equals("http")) {
    return new HttpEngine(client, this, request.method(), requestHeaders, connection, null);
  } else if (protocol.equals("https")) {
    return new HttpsEngine(client, this, request.method(), requestHeaders, connection, null);
  } else {
    throw new AssertionError();
  }
}
 
 类所在包
 同包方法