Mark some functions as public (#315)

Fixes #315.

Co-authored-by: Daniel Abramov <inetcrack2@gmail.com>
pull/326/head
ssrlive 2 years ago committed by GitHub
parent 72c6f6cdd0
commit 3fc7fb412c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/handshake/client.rs
  2. 3
      src/handshake/machine.rs
  3. 3
      src/handshake/mod.rs
  4. 4
      src/handshake/server.rs

@ -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…
Cancel
Save