From e1392d5fcab41b6ac104ebef1fbc55c9e233e641 Mon Sep 17 00:00:00 2001 From: cake-duke Date: Mon, 22 Dec 2025 11:00:51 +0000 Subject: [PATCH 1/2] Update example and docs --- src/HTTP.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/HTTP.jl b/src/HTTP.jl index 41f91fc3..4118a389 100644 --- a/src/HTTP.jl +++ b/src/HTTP.jl @@ -591,8 +591,7 @@ open(f::Function, method::Union{String,Symbol}, url, headers=Header[]; kw...)::R HTTP.openraw(method, url, [, headers])::Tuple{Connection, Response} Open a raw socket that is unmanaged by HTTP.jl. Useful for doing HTTP upgrades -to other protocols. Any bytes of the body read from the socket when reading -headers, is returned as excess bytes in the last tuple argument. +to other protocols. Example of a WebSocket upgrade: ```julia @@ -602,7 +601,7 @@ headers = Dict( "Sec-WebSocket-Key" => "dGhlIHNhbXBsZSBub25jZQ==", "Sec-WebSocket-Version" => "13") -socket, response, excess = HTTP.openraw("GET", "ws://echo.websocket.org", headers) +socket, response = HTTP.openraw("GET", "ws://echo.websocket.org", headers) # Write a WebSocket frame frame = UInt8[0x81, 0x85, 0x37, 0xfa, 0x21, 0x3d, 0x7f, 0x9f, 0x4d, 0x51, 0x58] From e410b34a637c6456b313bdc2b1c32a67fca66044 Mon Sep 17 00:00:00 2001 From: cake-duke Date: Mon, 22 Dec 2025 12:05:32 +0000 Subject: [PATCH 2/2] Update url, avoid redirect --- src/HTTP.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/HTTP.jl b/src/HTTP.jl index 4118a389..17634683 100644 --- a/src/HTTP.jl +++ b/src/HTTP.jl @@ -601,7 +601,7 @@ headers = Dict( "Sec-WebSocket-Key" => "dGhlIHNhbXBsZSBub25jZQ==", "Sec-WebSocket-Version" => "13") -socket, response = HTTP.openraw("GET", "ws://echo.websocket.org", headers) +socket, response = HTTP.openraw("GET", "https://echo.websocket.org", headers) # Write a WebSocket frame frame = UInt8[0x81, 0x85, 0x37, 0xfa, 0x21, 0x3d, 0x7f, 0x9f, 0x4d, 0x51, 0x58]