com.squareup.okhttp.internal.http.RawHeaders Java Examples
The following examples show how to use
com.squareup.okhttp.internal.http.RawHeaders.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TunnelRequest.java From cordova-android-chromeview with Apache License 2.0 | 6 votes |
/** * 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; }
Example #2
Source File: HttpResponseCache.java From bluemix-parking-meter with MIT License | 6 votes |
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; } }
Example #3
Source File: TunnelRequest.java From IoTgo_Android_App with MIT License | 6 votes |
/** * 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; }
Example #4
Source File: HttpResponseCache.java From cordova-amazon-fireos with Apache License 2.0 | 6 votes |
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; } }
Example #5
Source File: HttpResponseCache.java From reader with MIT License | 6 votes |
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; } }
Example #6
Source File: HttpResponseCache.java From wildfly-samples with MIT License | 6 votes |
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); } }
Example #7
Source File: TunnelRequest.java From phonegapbootcampsite with MIT License | 6 votes |
/** * 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; }
Example #8
Source File: HttpResponseCache.java From wildfly-samples with MIT License | 6 votes |
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; } }
Example #9
Source File: HttpResponseCache.java From crosswalk-cordova-android with Apache License 2.0 | 6 votes |
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); } }
Example #10
Source File: HttpResponseCache.java From phonegapbootcampsite with MIT License | 6 votes |
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; } }
Example #11
Source File: TunnelRequest.java From L.TileLayer.Cordova with MIT License | 6 votes |
/** * 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; }
Example #12
Source File: HttpResponseCache.java From reader with MIT License | 6 votes |
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); } }
Example #13
Source File: TunnelRequest.java From reader with MIT License | 6 votes |
/** * 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; }
Example #14
Source File: TunnelRequest.java From CordovaYoutubeVideoPlayer with MIT License | 6 votes |
/** * 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; }
Example #15
Source File: HttpResponseCache.java From cordova-amazon-fireos with Apache License 2.0 | 6 votes |
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); } }
Example #16
Source File: HttpResponseCache.java From IoTgo_Android_App with MIT License | 6 votes |
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; } }
Example #17
Source File: HttpResponseCache.java From CordovaYoutubeVideoPlayer with MIT License | 6 votes |
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); } }
Example #18
Source File: HttpResponseCache.java From bluemix-parking-meter with MIT License | 6 votes |
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); } }
Example #19
Source File: TunnelRequest.java From android-discourse with Apache License 2.0 | 6 votes |
/** * 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; }
Example #20
Source File: HttpResponseCache.java From crosswalk-cordova-android with Apache License 2.0 | 6 votes |
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; } }
Example #21
Source File: HttpResponseCache.java From android-discourse with Apache License 2.0 | 6 votes |
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); } }
Example #22
Source File: TunnelRequest.java From wildfly-samples with MIT License | 6 votes |
/** * 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; }
Example #23
Source File: HttpResponseCache.java From android-discourse with Apache License 2.0 | 6 votes |
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; } }
Example #24
Source File: HttpResponseCache.java From cordova-android-chromeview with Apache License 2.0 | 6 votes |
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); } }
Example #25
Source File: HttpResponseCache.java From reader with MIT License | 6 votes |
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; } }
Example #26
Source File: TunnelRequest.java From crosswalk-cordova-android with Apache License 2.0 | 6 votes |
/** * 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; }
Example #27
Source File: HttpResponseCache.java From IoTgo_Android_App with MIT License | 6 votes |
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); } }
Example #28
Source File: Job.java From cordova-amazon-fireos with Apache License 2.0 | 5 votes |
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(); } }
Example #29
Source File: Request.java From reader with MIT License | 5 votes |
private Request(Builder builder) { this.url = builder.url; this.method = builder.method; this.headers = new RawHeaders(builder.headers); this.body = builder.body; this.tag = builder.tag != null ? builder.tag : this; }
Example #30
Source File: Response.java From crosswalk-cordova-android with Apache License 2.0 | 5 votes |
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; }