@Override public MultiMap remove(String name) { headers.remove(name); return this; }
@Override public MultiMap remove(CharSequence name) { headers.remove(name); return this; } }
private void stripXFFHeaders(HttpRequest req) { HttpHeaders headers = req.headers(); for (AsciiString headerName : HEADERS_TO_STRIP) { headers.remove(headerName); } } }
@Nullable @Override public List<String> remove(Object key) { if (key instanceof String) { List<String> previousValues = this.headers.getAll((String) key); this.headers.remove((String) key); return previousValues; } return null; }
/** * Removes the header with the specified name. * * @param name The name of the header to remove * @return {@code this} */ public HttpHeaders remove(CharSequence name) { return remove(name.toString()); }
private HttpHeaders propagatedHeaders(Request request, Realm realm, boolean keepBody) { HttpHeaders headers = request.getHeaders() .remove(HOST) .remove(CONTENT_LENGTH); if (!keepBody) { headers.remove(CONTENT_TYPE); } if (realm != null && realm.getScheme() == AuthScheme.NTLM) { headers.remove(AUTHORIZATION) .remove(PROXY_AUTHORIZATION); } return headers; } }
@Nullable @Override public List<String> remove(Object key) { if (key instanceof String) { List<String> previousValues = this.headers.getAll((String) key); this.headers.remove((String) key); return previousValues; } return null; }
/** * @deprecated Use {@link #remove(CharSequence)} instead. * * @see #removeHeader(HttpMessage, CharSequence) */ @Deprecated public static void removeHeader(HttpMessage message, String name) { message.headers().remove(name); }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof HttpRequest) { HttpRequest req = (HttpRequest) msg; for (String name : req.headers().names()) { if (name.startsWith("x-http2-")) { req.headers().remove(name); } } } super.channelRead(ctx, msg); } }
private void stripXFFHeaders(HttpRequest req) { HttpHeaders headers = req.headers(); for (AsciiString headerName : HEADERS_TO_STRIP) { headers.remove(headerName); } } }
private void handleExpect100Continue(ChannelHandlerContext ctx, HttpRequest req) { if (HttpUtil.is100ContinueExpected(req)) { final ChannelFuture f = ctx.writeAndFlush(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE)); f.addListener((s) -> { if (! s.isSuccess()) { throw new ZuulException( s.cause(), "Failed while writing 100-continue response", true); } }); // Remove the Expect: 100-Continue header from request as we don't want to proxy it downstream. req.headers().remove(HttpHeaderNames.EXPECT); zuulRequest.getHeaders().remove(HttpHeaderNames.EXPECT.toString()); } }
@Override public FullHttpMessage copyIfNeeded(FullHttpMessage msg) { if (msg instanceof FullHttpRequest) { FullHttpRequest copy = ((FullHttpRequest) msg).replace(Unpooled.buffer(0)); copy.headers().remove(HttpHeaderNames.EXPECT); return copy; } return null; } };
private void prepareRequestHeaders(HttpRequest request, String hostHeader, boolean chunked) { HttpHeaders headers = request.headers(); headers.remove(TRANSFER_ENCODING); if (!headers.contains(HOST)) { request.headers().set(HOST, hostHeader); } if (chunked) { HttpUtil.setTransferEncodingChunked(request, true); } if (conn.options.isTryUseCompression() && request.headers().get(ACCEPT_ENCODING) == null) { // if compression should be used but nothing is specified by the user support deflate and gzip. request.headers().set(ACCEPT_ENCODING, DEFLATE_GZIP); } if (!conn.options.isKeepAlive() && conn.options.getProtocolVersion() == io.vertx.core.http.HttpVersion.HTTP_1_1) { request.headers().set(CONNECTION, CLOSE); } else if (conn.options.isKeepAlive() && conn.options.getProtocolVersion() == io.vertx.core.http.HttpVersion.HTTP_1_0) { request.headers().set(CONNECTION, KEEP_ALIVE); } }
@Override protected Object newContinueResponse(HttpMessage start, int maxContentLength, ChannelPipeline pipeline) { Object response = continueResponse(start, maxContentLength, pipeline); // we're going to respond based on the request expectation so there's no // need to propagate the expectation further. if (response != null) { start.headers().remove(EXPECT); } return response; }
private int parseTimeout() { String timeout = request.headers().get(Constants.HTTP_HEAD_READ_TIMEOUT); if (timeout != null) { request.headers().remove(Constants.HTTP_HEAD_READ_TIMEOUT); Integer integer = Ints.tryParse(timeout); if (integer != null && integer > 0) { return integer; } } return TIMEOUT; }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof HttpRequest) { HttpRequest req = (HttpRequest) msg; for (String name : req.headers().names()) { if (name.startsWith("x-http2-")) { req.headers().remove(name); } } } super.channelRead(ctx, msg); } }
@Override protected void sanitizeHeadersBeforeEncode(HttpResponse msg, boolean isAlwaysEmpty) { if (!isAlwaysEmpty && method == HttpMethod.CONNECT && msg.status().codeClass() == HttpStatusClass.SUCCESS) { // Stripping Transfer-Encoding: // See https://tools.ietf.org/html/rfc7230#section-3.3.1 msg.headers().remove(HttpHeaderNames.TRANSFER_ENCODING); return; } super.sanitizeHeadersBeforeEncode(msg, isAlwaysEmpty); }
private void handleExpect100Continue(ChannelHandlerContext ctx, HttpRequest req) { if (HttpUtil.is100ContinueExpected(req)) { final ChannelFuture f = ctx.writeAndFlush(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE)); f.addListener((s) -> { if (! s.isSuccess()) { throw new ZuulException( s.cause(), "Failed while writing 100-continue response", true); } }); // Remove the Expect: 100-Continue header from request as we don't want to proxy it downstream. req.headers().remove(HttpHeaderNames.EXPECT); zuulRequest.getHeaders().remove(HttpHeaderNames.EXPECT.toString()); } }
@Override public <T> FilterContext<T> filter(FilterContext<T> ctx) { // pass on the x-expect-get and remove the x-redirect // headers if found in the response ctx.getResponseHeaders().get("x-expect-post"); ctx.getRequest().getHeaders().add("x-expect-post", "true"); ctx.getRequest().getHeaders().remove("x-redirect"); return ctx; } };
@Override public <T> FilterContext<T> filter(FilterContext<T> ctx) { // pass on the x-expect-get and remove the x-redirect // headers if found in the response ctx.getResponseHeaders().get("x-expect-get"); ctx.getRequest().getHeaders().add("x-expect-get", "true"); ctx.getRequest().getHeaders().remove("x-redirect"); return ctx; } };