收到致命警报:bad_certificate RestAssured

时间:2015-07-16 21:29:55

标签: rest-assured

我正在使用RestAssured库来调用某些REST API的

这些是https端点,我尝试使用RestAssured中提供的“relaxedHTTPSValidation()”方法绕过SSL验证

我的请求看起来像

library("data.table")
library("stringr")
# Downloaded from https://raw.githubusercontent.com/datasets/airport-codes/master/data/airport-codes.csv
airports <- fread("airport-codes.csv")
first_bit <- paste(c("Lives", "Works", "Plays", "Condo", "Apartment", "I love"), "in")

places <- unique(c(airports$name, airports[!municipality == "", municipality]))

set.seed(123)
strings <- data.table(
  string = paste(sample(first_bit, 1e5, TRUE),
                 sample(places, 1e5, TRUE))
)
words <- sample(places, 5e4)

system.time({
  strings[, `:=`(lower = tolower(str_replace_all(string, "\\s+", " ")), result = NA_character_, str_no = .I)]
  setkey(strings, str_no)
  words_dt <- data.table(word = words[order(nchar(words), words, decreasing = TRUE)])
  words_dt[, lower := tolower(str_replace_all(word, "\\s+", " "))]
  words_dt[, nc := nchar(lower)]

  gaps <- str_locate_all(strings$string, "\\S+")
  starts <- unlist(lapply(gaps, function(x) x[, 1]))
  starts_len <- unlist(lapply(lengths(gaps)/2, seq, 1))
  dists <- lapply(seq(gaps), function(i) dist(c(gaps[[i]][, 1], nchar(strings$string[i]) + 2)) - 1)
  bits_dt <-  data.table(dist = unlist(dists), str_no = rep(strings$str_no, lengths(dists)), start = rep(starts, starts_len), key = "str_no")

  setkey(strings, str_no)
  for (len in unique(nchar(words))) {
    cat(len, "\n")
    words_right_length <- words_dt[nc == len]
    bits_right_length <- bits_dt[.(strings[is.na(result), str_no])][dist == len]
    bits_right_length[, matches := match(substr(strings[str_no, lower], start, start + dist - 1), words_right_length$lower)]
    matched <- bits_right_length[, .(first_match = na.omit(matches)[1]), by = str_no][!is.na(first_match)]
    if (nrow(matched) > 0) {
      matched[, word := words_right_length[first_match, word]]
      setkey(matched, str_no)
      strings[matched, result := word]
    }
  }

  strings[, `:=`(lower = NULL, str_no = NULL)]
})

我一直收到错误

RequestSpecification req = RestAssured.given().relaxedHTTPSValidation().body().post(); 

Doeas任何人都知道为什么会这样?

2 个答案:

答案 0 :(得分:0)

您使用的是哪个版本?早期版本之前我们遇到过同样的问题。将其更新到最新后,问题就解决了。

答案 1 :(得分:0)

  1. 与客户端和服务器不同步的java版本。
  2. 不同版本的SSL&amp; amp;兼容性问题TLS v1,客户端仅使用SSL v3处理。)