/** * Returns the request status line, like "GET / HTTP/1.1". This is exposed to the application by * {@link HttpURLConnection#getHeaderFields}, so it needs to be set even if the transport is * HTTP/2. */ public static String get(Request request, Proxy.Type proxyType) { StringBuilder result = new StringBuilder(); result.append(request.method()); result.append(' '); if (includeAuthorityInRequestLine(request, proxyType)) { result.append(request.url()); } else { result.append(requestPath(request.url())); } result.append(" HTTP/1.1"); return result.toString(); }
/** * Prepares the HTTP headers and sends them to the server. * * <p>For streaming requests with a body, headers must be prepared <strong>before</strong> the * output stream has been written to. Otherwise the body would need to be buffered! * * <p>For non-streaming requests with a body, headers must be prepared <strong>after</strong> the * output stream has been written to and closed. This ensures that the {@code Content-Length} * header field receives the proper value. */ @Override public void writeRequestHeaders(Request request) throws IOException { String requestLine = RequestLine.get( request, streamAllocation.connection().route().proxy().type()); writeRequest(request.headers(), requestLine); }
public static List<Header> http2HeadersList(Request request) { Headers headers = request.headers(); List<Header> result = new ArrayList<>(headers.size() + 4); result.add(new Header(TARGET_METHOD, request.method())); result.add(new Header(TARGET_PATH, RequestLine.requestPath(request.url()))); String host = request.header("Host"); if (host != null) { result.add(new Header(TARGET_AUTHORITY, host)); // Optional. } result.add(new Header(TARGET_SCHEME, request.url().scheme())); for (int i = 0, size = headers.size(); i < size; i++) { // header names must be lowercase. String name = headers.name(i).toLowerCase(Locale.US); if (!HTTP_2_SKIPPED_REQUEST_HEADERS.contains(name) || name.equals(TE) && headers.value(i).equals("trailers")) { result.add(new Header(name, headers.value(i))); } } return result; }
public static List<Header> http2HeadersList(Request request) { Headers headers = request.headers(); List<Header> result = new ArrayList<>(headers.size() + 4); result.add(new Header(TARGET_METHOD, request.method())); result.add(new Header(TARGET_PATH, RequestLine.requestPath(request.url()))); String host = request.header("Host"); if (host != null) { result.add(new Header(TARGET_AUTHORITY, host)); // Optional. } result.add(new Header(TARGET_SCHEME, request.url().scheme())); for (int i = 0, size = headers.size(); i < size; i++) { // header names must be lowercase. String name = headers.name(i).toLowerCase(Locale.US); if (!HTTP_2_SKIPPED_REQUEST_HEADERS.contains(name) || name.equals(TE) && headers.value(i).equals("trailers")) { result.add(new Header(name, headers.value(i))); } } return result; }
/** * Returns the request status line, like "GET / HTTP/1.1". This is exposed to the application by * {@link HttpURLConnection#getHeaderFields}, so it needs to be set even if the transport is * HTTP/2. */ public static String get(Request request, Proxy.Type proxyType) { StringBuilder result = new StringBuilder(); result.append(request.method()); result.append(' '); if (includeAuthorityInRequestLine(request, proxyType)) { result.append(request.url()); } else { result.append(requestPath(request.url())); } result.append(" HTTP/1.1"); return result.toString(); }
public static List<Header> http2HeadersList(Request request) { Headers headers = request.headers(); List<Header> result = new ArrayList<>(headers.size() + 4); result.add(new Header(TARGET_METHOD, request.method())); result.add(new Header(TARGET_PATH, RequestLine.requestPath(request.url()))); result.add(new Header(TARGET_AUTHORITY, Util.hostHeader(request.url()))); // Optional. result.add(new Header(TARGET_SCHEME, request.url().scheme())); for (int i = 0, size = headers.size(); i < size; i++) { // header names must be lowercase. ByteString name = ByteString.encodeUtf8(headers.name(i).toLowerCase(Locale.US)); if (!HTTP_2_SKIPPED_REQUEST_HEADERS.contains(name)) { result.add(new Header(name, headers.value(i))); } } return result; }
/** * Prepares the HTTP headers and sends them to the server. * * <p>For streaming requests with a body, headers must be prepared <strong>before</strong> the * output stream has been written to. Otherwise the body would need to be buffered! * * <p>For non-streaming requests with a body, headers must be prepared <strong>after</strong> the * output stream has been written to and closed. This ensures that the {@code Content-Length} * header field receives the proper value. */ @Override public void writeRequestHeaders(Request request) throws IOException { String requestLine = RequestLine.get( request, streamAllocation.connection().route().proxy().type()); writeRequest(request.headers(), requestLine); }
/** * Returns the request status line, like "GET / HTTP/1.1". This is exposed to the application by * {@link HttpURLConnection#getHeaderFields}, so it needs to be set even if the transport is * SPDY. */ static String get(Request request, Proxy.Type proxyType) { StringBuilder result = new StringBuilder(); result.append(request.method()); result.append(' '); if (includeAuthorityInRequestLine(request, proxyType)) { result.append(request.url()); } else { result.append(requestPath(request.url())); } result.append(" HTTP/1.1"); return result.toString(); }
public static List<Header> http2HeadersList(Request request) { Headers headers = request.headers(); List<Header> result = new ArrayList<>(headers.size() + 4); result.add(new Header(TARGET_METHOD, request.method())); result.add(new Header(TARGET_PATH, RequestLine.requestPath(request.url()))); result.add(new Header(TARGET_AUTHORITY, Util.hostHeader(request.url()))); // Optional. result.add(new Header(TARGET_SCHEME, request.url().scheme())); for (int i = 0, size = headers.size(); i < size; i++) { // header names must be lowercase. ByteString name = ByteString.encodeUtf8(headers.name(i).toLowerCase(Locale.US)); if (!HTTP_2_SKIPPED_REQUEST_HEADERS.contains(name)) { result.add(new Header(name, headers.value(i))); } } return result; }
/** * Prepares the HTTP headers and sends them to the server. * * <p>For streaming requests with a body, headers must be prepared <strong>before</strong> the * output stream has been written to. Otherwise the body would need to be buffered! * * <p>For non-streaming requests with a body, headers must be prepared <strong>after</strong> the * output stream has been written to and closed. This ensures that the {@code Content-Length} * header field receives the proper value. */ @Override public void writeRequestHeaders(Request request) throws IOException { String requestLine = RequestLine.get( request, streamAllocation.connection().route().proxy().type()); writeRequest(request.headers(), requestLine); }
/** * Returns the request status line, like "GET / HTTP/1.1". This is exposed * to the application by {@link HttpURLConnection#getHeaderFields}, so it * needs to be set even if the transport is SPDY. */ static String get(Request request, Proxy.Type proxyType) { StringBuilder result = new StringBuilder(); result.append(request.method()); result.append(' '); if (includeAuthorityInRequestLine(request, proxyType)) { result.append(request.url()); } else { result.append(requestPath(request.url())); } result.append(" HTTP/1.1"); return result.toString(); }
public static List<Header> http2HeadersList(Request request) { Headers headers = request.headers(); List<Header> result = new ArrayList<>(headers.size() + 4); result.add(new Header(TARGET_METHOD, request.method())); result.add(new Header(TARGET_PATH, RequestLine.requestPath(request.url()))); result.add(new Header(TARGET_AUTHORITY, Util.hostHeader(request.url()))); // Optional. result.add(new Header(TARGET_SCHEME, request.url().scheme())); for (int i = 0, size = headers.size(); i < size; i++) { // header names must be lowercase. ByteString name = ByteString.encodeUtf8(headers.name(i).toLowerCase(Locale.US)); if (!HTTP_2_SKIPPED_REQUEST_HEADERS.contains(name)) { result.add(new Header(name, headers.value(i))); } } return result; }
/** * Prepares the HTTP headers and sends them to the server. * * <p>For streaming requests with a body, headers must be prepared <strong>before</strong> the * output stream has been written to. Otherwise the body would need to be buffered! * * <p>For non-streaming requests with a body, headers must be prepared <strong>after</strong> the * output stream has been written to and closed. This ensures that the {@code Content-Length} * header field receives the proper value. */ @Override public void writeRequestHeaders(Request request) throws IOException { String requestLine = RequestLine.get( request, streamAllocation.connection().route().proxy().type()); writeRequest(request.headers(), requestLine); }
/** * Returns the request status line, like "GET / HTTP/1.1". This is exposed to the application by * {@link HttpURLConnection#getHeaderFields}, so it needs to be set even if the transport is * HTTP/2. */ public static String get(Request request, Proxy.Type proxyType) { StringBuilder result = new StringBuilder(); result.append(request.method()); result.append(' '); if (includeAuthorityInRequestLine(request, proxyType)) { result.append(request.url()); } else { result.append(requestPath(request.url())); } result.append(" HTTP/1.1"); return result.toString(); }
final String uri = RequestLine.requestPath(request.url()); parameters.put("methodname", method); parameters.put("uri", uri);
/** * Prepares the HTTP headers and sends them to the server. * * <p>For streaming requests with a body, headers must be prepared <strong>before</strong> the * output stream has been written to. Otherwise the body would need to be buffered! * * <p>For non-streaming requests with a body, headers must be prepared <strong>after</strong> the * output stream has been written to and closed. This ensures that the {@code Content-Length} * header field receives the proper value. */ @Override public void writeRequestHeaders(Request request) throws IOException { httpEngine.writingRequestHeaders(); String requestLine = RequestLine.get( request, httpEngine.getConnection().route().proxy().type()); writeRequest(request.headers(), requestLine); }
/** * Returns the request status line, like "GET / HTTP/1.1". This is exposed to the application by * {@link HttpURLConnection#getHeaderFields}, so it needs to be set even if the transport is * HTTP/2. */ public static String get(Request request, Proxy.Type proxyType) { StringBuilder result = new StringBuilder(); result.append(request.method()); result.append(' '); if (includeAuthorityInRequestLine(request, proxyType)) { result.append(request.url()); } else { result.append(requestPath(request.url())); } result.append(" HTTP/1.1"); return result.toString(); }
final String uri = RequestLine.requestPath(request.url()); parameters.put("methodname", method); parameters.put("uri", uri);
/** * Prepares the HTTP headers and sends them to the server. * * <p>For streaming requests with a body, headers must be prepared * <strong>before</strong> the output stream has been written to. Otherwise * the body would need to be buffered! * * <p>For non-streaming requests with a body, headers must be prepared * <strong>after</strong> the output stream has been written to and closed. * This ensures that the {@code Content-Length} header field receives the * proper value. */ @Override public void writeRequestHeaders(Request request) throws IOException { httpEngine.writingRequestHeaders(); String requestLine = RequestLine.get( request, httpEngine.getConnection().getRoute().proxy().type()); writeRequest(request.headers(), requestLine); }
/** * Returns the request status line, like "GET / HTTP/1.1". This is exposed * to the application by {@link HttpURLConnection#getHeaderFields}, so it * needs to be set even if the transport is SPDY. */ static String get(Request request, Proxy.Type proxyType) { StringBuilder result = new StringBuilder(); result.append(request.method()); result.append(' '); if (includeAuthorityInRequestLine(request, proxyType)) { result.append(request.url()); } else { result.append(requestPath(request.url())); } result.append(" HTTP/1.1"); return result.toString(); }