Commit 5e2726ae authored by YannGarcia's avatar YannGarcia
Browse files

CV2X#3 Validation against PKIs

parent bf548622
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -145,6 +145,32 @@ module LibItsHttp_Functions {
        } // End of 'for' statement
      } // End of function f_get_header
      
      /**
      * @desc Check HTTP response headers
      * @param p_headers The HTTP headers
      * @param p_value the expected va;ue
      * @return true on success, false otherwise
      */
      function f_check_headers(
                               in Headers p_headers,
                               in charstring p_header_name := "Location",
                               in template (present) charstring p_value := ?
                               ) return boolean {
        // Local variables
        var boolean v_header_matched := false;
        
        for (var integer v_idx := 0; v_idx < lengthof(p_headers); v_idx := v_idx + 1) {
          if (p_headers[v_idx].header_name == p_header_name) {
            if (match(p_headers[v_idx].header_value[0], p_value) == true) { 
              v_header_matched := true;
            } // else, nothing to do
            break;
          }
        } // End of 'for' statement
        
        return v_header_matched;
      } // End of function f_check_headers

    } // End of group http_headers
    
} // End of module LibItsHttp_Functions