src/net/cert_net/nss_ocsp.cc
// Sets response of |req| in the output parameters.
// It is helper routine for OCSP trySendAndReceiveFcn.
// |http_response_data_len| could be used as input parameter.  If it has
// non-zero value, it is considered as maximum size of |http_response_data|.
Sets response of |req| in the output parameters.
It is helper routine for OCSP trySendAndReceiveFcn.
|http_response_data_len| could be used as input parameter.  If it has
non-zero value, it is considered as maximum size of |http_response_data|.
Sets response of |req| in the output parameters . It is helper routine for OCSP trySendAndReceiveFcn . |http_response_data_len| could be used as input parameter . If it has non - zero value it is considered as maximum size of |http_response_data| .
SECStatus OCSPSetResponse(OCSPRequestSession* req,
                          PRUint16* http_response_code,
                          const char** http_response_content_type,
                          const char** http_response_headers,
                          const char** http_response_data,
                          PRUint32* http_response_data_len) {
  DCHECK(req->Finished());
  const std::string& data = req->http_response_data();
  if (http_response_data_len && *http_response_data_len) {
    if (*http_response_data_len < data.size()) {
      LOG(ERROR) << "response body too large: " << *http_response_data_len
                 << " < " << data.size();
      *http_response_data_len = data.size();
      PORT_SetError(SEC_ERROR_BAD_HTTP_RESPONSE);
      return SECFailure;
    }
  }
  VLOG(1) << "OCSP response "
          << " response_code=" << req->http_response_code()
          << " content_type=" << req->http_response_content_type()
          << " header=" << req->http_response_headers()
          << " data_len=" << data.size();
  if (http_response_code)
    *http_response_code = req->http_response_code();
  if (http_response_content_type)
    *http_response_content_type = req->http_response_content_type().c_str();
  if (http_response_headers)
    *http_response_headers = req->http_response_headers().c_str();
  if (http_response_data)
    *http_response_data = data.data();
  if (http_response_data_len)
    *http_response_data_len = data.size();
  return SECSuccess;
}
SECStatus OCSPSetResponse ( OCSPRequestSession * req , PRUint16 * http_response_code , const char * * http_response_content_type , const char * * http_response_headers , const char * * http_response_data , PRUint32 * http_response_data_len ) { DCHECK ( req -> Finished ( ) ) ; const std :: string & data = req -> http_response_data ( ) ; if ( http_response_data_len && * http_response_data_len ) { if ( * http_response_data_len < data . size ( ) ) { LOG ( ERROR ) << " " << * http_response_data_len << " " << data . size ( ) ; * http_response_data_len = data . size ( ) ; PORT_SetError ( SEC_ERROR_BAD_HTTP_RESPONSE ) ; return SECFailure ; } } VLOG ( 1 ) << " " << " " << req -> http_response_code ( ) << " " << req -> http_response_content_type ( ) << " " << req -> http_response_headers ( ) << " " << data . size ( ) ; if ( http_response_code ) * http_response_code = req -> http_response_code ( ) ; if ( http_response_content_type ) * http_response_content_type = req -> http_response_content_type ( ) . c_str ( ) ; if ( http_response_headers ) * http_response_headers = req -> http_response_headers ( ) . c_str ( ) ; if ( http_response_data ) * http_response_data = data . data ( ) ; if ( http_response_data_len ) * http_response_data_len = data . size ( ) ; return SECSuccess ; }
Sets response of |req| in the output parameters.
Sets response of |req| in the output parameters .