WO2015103856A1 - HTTP chunked编码和IP包封装、解析方法 - Google Patents

HTTP chunked编码和IP包封装、解析方法 Download PDF

Info

Publication number
WO2015103856A1
WO2015103856A1 PCT/CN2014/081425 CN2014081425W WO2015103856A1 WO 2015103856 A1 WO2015103856 A1 WO 2015103856A1 CN 2014081425 W CN2014081425 W CN 2014081425W WO 2015103856 A1 WO2015103856 A1 WO 2015103856A1
Authority
WO
WIPO (PCT)
Prior art keywords
crlf
data
packet
chunk
encoding
Prior art date
Application number
PCT/CN2014/081425
Other languages
English (en)
French (fr)
Inventor
刘磊
郑艳伟
彭飞
Original Assignee
中国科学院声学研究所
北京海力汇通数字系统技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中国科学院声学研究所, 北京海力汇通数字系统技术有限公司 filed Critical 中国科学院声学研究所
Publication of WO2015103856A1 publication Critical patent/WO2015103856A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/166IP fragmentation; TCP segmentation

Definitions

  • the present invention relates to the field of network transmission, and in particular, to an HTTP chunked encoding and an IP packet encapsulation and parsing method. Background technique
  • the message format of the HTTP protocol consists of a message header and a message body.
  • the header section of the message defines a number of attribute fields that provide important information to the recipient of the message.
  • the Content-Length attribute field indicates the length of the message body, which facilitates the programming implementation of the data receiving process.
  • the message producer may not be able to immediately know the total length of the message body and thus cannot calculate the Content-Length field value in time. This can be avoided by using chunked encoding.
  • Chunked is a transmission encoding method of the HTTP/1.1 protocol, which cuts the data to be transmitted into multiple parts, and the message only needs to provide the length of each part.
  • the encoded message body is a set of consecutive coding blocks. Each code block contains a chunk-data and a chunk-size.
  • the format is defined as follows:
  • Chunk chunk-size [ chunk-extension ] CRLF chunk-data CRLF
  • chunk-size is the length of chunk-data and is a hex string.
  • CRLF is a double-byte newline character whose ASCII code value is OxOd 0x0a.
  • media content In cable TV video on demand systems and Internet video systems, media content, especially online video, is usually distributed and transmitted using HTTP chunked encoding.
  • the HTTP chunked encoded data receiving end needs to be parsed according to the chunked encoding format. Due to the large amount of data and long transmission time of video media, the efficiency of the chunked data analysis process is critical to the overall performance of media processing.
  • the parsing of the chunked data is usually performed by string matching, that is, the HTTP header and the chunk-size are parsed by matching the "CRLF" string, but the chunked data is parsed by the string matching method. And other defects. Summary of the invention
  • the object of the present invention is to overcome the inefficiency of the HTTP chunked data parsing method in the prior art, thereby providing an efficient encoding and encapsulation and parsing method.
  • the present invention provides an HTTP chunked encoding and an IP packet encapsulation method, including: a sender encapsulates an HTTP response header into a first IP data packet;
  • the encapsulating the "CRLF chunk-size CRLF" of the coding block into the IP data packet comprises: encapsulating the CRLF chunk-size CRLF of the coding block into a separate IP data packet.
  • the encapsulating the CRLF chunk-size CRLF of the coding block into the IP data packet comprises: encapsulating the CRLF chunk-size CRLF of the coding block into a previous IP data packet.
  • the IP data packet length is not greater than a maximum transmission unit.
  • the invention also provides an HTTP chunked encoding and an IP packet parsing method, including:
  • the receiving end receives the IP data packet obtained by using the HTTP chunked encoding and the IP packet encapsulation method; parses the obtained payload of the first IP data packet into an HTTP response header, and for a subsequent IP data packet, the payload is greater than 188 words.
  • the IP packet of the section is parsed into the TS data to be transmitted, and the IP packet whose payload is not more than 188 bytes and whose character string "CRLF 0 CRLF" is parsed is parsed as the end of the transmission.
  • An advantage of the present invention is that the method of the present invention can improve the parsing efficiency of transmitting data using HTTP chunked encoding and improve the overall performance of the media processing related device.
  • the transmission of TS data includes two stages of IP packet encapsulation and IP packet parsing, which are respectively described below.
  • the IP packet encapsulation of the TS data is completed at the transmitting end.
  • a specific HTTP chunked encoding method is adopted. Referring to FIG. 1, the following steps are included:
  • Step 101 the receiving end sends an HTTP request to the sending end
  • Step 102) the sender encapsulates the HTTP response header into the first IP data packet, and sends the HTTP response packet to the receiving end, and then encapsulates the TS data to be transmitted into a plurality of coding blocks (chunk) according to an integer multiple of 188 bytes.
  • the IP data packet refers to an IP packet whose TCP payload is not empty;
  • Step 103 the sender encapsulates the string "CRLF chunk-size CRLF" into a separate IP packet. And sent to the receiving end;
  • the packet length is not greater than the MTU (maximum transmission unit);
  • 9400 bytes of chunk-data are encapsulated into 8 IP packets, the first 7 IP packet payloads are assigned to 1316 (7*188) bytes, and the 8th IP packet payload is 188 bytes.
  • Step 105 the transmitting end repeatedly performs step 103) and step 104), until the encoded block obtained in step 102) is sent, and finally the string "CRLF O CRLF" is encapsulated into an IP data packet and sent.
  • the string "CRLF chunk-size CRLF" is encapsulated into a separate IP packet.
  • the previous IP packet can carry the next "CRLF chunk-size CRLF". For example, 2632 bytes of TS data is encapsulated into two chunk-data, the first chunk-data is 1316 bytes, and the second chunk-data is 1316 bytes.
  • piggyback schemes There are at least two piggyback schemes:
  • the first scheme The first IP packet payload on the sender is the HTTP response header, the second IP packet payload is "CRLF 524 CRLF", and the third IP packet is 1316 bytes TS data piggybacked with "CRLF 524" CRLF", the 4th IP packet is 1316 bytes TS data with "CRLF 0 CRLF CRLF”;
  • the second scheme the first IP packet payload on the sender is the HTTP response header with "CRLF 524 CRLF”, the second IP packet is 1316 bytes TS data with "CRLF 524 CRLF”, the third IP data.
  • the packet is 1316 bytes of TS data with "CRLF 0 CRLF CRLF”.
  • the IP packet encapsulation parsing is done at the receiving end. Referring to Figure 2, the following steps are included:
  • Step 201 the receiving end receives the IP data packet
  • Step 202 determining whether the received IP data packet is the first IP data packet, and if yes, parsing the IP data packet into a header of the HTTP response, and then performing step 201) again; otherwise, performing the next step;
  • Step 203 determining whether the payload of the received IP data packet is greater than 188 bytes, and if yes, parsing the IP data packet into TS data, and then performing step 201) again; otherwise, performing the next step;
  • Step 204 determining whether the received IP data packet starts with the string "CRLF O CRLF", and if so, parsing the data transmission end, otherwise, discarding the IP data packet, and then performing step 201).

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Communication Control (AREA)

Abstract

本发明涉及一种HTTP chunked编码和IP包封装方法,包括:发送端将HTTP响应头部封装到第一个IP数据包中;将所要传输的TS数据按照188字节的整数倍封装到若干编码块中,对任一所述编码块,将所述编码块的"CRLF chunk-size CRLF"封装到IP 数据包中,将所述编码块的"chunk-data"根据需要按照188字节的整数倍进行切分并将切分后的结果分别封装到若干个IP数据包中。

Description

HTTP chunked编翻 IP包趣、 解析方法
技术领域
本发明涉及网络传输领域, 特别涉及一种 HTTP chunked编码和 IP包封装、解析方 法。 背景技术
HTTP 协议的消息格式包含消息首部和消息体。 消息首部部分定义了一些属性字 段, 向报文接收者提供了重要的信息。 其中, Content-Length 属性字段表示消息体的长 度, 便于数据接收过程的编程实现。 然而, 对于某些动态生成的数据, 消息生成者可能 无法立即知悉消息体的总长度, 从而不能及时计算 Content-Length 字段值。 使用 chunked编码可以回避这一问题。 Chunked 是 HTTP/1.1 协议的一种传输编码方式, 将 待传输数据切割为多个部分,报文只需在提供每个部分的长度。编码后的消息体一组连 续的编码块(chunk) , 每个编码块包含了传输数据块 (chunk-data) 及其长度 (chunk-size), 格式定义如下:
chunk = chunk-size [ chunk-extension ] CRLF chunk-data CRLF
其中, chunk-size是 chunk-data的长度, 为十六进制字符串。 CRLF为双字节换行 符, 其 ASCII码值为 OxOd 0x0a。可选的 chunk-extension格式用一组" name = value"字段 组成, 但 RFC2616未对这些字段进行定义, 并规定接收者忽略不能识别的字段。
在有线电视视频点播系统、 互联网视频系统中, 媒体内容尤其是在线视频, 通常采 用 HTTP chunked编码进行分发和传输, HTTP chunked编码数据接收端需要按照 chunked 编码格式进行解析。 由于视频媒体具有数据量大、 传输时间长的特点, chunked数据解 析过程的效率对于媒体处理的整体性能至关重要。现有技术中, 对 chunked数据的解析 通常采用字符串匹配的方式, 即通过匹配 "CRLF "字符串依次解析出 HTTP 头部、 chunk-size, 但采用字符串匹配的方式解析 chunked数据具有效率低下等缺陷。 发明内容
本发明的目的在于克服现有技术中的 HTTP chunked数据解析方法效率低下的缺 陷, 从而提供一种高效的编码和封装、 解析方法。
为了实现上述目的,本发明提供了一种 HTTP chunked编码和 IP包封装方法,包括: 发送端将 HTTP响应头部封装到第一个 IP数据包中;
将所要传输的 TS数据按照 188字节的整数倍封装到若干编码块中, 对任一所述编 码块, 将所述编码块的 "CRLF chunk-size CRLF "封装到 IP数据包中, 将所述编码块 的 "chunk-data"根据需要按照 188字节的整数倍进行切分并将切分后的结果分别封装 到若干个 IP数据包中。
上述技术方案中, 所述将所述编码块的 "CRLF chunk-size CRLF"封装到 IP数据 包中包括: 将所述编码块的 "CRLF chunk-size CRLF"封装到一独立 IP数据包中。
上述技术方案中, 所述将所述编码块的 "CRLF chunk-size CRLF"封装到 IP数据 包中包括: 将所述编码块的 "CRLF chunk-size CRLF"封装到前一个 IP数据包中。
上述技术方案中, 所述 IP数据包长度不大于最大传输单元。
本发明还提供了一种 HTTP chunked编码和 IP包解析方法, 包括:
接收端接收采用所述 HTTP chunked编码和 IP包封装方法得到的 IP数据包; 将所得到的第一个 IP数据包的载荷解析为 HTTP响应头部, 对于后续 IP数据包, 将载荷大于 188字节的 IP数据包解析为所要传输的 TS数据,将载荷不大于 188字节而 且以字符串 "CRLF 0 CRLF"开头的 IP数据包解析为传输结束。
本发明的优点在于- 采用本发明的方法能够提高采用 HTTP chunked编码传输数据的解析效率, 提高媒 体处理相关设备的整体性能。
附图说明
图 1是本发明的 IP包封装过程的交互流程图;
图 2是本发明的 IP包解析方法的流程图。 具体实施方式
现结合附图对本发明作进一步的描述。
对 TS数据的传输包括 IP包封装与 IP包解析两个阶段, 下面分别予以说明。
对 TS数据的 IP包封装在发送端完成, 在 IP包封装过程中, 采用了特定的 HTTP chunked编码方式, 参考图 1, 包括以下步骤:
步骤 101 )、 接收端向发送端发送 HTTP请求;
步骤 102)、发送端将 HTTP响应头部封装到第一个 IP数据包中,并发送到接收端, 然后将所要传输的 TS数据按照 188字节的整数倍封装到若干编码块(chunk)中; 所述 IP数据包指 TCP载荷不为空的 IP包;
步骤 103 )、 发送端将字符串 "CRLF chunk-size CRLF"封装到独立 IP数据包中, 并发送到接收端;
步骤 104)、 发送端将传输数据块 (chunk-data)按照 188字节的整数倍进行切分, 将 切分后的结果分别封装到若干个 IP数据包中, 然后依次发送出去; 所述 IP数据包长度 不大于 MTU (最大传输单元);
例如, 9400字节的 chunk-data被封装到 8个 IP数据包中, 前 7个 IP数据包载荷分 配为 1316 (7*188) 字节, 第 8个 IP数据包载荷为 188字节。
步骤 105 )、 发送端重复执行步骤 103 )和步骤 104), 直到步骤 102) 中封装得到的 编码块都发送完毕, 最后将字符串 "CRLF O CRLF "封装到一 IP数据包中, 并发送。
在上述描述的步骤 103 ) 中, 所述字符串 "CRLF chunk-size CRLF"封装到一独立 IP数据包中。 作为一种优选方式, 为了减少发送端发送 IP数据包的个数, 上一个 IP数 据包可捎带下一个 "CRLF chunk-size CRLF"。 例如, 2632字节的 TS数据封装为两个 chunk-data, 第一个 chunk-data为 1316字节, 第二个 chunk-data为 1316字节, 至少存 在 2种捎带方案:
第一种方案: 发送端第 1个 IP数据包载荷为 HTTP响应头部, 第 2个 IP数据包载 荷为" CRLF 524 CRLF ",第 3个 IP数据包为 1316字节 TS数据捎带" CRLF 524 CRLF", 第 4个 IP数据包为 1316字节 TS数据捎带 "CRLF 0 CRLF CRLF";
第二种方案: 发送端第 1 个 IP 数据包载荷为 HTTP 响应头部捎带 "CRLF 524 CRLF", 第 2个 IP数据包为 1316字节 TS数据捎带 "CRLF 524 CRLF ", 第 3个 IP数 据包为 1316字节 TS数据捎带 "CRLF 0 CRLF CRLF"。 对 IP包封装解析在接收端完成, 参考图 2, 包括以下步骤:
步骤 201 )、 接收端接收 IP数据包;
步骤 202)、 判断所接收的 IP数据包是否为第一个 IP数据包, 若是, 将该 IP数据 包解析为 HTTP响应的头部, 然后重新执行步骤 201 ), 否则, 执行下一步;
步骤 203 )、判断所接收 IP数据包的载荷是否大于 188字节, 若是, 将该 IP数据包 解析为 TS数据, 然后重新执行步骤 201 ), 否则, 执行下一步;
步骤 204)、 判断所接收 IP数据包是否以字符串 "CRLF O CRLF"开头, 若是, 解 析为数据传输结束, 否则, 丢弃该 IP数据包, 然后重新执行步骤 201 )。
最后所应说明的是, 以上实施例仅用以说明本发明的技术方案而非限制。尽管参照 实施例对本发明进行了详细说明,本领域的普通技术人员应当理解, 对本发明的技术方 案进行修改或者等同替换, 都不脱离本发明技术方案的精神和范围, 其均应涵盖在本发 明的权利要求范围当中。

Claims

1、 一种 HTTP chunked编码和 IP包封装方法, 包括: 发送端将 HTTP响应头部封装到第一个 IP数据包中; 将所要传输的 TS数据按照 188字节的整数倍封装到若干编码块中, 对任一所述编 码块, 将所述编码块的 "CRLF chunk-size CRLF "封装到 IP数据包中, 将所述编码块 的 "chunk-data"根据需要按照 188字节的整数倍进行切分并将切分后的结果分别封装 到若干个 IP数据包中。
2、 根据权利要求 1所述的 HTTP chunked编码和 IP包封装方法, 其特征在于, 所 述将所述编码块的 "CRLF chunk-size CRLF "封装到 IP数据包中包括: 将所述编码块 的 "CRLF chunk-size CRLF"封装到一独立 IP数据包中。
3、 根据权利要求 1所述的 HTTP chunked编码和 IP包封装方法, 其特征在于, 所 述将所述编码块的 "CRLF chunk-size CRLF "封装到 IP数据包中包括: 将所述编码块 的 "CRLF chunk-size CRLF"封装到前一个 IP数据包中。
4、 根据权利要求 1所述的 HTTP chunked编码和 IP包封装方法, 其特征在于, 所 述 IP数据包长度不大于最大传输单元。
5、 一种 HTTP chunked编码和 IP包解析方法, 包括: 接收端接收采用权利要求 1-4之一所述方法得到的 IP数据包; 将所得到的第一个 IP数据包的载荷解析为 HTTP响应头部, 对于后续 IP数据包, 将载荷大于 188字节的 IP数据包解析为所要传输的 TS数据,将载荷不大于 188字节而 且以字符串 "CRLF 0 CRLF"开头的 IP数据包解析为传输结束。
PCT/CN2014/081425 2014-01-09 2014-07-01 HTTP chunked编码和IP包封装、解析方法 WO2015103856A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410010554.X 2014-01-09
CN201410010554.XA CN104780182B (zh) 2014-01-09 2014-01-09 HTTP chunked编码和IP包封装、解析方法

Publications (1)

Publication Number Publication Date
WO2015103856A1 true WO2015103856A1 (zh) 2015-07-16

Family

ID=53523510

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/081425 WO2015103856A1 (zh) 2014-01-09 2014-07-01 HTTP chunked编码和IP包封装、解析方法

Country Status (2)

Country Link
CN (1) CN104780182B (zh)
WO (1) WO2015103856A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108270740A (zh) * 2016-12-30 2018-07-10 上海华讯网络系统有限公司 对含有多路视频流的视频会议的直播系统和方法
CN112187858B (zh) * 2020-08-24 2023-04-18 浙江百应科技有限公司 一种匹配管线式http请求与响应的方法

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101345595A (zh) * 2008-08-26 2009-01-14 国家广播电影电视总局广播科学研究院 一种基于广播信道传输内容标引的系统及方法
CN102752320A (zh) * 2012-08-03 2012-10-24 北京光泽时代通信技术有限公司 一种代理服务器主动压缩方法及代理服务器
CN102821311A (zh) * 2012-05-30 2012-12-12 浙江宇视科技有限公司 一种视频数据包优先级设置方法和装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101345595A (zh) * 2008-08-26 2009-01-14 国家广播电影电视总局广播科学研究院 一种基于广播信道传输内容标引的系统及方法
CN102821311A (zh) * 2012-05-30 2012-12-12 浙江宇视科技有限公司 一种视频数据包优先级设置方法和装置
CN102752320A (zh) * 2012-08-03 2012-10-24 北京光泽时代通信技术有限公司 一种代理服务器主动压缩方法及代理服务器

Also Published As

Publication number Publication date
CN104780182A (zh) 2015-07-15
CN104780182B (zh) 2018-05-22

Similar Documents

Publication Publication Date Title
JP6422527B2 (ja) マルチメディアシステムにおけるデータ受信方法及び装置
US11553066B2 (en) Apparatus for transmitting broadcast signal, apparatus for receiving broadcast signal, method for transmitting broadcast signal and method for receiving broadcast signal
WO2019233310A1 (zh) 一种待配网设备接入网络热点设备的方法和装置
US9392082B2 (en) Communication interface and method for robust header compression of data flows
CN110049353B (zh) 用于在广播系统中传输多媒体数据的装置及方法
TW200849900A (en) Compression of data packets while maintaining endpoint-to-endpoint authentication
KR100996014B1 (ko) 무선 네트워크들에서 시스템 정보 메시지들을프래그먼트하기 위한 방법들 및 장치
JP2005027325A (ja) Rtpペイロード形式
KR101764636B1 (ko) 방송 신호 송/수신 처리 방법 및 장치
EP1676216B1 (en) Embedding a session description (SDP) message in a real-time control protocol (RTCP) message
WO2015101152A1 (zh) 基于dfa的http分块传输编码的传输载荷提取方法
WO2015103856A1 (zh) HTTP chunked编码和IP包封装、解析方法
CN102724133A (zh) 一种ip报文传输的方法及装置
CN114979093B (zh) 一种基于rtp的数据传输方法、装置、设备和介质
CN103313045A (zh) 宽带多媒体集群系统调度台h.264视频分包方法
JP2023021166A (ja) 送信方法および受信装置
CN109587157B (zh) 一种基于公交车物联网通讯协议的通讯方法
CN114979092B (zh) 一种基于rtp的数据传输方法、装置、设备和介质
WO2017113342A1 (zh) 数据包传输方法及装置
CN108881114A (zh) 一种用于stl/sfn传输的rtp协议封装方法
Downs et al. RTP Payload Format for Society of Motion Picture and Television Engineers (SMPTE) ST 336 Encoded Data
Downs et al. RFC 6597: RTP Payload Format for Society of Motion Picture and Television Engineers (SMPTE) ST 336 Encoded Data

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14878028

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14878028

Country of ref document: EP

Kind code of ref document: A1