Mark some functions as public (#315)
Fixes #315. Co-authored-by: Daniel Abramov <inetcrack2@gmail.com>
This commit is contained in:
parent
72c6f6cdd0
commit
3fc7fb412c
|
@ -102,7 +102,7 @@ impl<S: Read + Write> HandshakeRole for ClientHandshake<S> {
|
|||
}
|
||||
|
||||
/// Verifies and generates a client WebSocket request from the original request and extracts a WebSocket key from it.
|
||||
fn generate_request(mut request: Request) -> Result<(Vec<u8>, String)> {
|
||||
pub fn generate_request(mut request: Request) -> Result<(Vec<u8>, String)> {
|
||||
let mut req = Vec::new();
|
||||
write!(
|
||||
req,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
//! WebSocket handshake machine.
|
||||
|
||||
use bytes::Buf;
|
||||
use log::*;
|
||||
use std::io::{Cursor, Read, Write};
|
||||
|
@ -101,6 +103,7 @@ pub enum RoundResult<Obj, Stream> {
|
|||
#[derive(Debug)]
|
||||
pub enum StageResult<Obj, Stream> {
|
||||
/// Reading round finished.
|
||||
#[allow(missing_docs)]
|
||||
DoneReading { result: Obj, stream: Stream, tail: Vec<u8> },
|
||||
/// Writing round finished.
|
||||
DoneWriting(Stream),
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
pub mod client;
|
||||
pub mod headers;
|
||||
pub mod machine;
|
||||
pub mod server;
|
||||
|
||||
mod machine;
|
||||
|
||||
use std::{
|
||||
error::Error as ErrorTrait,
|
||||
fmt,
|
||||
|
|
|
@ -93,8 +93,8 @@ pub fn create_response_with_body<T>(
|
|||
Ok(create_parts(request)?.body(generate_body())?)
|
||||
}
|
||||
|
||||
// Assumes that this is a valid response
|
||||
fn write_response<T>(mut w: impl io::Write, response: &HttpResponse<T>) -> Result<()> {
|
||||
/// Write `response` to the stream `w`.
|
||||
pub fn write_response<T>(mut w: impl io::Write, response: &HttpResponse<T>) -> Result<()> {
|
||||
writeln!(
|
||||
w,
|
||||
"{version:?} {status}\r",
|
||||
|
|
Loading…
Reference in New Issue