Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  endpoint.rs

  Sprache: Rust
 

//! Common HTTPS endpoint items.
use crate::{
    common::config::{WorkContext, WorkFlavor},
    https::{HttpsError, HttpsHeadersBuilder},
    utils::time::Duration,
};

/// An error occurred while communicationg with a common HTTPS endpoint.
///
/// Note: Not all errors are expected from all endpoints. For example, an endpoint whose protocol
/// specification has no semantic meaning addressed to status code `403` will not map it to
/// [`HttpsEndpointError::Forbidden`] but instead map it to [`HttpsEndpointError::UnexpectedStatus`].
#[derive(Debug, thiserror::Error)]
pub(crateenum HttpsEndpointError {
    /// A network error occurred.
    #[error("Network error: {0}")]
    NetworkError(#[from] HttpsError),

    /// Access forbidden
    #[error("Forbidden")]
    Forbidden,

    /// Not found
    #[error("Not found")]
    NotFound,

    /// Invalid authentication credentials
    #[error("Invalid credentials")]
    InvalidCredentials,

    /// The rate limit has been exceeded.
    #[error("Rate limit exceeded")]
    RateLimitExceeded,

    /// An authentication challenge expired
    #[error("Challenge expired")]
    ChallengeExpired,

    /// Authentication challenge response was invalid
    #[error("Invalid challenge response")]
    InvalidChallengeResponse,

    /// Unexpected status code.
    #[error("Unexpected status code '{0}'")]
    UnexpectedStatus(u16),

    /// Decoding the response failed.
    #[error("Decoding response failed: {0}")]
    DecodingFailed(#[from] serde_json::Error),

    /// The awkward response did not indicate success and contained a custom (possibly localized) error
    /// instead.
    #[error("Custom (possibly localized) error from server: {0}")]
    CustomPossiblyLocalizedError(String),
}

/// Default timeout for HTTPS endpoints.
pub(crateconst TIMEOUT: Duration = Duration::from_secs(15);

/// Returns a default set of headers for use with endpoints with basic auth added only if operating
/// in OnPrem mode.
pub(cratefn https_headers_with_authentication(context: &WorkContext) -> HttpsHeadersBuilder {
    let credentials = match context.flavor {
        WorkFlavor::Work => None,
        WorkFlavor::OnPrem => Some(&context.credentials),
    };
    let https_headers = HttpsHeadersBuilder::default();
    match credentials {
        None => https_headers,
        Some(credentials) => https_headers.basic_auth(&credentials.username, &credentials.password),
    }
}

Messung V0.5 in Prozent
C=78 H=98 G=88

¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet am  2026-06-29) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik