HTTP multiplexing transfer using an intermediate header in websocket frames
Patent Information
- Application Number
- PCT/EP2024/055395
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-07
- Filing Date
- 2024-03-01
- Publication Date
- 2024-09-19
AI Technical Summary
The HTTP/1.1 protocol limits simultaneous requests and responses within a TCP/IP connection, leading to inefficiencies and increased server load due to the need for multiple connections, while HTTP/2 introduces complexity and lacks backward compatibility with HTTP/1.1, necessitating a more efficient and compatible multiplexing solution for message transfer.
The introduction of an intermediate header in WebSocket frames allows for multiplexing of HTTP/1.1 messages within a single TCP/IP connection, enabling simultaneous message exchange and maintaining compatibility with various HTTP versions by using a bidirectional WebSocket protocol with an auto-incrementing request ID and minimal bandwidth overhead.
This solution enables efficient multiplexing of HTTP messages across different versions, reducing server load and processing time, while maintaining compatibility with legacy protocols and minimizing bandwidth overhead, thus providing a unified communication solution for all HTTP versions.
Smart Images

Figure EP2024055395_19092024_PF_FP_ABST
Abstract
Description
HTTP MULTIPLEXING TRANSFER USING AN INTERMEDIATE HEADER INWEB SOCKET FRAMESBACKGROUND
[0001] The HTTP / 1.1 protocol conventionally allows for sequential messages exchanged in a request / response chain in a single TCP / IP connection between a client and a server. In HTTP / 1.1 there conventionally is no ability to have more than one request / response chain at a time within the TCP / IP connection. Until the current message is fully completed there is no way to start another one. Furthermore, a long-lived message (e.g. feed, chat) may keep the connection busy even when no data is being transmitted on the dedicated TCP / IP connection. There is no way for any faster processed or shorter message to travel before the slowest / biggest one is completed. For this reason, usually under the HTTP / 1.1 protocol one client device may open and maintain up to 6 TCP / IP connections between the same server, even when the TCP / IP connections are not actively transmitting messages. Having so many active TCP / IP connections active may stress the HTTP / 1. 1 servers, which may keep many TCP / IP connections for each client connected to the server.
[0002] The subsequently introduced HTTP / 2 protocol solves this problem by multiplexing requests for each client to a server However, the HTTP / 2 protocol involves many complex components, such as header compression / decompression and request prioritization not included in the HTTP / 1.1 protocol. Furthermore, HTTP / 2 introduced a new semantics in major HTTP headers without backward compatibility with legacy protocols such as HTTP / 1.1. This complexity is not necessary in some types of applications and adds processing time and unnecessary costs when the benefit of the header compression is low, or when the HTTP message processing component has already predefined its request’s processing prioritization.
[0003] The WebSocket protocol can be established between a client and a server by upgrading a HTTP / 1.1 connection. After that, the WebSocket channel can support the exchange of WebSocket frames in bidirectional communication. This protocol is simple and with low bandwidth overhead. The WebSocket frames each have a header (from 3-8 byte when payload does not exceed 65535 bytes or up to 14 bytes for bigger payloads). In the exemplary embodiment, this header contains the five option flags (fin, rsvl, rsv2, rsv3, mask), the frame type (TEXT BINARY CONTINUOUS CLOSING PING PONG) the payload length andare triggered from a server. By supporting different custom protocols, it has many applications with needs for fast message exchange, handling them by different types of servers / clients. Usually, the WebSocket connection coexists separately from the above-described HTTP / 1.1 connections, which serve the HTTP traffic between the client and the server.BRIEF DESCRIPTION OF THE FIGURES
[0005] Fig. 1 illustrates the WebSocket to HTTP Binary Frame with an Intermediate Header. This header may be placed after the WebSocket header and before the HTTP message.
[0006] Fig. 2 illustrates the WebSocket to HTTP Binary Frames exchange between a client and a server. The indicators for +H means the end of headers flag and +M the end of message flag. The HTTP messages in Fig. 2 are HTTP / 1.1 but other HTTP messages can be transferred as well.
[0007] Fig. 3 illustrates the HTTP / 1.1 message exchange based on the Request / Response serialized chains.
[0008] Fig. 4 illustrates the WebSocket frames exchange in a two-way communication with each part being independent from the other in frame sending.
[0009] Fig. 5 illustrates the difference in semantics between HTTP / 2 and HTTP / 1.1 request headers.
[0010] Fig. 6 illustrates the initial WebSocket Upgrade Handling with immediate response in one cycle.
[0011] Fig. 7 illustrates using a single WebSocket channel to multiplex messages from different HTTP versions between clients and servers using a middle computer to conceal protocol differences while leaving the HTTP payload intact according to various embodiments.
[0012] Fig. 8 illustrates the unifying of HTTP different versions communication and semantics between Clients and Servers by converting all HTTP versions to one specific version by the middle proxy.
[0013] Fig. 9 is an exemplary computer system for implementing the methods and systems described herein according to some embodimentsDETAILED DESCRIPTION
[0014] Various examples of the present technology are discussed in detail below. While specific implementations are discussed, it should be understood that this is done for illustration purposes only. A person skilled in the relevant art will recognize that other components and configurations may be used without parting from the spirit and scope of the present technology.
[0015] The solutions described herein utilize the bidirectional WebSocket protocol in a multiplexing message transfer which permits many HTTP / 1.1 messages to remain open under a single TPC / IP connection, thereby resolving the above-described HTTP / 1.1 serialization limitations. In HTTP / 1.1 only one request / response is permitted to be open at any time. In the WebSocket communication protocol, both sides can exchange any frame message at any time in real time exchange. The HTTP / 2 provides the required multiplexing in HTTP messages transfer, but it lacks any compatibility with HTTP / 1.1 and involves more complexity to achieve the multiplexing. By inserting an intermediate header at top of WebSocket binary frame, the HTTP message transfer may be multiplexed for multiple messages, while leaving the remaining HTTP / 1.1 message semantics intact. Using this solution, any HTTP message can use the WebSocket protocol to transfer while keeping its payload intact. Even for newer HTTP protocol versions, which already support native multiplexing, using the WebSocket solution described herein can offer an alternative way to transfer the HTTP pay load data that is homogenous regardless of the HTTP protocol version the message was transmitted under. The solution can act as unified communication solution for all HTTP versions messages multiplexing exchanges. Further by altering messages semantics by a middle computer, the middle computer can hide all communication and semantics changes from web / application servers, which may support only one HTTP version.
[0016] The intermediate header include a corresponding auto-increment request number in one connection as a request id associated with the request / response message pair. This allows any HTTP message to be broken down in many smaller WebSocket frames, each frame for this message having the same request number Each of the frames may travel through thesending any new request. The described solution also has smaller bandwidth overhead and faster processing time than HTTP / 2 for some types of applications. For example, the typical header size using WebSocket is 6 bytes per frame at server side: Web Socket Header 4 bytes plus Intermediate Header 2 bytes (compared to 9 bytes per frame for HTTP / 2). As the WebSocket transfer is separate from the HTTP messages, which are self-contained within the frames, multiplexing can be supported for different HTTP semantics with minimal modifications in processing software.
[0017] While the conventional conversion processes exist for converting HTTP messages to binary WebSocket frames, conventional conversion methods do not provide any mechanism of multiplexing or handling of long-lived requests, as may be done using the described solutions Conventional solutions only provide for a serial one-to-one message-to-frame translation, without allowing for HTTP message interpolation or multiplexing for different message frames.
[0018] As shown in Fig. 4 at element 500, the WebSocket provides a bidirectional communication channel between a client and a server. This communication can be used to transfer HTTP messages, in a multiplexing transfer by having:(a) any HTTP message request / response pair for a given client and server uniquely identified by a request id number, in order for the frames from one HTTP message to be distinguished from other messages usingthe WebSocket channel, and(b) a set of indicators for the HTTP messages to signal the start and end of the payload, and the message header’s ending.To address these concerns, an Intermediate Header is placed between the WebSocket header and the frame payload, as shown in Fig. 1 at element 100. The Intermediate Header (which may include a default size of 2 bytes in length, 2+3+11=16 bits), may contain: a. the sub type (2 bits) HEAD / BODY / PUSH / SOCK / etc.; b. the flags (3 bits) notating the end of headers (+H) and the end of message (+M), or the padding of message payload (+P); and c. the sequential Request id (11 bits, up to 2048 reusable request ids).
[0019] At the WebSocket connection upgrade the client can set the appropriate HTTPare not enough for application needs (e.g., ws-http-head: 4-4-24), allowing for customization by the user when needed.
[0020] Every binary frame may include the intermediate header (as seen in Fig. 2, element 200The ), followed by the HTTP payload message (element 300 in Fig. 3). By using this header, the WebSocket frames can send / receive partial data (e.g., in binary frames) of any HTTP message in each direction during the message lifetime. A new unique, at the time it is issued, request ID may be allocated by the HTTP component of the message initiator, when it starts any new request. The first WebSocket frame for this request / response message pair sets, in the Intermediate Header, the sub type HEAD, the appropriate lifetime flags, and the newly allocated request ID. The receiver recognizes the sub type HEAD, registers the received request ID, and sends the payload data to a new HTTP processing thread for this pair. The receiver forwards to this HTTP processor any received data payload, and when any response is available from the new HTTP processing thread, delivers the data to the client HTTP component via the WebSocket channel. All response message frames may be assigned the same request ID as the request message frames, along with its lifetime flags. When both sides send the end of message flag (+M) in its sending frame series, the current request ID for the request / response pair may be unregistered from sender and receiver HTTP components. During message duration, frames for other request / response pairs (i.e. having different Request Ids), can be exchanged and delivering to other HTTP processing threads in parallel. .
[0021] In an exemplary embodiment, there may be four Intermediate Header sub-protocol types: HEAD, BODY, PUSH, and SOCK:HEAD: headers and body blocks, first frame for HTTP request or response register a new Request Id;BODY : headers and body blocks frames after the HEAD until the (+M) flag set; PUSH: headers and body blocks, first frame for server initiated messages; SOCK: WebSocket Binary Frame message exchange for non HTTP proposes.When a new HTTP message is initiated, from each side the first frame has the sub-protocol type “HEAD” at the intermediate header by incrementing the last used request ID When the HEADat any size, interpolating with frames from other requests until the end of message flag (+M) set indicating the end of data transmission from corresponding side of communication. When server side responds, it responds with a HEAD sub type with same Request id marks the first frame, followed by the same manner with zero or more BODY frames until message termination. That allows many HTTP messages to remain open within one Web Socket connection, client, and server that can send data on it, when it is available. The HTTP software components can read, write the HTTP Message intact payload after the Intermediate Header as plain HTTP message, without involving the fact that the message was transmitted via WebSocket connection.
[0022] The HEAD sub type frame contains the original HTTP message starting with headers block of the message. The termination of the HTTP / 1.1 headers block denoted with empty new line. This termination can occur at first HEAD or at any subsequent BODY message which carries the end of headers flag (+H) at Intermediate Header. At the HEAD frame with HTTP / 1.1 like termination the frame continue with any existing message body after headers termination. This allows the small data payloads to be transferred completed in one frame. For the HTTP / 2 the end of headers flag (+H) notes this is the final HEADERS / CONTINUATION frame with the end of headers flag. In HTTP / 2 the above frames and- cannot carry any body data, because of the header compression / decompression takes its place. Only minor modifications to HTTP / 1. 1 software components may be needed to operate in the above-described manner. The modifications may depend on the HTTP processor type. The HTTP processors may read the request and produce the response on the server side (while performing the opposite on the client device side). In many implementations, the processor may also handle the connection used for HTTP messaging (e.g. opening and closing it). The connection handling component of the HTTP processor may accordingly need to be modified, as the connection is now shared between many requests / responses and must remain open. These modifications need affect only the connection handling, request unused data discarding, leaving the semantics of messages processing intact (e.g. the connection should not closed after a message / response thread is ended, as the connection may be serving many other requests at same time). The HTTP processor input / output must be replaced with WebSocket with Intermediate Header input / output software filterit can be removed as it is not needed at the framed communication, depending on initial negotiation. Some of the HTTP / 1.1 headers, which are usually repeated between a client and server in conventional HTTP / 1.1 messaging, can also can be omitted (e.g. "User Agent") to further reduce the communication bandwidth.
[0024] The Web Socket to HTTP with Intermediate Header software filter in input and output can also handle the differences between HTTP variations unifying the real data processing inside the servers or clients.Intermediate Header detail with 2 byte size with up to 2048 re-usable requests id :Intermediate Header detail with 3 bytes, (4+4+16 = 24 bits) - up to 65,535 re-usable request ids:In each connection the Intermediate Header element sizes can be altered by client by submitting the HTTP Header at connection upgrade (e.g., ws-http-head: 4-4-24). The server must accept any values from a minimum 2-3-3 (1 up to 8 bytes Intermediate Header length) to cover any special application needs, for more request ids or more application specific flag values. The total sum of bits in three elements must be divided by 8. By extending its length, special application needs can covered with the additional bits in subtypes or flags or request ids.
[0025] As noted above, there may be three different Intermediate Header sub flags: the end of headers (+H), the end of message (+M) flags and the padding of message payload (+P) flag. All sub types can carry any of the above flags. End of header flag (+H) marks when the HTTP / 1.1 header block terminates, followed by an empty new line that exists within the frame which carries this flag or that this is the final HEADERS / CONTINUATION HTTP / 2 framerequest / response pair is considered closed and can be reused when the Request Id limit for the current connection header reached (i.e. 2048 / 65535 / 16777216 for 2 / 3 / 4 byte header sizes).
[0026] An appendix of header and payload structure diagrams is attached to illustrate exemplary embodiments of various data structures that may be used to implement the above-described improvements.Special Handling of initial request:
[0027] The initial WebSocket upgrade request can include the path name (element 700 of Fig. 7) of the first HTTP request. The server, immediately after accepting the upgrade request, starts sending WebSocket Frames (element 800) with an HTTP Response to this path request. For this first request / response pair, does not needed WebSocket frame with sub protocol type HEAD to start, as the upgrade request path / headers can be used, for quicker first data deliver.
[0028] In case this behavior is not desired from the client (e.g. when the first HTTP Request has body payload as POST request, or more headers need to be included) the client can include a ws-http-req: 0 header in initial upgrade request in order prevent the server from the path immediate processing and answer. The client may start transmitting the WebSocket Frames for this request after receiving the upgrade response.Unifying of different types of HTTP messages communication needs:
[0029] Each HTTP version has its specific needs in communicative details defining the header start / stop and determining the payload length (900). An intermediate computer system between the client and server, such as a proxy server as shown, can handle all communication differences and by translating all communications to Web Socket Frames with Intermediate Header (1000) permitting the following web / appli cation server to handle a unify communication protocol. The HTTP payload can remain intact in this case.Unifying of different type of HTTP versions semantics:.
[0030] Each HTTP version has its specific needs in message semantics (600) which may beweb / appli cation servers in one single variation of HTTP (1200), which each server supports. The middle computer must translate headers and payload specific characteristics (Content- Length, Chunked encoding, Framing communication) after receiving the message from client or before sending to them. The web / application server can accelerate the processing by handling only one protocol semantics and one protocol of communication. If the middle computer sends an upgrade request with a requested HTTP version which does not supported by the server the server responds with ws-http header enumerating all supported variations (e.g., ws-http: 1.1, 2).Differences from HTTP / 2 protocol:
[0031] The HTTP / 2 was introduced to solve the HTTP / 1.1 problems allowing a two-way multiplexing of HTTP / 2 messages exchange. It uses a 9-byte header and uses frames of types DATA, HEADERS, PRIORITY, RST STREAM, SETTINGS, PUSH PROMISE, PING, GOAWAY, WINDOW UPDATE and CONTINUATION. The HTTP / 2 needs only one TCP / IP connection, solving the multiple HTTP / 1 .1 connections problem.
[0032] As shown in element 600 of Fig. 6, HTTP / 2 lacks backward compatibility with HTTP / 1. 1, in message headers semantics, and does not offer any efficient way for old HTTP / 1.1 communication transferring within HTTP / 2 frames. The non-browser transfers usually have small headers in which the compression / decompression of headers represents overhead. Also they have a complicated procedure in request prioritization scheme and “on the fly” changing of its frame settings. All these aspects can lead to slower servers, for some applications, and bigger programming efforts to handle the protocol.
[0033] The bandwidth spending for the framing in WebSocket to HTTP with Intermediate Header is 6 bytes per frame at server side and 8-10 bytes at client with masking option on vs 9 bytes per HTTP / 2 frame. The HTTP / 2 requires two frames created for the most of the server answers or clients POSTs (for HEADERS and DATA frames when body exists). The Intermediate Header solution needs only one frame for heads and data, in case of HTTP / 1.1 empty new line headers termination Fore above differences there are a specific range ofHTTP / 1.1 transfer along with plain WebSocket messages:
[0034] In the case of HTTP / 1.1 messages transfer which lack any multiplexing, the above innovation is a reliable, fast solution for the HTTP / 1.1 messages transfer in multiplexing transfer. In cases which the WebSocket selected as option from other special needs the binary WebSocket frames with header sub type SOCKS, or TEXT frames can continue supports the old way WebSocket communication and the other sub types can support HTTP messages exchange needs within the same connection. The WebSocket protocol with the addition of the Intermediate Header is an easy implemented solution for the client or the server adding multiplexing capability for all HTTP messages payloads. By implementing this communication solution at a web / application server and adding a middle proxy machine between server and client we can permits the client to communicate with middle proxy in any HTTP version, while the server allowed to support only one HTTP version (e.g HTTP / 1.1) based on Web Sockets with Indeterminate header.
[0035] FIG. 9 is a diagram of an example computing system that may be used with some embodiments of the present invention. The computing system 102 is only one example of a suitable computing system, such as a client or server system, and is not intended to suggest any limitation as to the scope of use or functionality of the design. The computing system 102 should not be interpreted as having any dependency or requirement relating to any one or combination of components illustrated. The design is operational with numerous other general purpose or special purpose computing systems. Examples of well-known computing systems, environments, and / or configurations that may be suitable for use with the design include, but are not limited to, personal computers, server computers, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, mini-computers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. For example, the computing system 102 may be implemented as a mobile computing system such as one that is configured to run
[0036] Some embodiments of the present invention may be described in the general context of computing system executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. Those skilled in the art can implement the description and / or figures herein as computer-executable instructions, which can be embodied on any form of computing machine readable media discussed below.
[0037] Some embodiments of the present invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
[0038] Referring to FIG. 9, the computing system 102 may include, but are not limited to, a processing unit 120 having one or more processing cores, a system memory 130, and a system bus 121 that couples various system components including the system memory 130 to the processing unit 120. The system bus 121 may be any of several types of bus structures including a memory bus or memory controller, a peripheral bus, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA) locale bus, and Peripheral Component Interconnect (PCI) bus also known as Mezzanine bus.
[0039] The computing system 102 typically includes a variety of computer readable media. Computer readable media can be any available media that can be accessed by computing system 102 and includes both volatile and nonvolatile media, removable and non-removable media. By way of example, and not limitation, computer readable media may store information such as computer readable instructions, data structures, program modules or other data. Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology CD ROM digital versatile disks (DVD) or other optical disk storageby computing system 102. Communication media typically embodies computer readable instructions, data structures, or program modules.
[0040] The system memory 130 may include computer storage media in the form of volatile and / or nonvolatile memory such as read only memory (ROM) 131 and random-access memory (RAM) 132. A basic input / output system (BIOS) 133, containing the basic routines that help to transfer information between elements within computing system 102, such as during start-up, is typically stored in ROM 131. RAM 132 typically contains data and / or program modules that are immediately accessible to and / or presently being operated on by processing unit 120. By way of example, and not limitation, FIG.5 also illustrates operating system 134, application programs 135, other program modules 136, and program data 137
[0041] The computing system 102 may also include other removable / non-removable volatile / nonvolatile computer storage media. By way of example only, FIG. 5 also illustrates a hard disk drive 141 that reads from or writes to non-removable, nonvolatile magnetic media, a magnetic disk drive 151 that reads from or writes to a removable, nonvolatile magnetic disk 152, and an optical disk drive 155 that reads from or writes to a removable, nonvolatile optical disk 156 such as, for example, a CD ROM or other optical media. Other removable / non-removable, volatile / nonvolatile computer storage media that can be used in the exemplary operating environment include, but are not limited to, USB drives and devices, magnetic tape cassettes, flash memory cards, digital versatile disks, digital video tape, solid state RAM, solid state ROM, and the like. The hard disk drive 141 is typically connected to the system bus 121 through a nonremovable memory interface such as interface 140, and magnetic disk drive 151 and optical disk drive 155 are typically connected to the system bus 121 by a removable memory interface, such as interface 150.
[0042] The drives and their associated computer storage media discussed above and illustrated in FIG. 9, provide storage of computer readable instructions, data structures, program modules and other data for the computing system 102. In FIG. 8, for example, hard disk drive 141 is illustrated as storing operating system 144, application programs 145, other program modules 146 and program data 147 Note that these components can either be the same as ormodules 146, and the program data 147 are given different numeric identification here to illustrate that, at a minimum, they are different copies.
[0043] A user may enter commands and information into the computing system 102 through input devices such as a keyboard 162, a microphone 163, and a pointing device 161, such as a mouse, trackball or touchpad or touch screen. Other input devices (not shown) may include a joystick, gamepad, scanner, or the like. These and other input devices are often connected to the processing unit 120 through a user input interface 160 that is coupled with the system bus 121, but may be connected by other interface and bus structures, such as a parallel port, game port or a universal serial bus (USB). A monitor 191 or other type of display device is also connected to the system bus 121 via an interface, such as a video interface 190. In addition to the monitor, computers may also include other peripheral output devices such as speakers 197 and printer 196, which may be connected through an output peripheral interface 190.
[0044] The computing system 102 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 180. The remote computer 180 may be a personal computer, a hand-held device, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the computing system 102. The logical connections depicted in FIG.5 include a local area network (LAN) 171 and a wide area network (WAN) 173, but may also include other networks. Such networking environments are commonplace in offices, enterprisewide computer networks, intranets and the Internet.
[0045] When used in a LAN networking environment, the computing system 102 may be connected to the LAN 171 through a network interface or adapter 170. When used in a WAN networking environment, computing system 102 typically includes a modem 172 or other means for establishing communications over the WAN 173, such as the Internet. Modem 172, which may be internal or external, may be connected to the system bus 121 via the user-input interface 160, or other appropriate mechanism. In a networked environment, program modules depicted relative to the computing system 102, or portions thereof, may be stored in a remote memory storage device By way of example and not limitation FIG 5 illustrates remote application
[0046] It should be noted that some embodiments of the present invention may be carried out on a computing system such as that described with respect to FIG. 9. However, some embodiments of the present invention may be carried out on a server, a computer devoted to message handling, handheld devices, or on a distributed system in which different portions of the present design may be carried out on different parts of the distributed computing system.
[0047] Another device that may be coupled with the system bus 121 is a power supply such as a battery or a Direct Current (DC) power supply) and Alternating Current (AC) adapter circuit. The DC power supply may be a battery, a fuel cell, or similar DC power source that needs to be recharged on a periodic basis. The communication module (or modem) 172 may employ a Wireless Application Protocol (WAP) to establish a wireless communication channel. The communication module 172 may implement a wireless networking standard such as Institute of Electrical and Electronics Engineers (IEEE) 802.11 standard, IEEE std. 802.11-1999, published by IEEE in 1999.
[0048] Examples of mobile computing systems may be a laptop computer, a tablet computer, a Netbook, a smart phone, a personal digital assistant, or other similar device with on board processing power and wireless communications ability that is powered by a Direct Current (DC) power source that supplies DC voltage to the mobile computing system and that is solely within the mobile computing system and needs to be recharged on a periodic basis, such as a fuel cell or a battery.APPENDIX AWebSocket, Wshttp and HTTP / 2 protocols details1. WebSocket HeaderServer side: 3-4 bytes for payloads < 65535 (usually case) Client with masking key: 6-8 bytes for payloads < 65535Payload Length: 7 bits (byte2 & 127 == length) Extended Payload Len: 0 when length <= 125 or 16 when length == 126 or 64 bits when length == 127Masking Key: 4 byte when mask = 1 for the client side.2. Wshttp (WebSocket to HTTP protocol) Intermediate HeaderThe Intermediate Header, used only in WebSocket binary frames, has variable lengths from 1-8 bytes, negotiated at upgrade phase. The default header size is 2 bytes (2+3+11=16 bits) for up to 2,048 requests can remain opened at the same time in a WebSocket.3. HTTP headers used on WebSocket Upgrade request.(i) "ws-http" (required)The ws-http header establishes the Wshttp protocol by specifying the HTTP payload type 1.1 or 2 or 3 etc. Without this header the server / client must not start the Wshttp protocol.(ii) "ws-http-head" (optional)This header declares the Intermediate Header elements lengths in bits: Sub Type-Flags- Request Id. It can be omitted when have default value 2-3-11. The total size of the 3 elements must be multiplier of 8, up to 64 bits.(iii) "ws-http-req" (optional)The value 1 (default value) instructs the server to send the answer for upgrade requesting path, immediately after upgrade accept. In case of value 0 the server sends only accept headers and then waits from the client to start the http requests.4. Intermediate Header Elements(i) Sub type: The sub type of the WebSocket binary frame (noted as St in the diagrams). More types can be added in case of Sub Types length in header declared is longer than 2 bits.HEAD (1): headers and body blocks, first frame for HTTP request or responseBODY (0): headers and body blocks frames after the HEAD until the (+M) flag set PUSH (3): headers and body blocks, first frame for server initiated messages.SOCK (2): WebSocket Binary Frame message exchange for non HTTP proposes(ii) Flags: The flags of frame (more flags can be added for longer than 3 bit sizes) bit 0: ENDOF MESSAGE (0x1) +M bit 1 : PADDED_MESSAGE(0x2) +P bit 2: ENDOF HEADERS (0x4) +H(iii) Request id: this element contains the request / response pair identity. Any request id can be reused after request / response pair is completed with flag (+M) from both sides. Its length can vary from 3-32 bits limiting the requests / responses which can be oppended at any time.5. Complete Wshttp Header (WebSocket + Intermediate Header) stucture(i) Server side complete header: 4 + 2 = 6 (for payloads < 65535)(ii) Client side complete header: 8 + 2 = 10 (for payloads < 65535 or 6+2 = 8 for payloads up to 125), with masking-key value (4 bytes).Flags depending on Type: ACK (1), END STREAM (1), END_HEADERS(4), PADDED (8), PRIORITY(0x20).8. Illustration of HTTP / 2 frames:(i) DATA frame with flags END STREAM, PADDED, when padded, the first byte of payload contains the padded length. PRIORITY(vi) CONTINUATION type with Flag END_HEADERS, when set, bit 2 indicates that this frame ends a header block
Claims
What is claimed is:
1. A computer-implemented method, comprising: multiplexing many hypertext transfer protocol requests / responds (HTTP messages) within single WebSocket connection by setting an intermediate header at the top of WebSocket Frame payload which identifies the request / response pair id number and provides flags to control the request / response pair lifetime.
2. The computer-implemented method of claim 1, wherein the initial WebSocket upgrade request can target the path of the first HTTP Request uniform resource identifier (URI) which permits the server side to respond with HTTP Response, immediately after accepting the upgrade without need to wait to receive the request from client. The client can set a header to prevent this immediate processing.
3. The computer-implemented method of claim 1, wherein the Request Id, the Sub Type and the Flags size of bytes can vary to cover special applications needs for more flags or many requests.
4. The computer-implemented method of claim 1, further comprising that: the HTTP messages payload transferred intact allowing the HTTP software processor works with method of claim 1 with minor modifications.
5. The computer-implemented method of claim 1, further comprising that: a computer acting as web or proxy server in the middle of a client and server can handle all different types of HTTP protocols and forward to the servers only WebSocket Frames with Intermediate Header in order to hide communication and semantics differences from these servers and unifying its message processing.
6. The computer-implemented method of claim 1, further comprising that: a computer acting as web or proxy server in the middle of a client and server can handle all different types of HTTP protocols semantics and forward to the servers WebSocket Frames with Intermediate Header in a s
Citation Information
Patent Citations
HTTP proxy
US20170163758A1
