Implement GetProtocolInfo

This commit is contained in:
Igor Katson 2024-08-29 12:06:03 +01:00
parent 0303cfa084
commit 99ffeec323
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
2 changed files with 20 additions and 3 deletions

View file

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:GetProtocolInfoResponse xmlns:u="urn:schemas-upnp-org:service:ConnectionManager:1">
<Source>http-get:*:*:DLNA.ORG_OP=01</Source>
<Sink></Sink>
</u:GetProtocolInfoResponse>
</s:Body>
</s:Envelope>

View file

@ -1,9 +1,11 @@
use axum::{body::Bytes, extract::State, response::IntoResponse};
use bstr::BStr;
use http::{HeaderMap, StatusCode};
use http::{header::CONTENT_TYPE, HeaderMap, StatusCode};
use tracing::{debug, trace};
use crate::{state::UnpnServerState, subscriptions::SubscribeRequest};
use crate::{
constants::CONTENT_TYPE_XML_UTF8, state::UnpnServerState, subscriptions::SubscribeRequest,
};
pub const SOAP_ACTION_GET_PROTOCOL_INFO: &[u8] =
b"\"urn:schemas-upnp-org:service:ConnectionManager:1#GetProtocolInfo\"";
@ -39,7 +41,11 @@ pub(crate) async fn http_handler(
let not_implemented = StatusCode::NOT_IMPLEMENTED.into_response();
match action.as_ref() {
SOAP_ACTION_GET_PROTOCOL_INFO => not_implemented,
SOAP_ACTION_GET_PROTOCOL_INFO => (
[(CONTENT_TYPE, CONTENT_TYPE_XML_UTF8)],
include_str!("../resources/templates/connection_manager/control/get_protocol_info.xml"),
)
.into_response(),
SOAP_ACTION_CONNECTION_COMPLETE => not_implemented,
SOAP_ACTION_GET_CURRENT_CONNECTION_INFO => not_implemented,
SOAP_ACTION_GET_CURRENT_CONNECTION_IDS => not_implemented,