Skip to content

Releases: Dadido3/WebSocket_Server

v1.006

05 Dec 16:36
Compare
Choose a tag to compare

Add Get_HTTP_Header function to retrieve the parsed HTTP header that the client originally sent:

Protected *HTTP_Header.WebSocket_Server::HTTP_Header = WebSocket_Server::Get_HTTP_Header(*Client)
PrintN(" Request: " + *HTTP_Header\Request)
ForEach *HTTP_Header\Field()
  PrintN(" Header Key-Value pair: " + MapKey(*HTTP_Header\Field()) + #TAB$ + #TAB$ + *HTTP_Header\Field())
Next

should result in:

Request: GET / HTTP/1.1
Header Key-Value pair: accept          */*
Header Key-Value pair: sec-fetch-dest          websocket
Header Key-Value pair: sec-fetch-mode          websocket
Header Key-Value pair: sec-websocket-extensions                permessage-deflate
Header Key-Value pair: origin          null
Header Key-Value pair: pragma          no-cache
Header Key-Value pair: sec-websocket-key               09xtga3M2j7tW4ckuqWIFQ==
Header Key-Value pair: accept-encoding         gzip, deflate, br
Header Key-Value pair: user-agent              Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv
Header Key-Value pair: accept-language         de,en-US;q=0.7,en;q=0.3
Header Key-Value pair: host            localhost
Header Key-Value pair: cache-control           no-cache
Header Key-Value pair: sec-fetch-site          cross-site
Header Key-Value pair: sec-websocket-version           13
Header Key-Value pair: connection              keep-alive, Upgrade
Header Key-Value pair: upgrade         websocket
Header Key-Value pair: dnt             1

v1.005

28 Feb 21:27
Compare
Choose a tag to compare
  • Use suggested min. size for Base64EncoderBuffer output buffer
  • Add connect (handshake) and disconnect timeouts
  • Read http header in bigger chunks, assume that clients don't send any data after #CRLF$ #CRLF$
  • Implement client queue instead of iterating over all clients every event
  • On forced connection close, dump incoming network data into dummy buffer
  • Enqueue client on every possible action that needs to trigger a Event_Callback call
  • Throttle network thread when client queue is too large, this gives Event_Callback more processing time
  • Use allocation dumper to find memory leaks and other memory problems
  • Fix possible memory leak in Client_Disconnect_Mutexless()

v1.004

11 Feb 16:21
Compare
Choose a tag to compare

A rather big update from v1.003.
The server handles some stuff differently, but the API is backwards compatible.
From this version on the server conforms to the WebSocket standard, at least as much as possible.

There are some failing test cases that can't be solved because of how PureBasic supports unicode and text encodings, this would either need the use of third party libraries or the use of the operating system's API.

  • Use Autobahn|Testsuite for fuzzing
  • Fix most test cases
  • Fix how server closes the connection on client request
  • Fix data frame length encoding for transmitted frames
  • Limit the payload size of control frames (defined by websocket standard)
  • Free semaphore right before the server thread ends, not when the event thread ends
  • Move built in frame actions (ping and disconnect request handling) into Event_Callback so the actions stay in sync with everything else
  • Send signal to event thread every time a frame has been sent
  • Use local pointer to frame data in Event_Callback
  • Get rid of unnecessary second FirstElement()
  • Check if control frames are fragmented
  • Don't execute frame actions on malformed frames
  • Add a fragmented payload limit
  • Add a FrameData field that contains the raw frame Data
  • Add HandleFragmentation parameter to Create
  • Add Fragments List to client, that stores a fragment frame series
  • Add logic to combine fragmented frames
  • Allow fragmented messages to have a payload of 0 length
  • Add close status code enumeration
  • Add status code and reason to client disconnect
  • Add Client_Disconnect_Mutexless
  • Use default disconnect reason of 0, which means no reason at all
  • Remove all other (unsent) TX_Frame elements before sending a disconnect control frame
  • Add reason to Client_Disconnect
  • Close connection with correct status code in case of error

v1.003

09 Feb 04:11
Compare
Choose a tag to compare
  • Fix typos and misspelled words
  • Remove Event_Disconnect field from client
  • Don't break loop in Thread_Receive_Frame() after every packet
  • Remove some commented code
  • Add mutexless variant of Frame_Send() for internal use
  • Fix a race condition that may happen when using Client_Disconnect()
  • Fix a memory leak in the HTTP header receiver
  • Get rid of pushing and popping RX_Frame
  • Set Event_Disconnect_Manually flag inside of Frame_Send() and Frame_Send_Mutexless()
  • Remove the Done field from Frames
  • Add *New_RX_FRAME to client
  • Simplify how packets are received
  • Check result of all AllocateMemory and AllocateStructure calls
  • Null any freed memory or structure pointer
  • Prevent client to receive HTTP header if there is a forced disconnect
  • Limit HTTP header allocation size
  • Add internal function Client_Free() that frees everything that is allocated by a client