1 // Copyright 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 package org.chromium.net;
6 
7 import org.chromium.base.annotations.JNINamespace;
8 import org.chromium.base.annotations.NativeMethods;
9 
10 /**
11  * Class to access HttpUtil library from Java.
12  *
13  * The corresponding native code is in net/android/android_http_util.cc.
14  */
15 @JNINamespace("net")
16 public final class HttpUtil {
17     /**
18      * Returns true iff:
19      * - |headerName| is validly formed (see HttpUtil::IsValidHeaderName).
20      * - |headerName| is not a forbidden header (see HttpUtil::IsSafeHeader).
21      * - |headerValue| is validly formed (see HttpUtil::IsValidHeaderValue).
22      */
isAllowedHeader(String headerName, String headerValue)23     public static boolean isAllowedHeader(String headerName, String headerValue) {
24         return HttpUtilJni.get().isAllowedHeader(headerName, headerValue);
25     }
26 
27     @NativeMethods
28     interface Natives {
isAllowedHeader(String headerName, String headerValue)29         boolean isAllowedHeader(String headerName, String headerValue);
30     }
31 }
32