WO2014085959A1 - 批量文件传输方法及设备 - Google Patents

批量文件传输方法及设备 Download PDF

Info

Publication number
WO2014085959A1
WO2014085959A1 PCT/CN2012/085740 CN2012085740W WO2014085959A1 WO 2014085959 A1 WO2014085959 A1 WO 2014085959A1 CN 2012085740 W CN2012085740 W CN 2012085740W WO 2014085959 A1 WO2014085959 A1 WO 2014085959A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
identifier
http response
index
files
Prior art date
Application number
PCT/CN2012/085740
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 华为技术有限公司
Priority to CN201280002902.8A priority Critical patent/CN103229486B/zh
Priority to PCT/CN2012/085740 priority patent/WO2014085959A1/zh
Publication of WO2014085959A1 publication Critical patent/WO2014085959A1/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/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
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Definitions

  • the present invention relates to communication technologies, and in particular, to a batch file transmission method and device. Background technique
  • Hypertext transfer protocol is a communication protocol between hypermedia system applications.
  • the device that initiates the HTTP request (Request) is the client client, and the device that receives the HTTP request and responds (Response) is the Web server.
  • the HTTP request sent to the web server carries the parameter information such as the identifier of the file to be acquired, and after the web server receives the HTTP request, according to the file
  • the identifier and other parameters obtain the length of the corresponding file, the file length is used as the header field information of the HTTP response, and the content of the file is used as the data domain information of the HTTP response, and the HTTP response is sent to the client.
  • the client sends an HTTP request every time a file is requested. Accordingly, the web server returns the requested file via an HTTP response.
  • Embodiments of the present invention provide a batch file transmission method and device, so as to implement transmission of at least two files in an HTTP transmission, thereby improving transmission efficiency and reducing system overhead.
  • an embodiment of the present invention provides a batch file transmission method, including:
  • the HTTP request carries a file object identifier for indicating a file to be obtained, and the number of the files to be acquired is at least two;
  • the header field of the first HTTP response carries the first split identifier information
  • the parsing the first HTTP response to obtain the at least two files to be obtained including:
  • the first segment identifies the at least two data blocks divided, and the file to be acquired is extracted from each of the data blocks.
  • the header field of the first HTTP response further carries second split identifier information, where each of the data blocks includes An index, the to-be-obtained file, and verification information;
  • Extracting the to-be-obtained file from each of the data blocks includes:
  • the index, the to-be-obtained file, and the verification information are verified by the verification information, and if the verification is successful, the to-be-obtained file and the index are saved. .
  • each of the data blocks includes an index, the to-be-obtained file, and check information
  • Extracting the to-be-obtained file from each of the data blocks including:
  • the method for transmitting a batch file further includes:
  • an embodiment of the present invention provides a batch file transmission method, including:
  • Determining at least two files to be acquired according to the file object identifier acquiring a first segmentation identifier, generating a first HTTP response according to the at least two to-be-obtained files and the first segmentation identifier, and sending the first HTTP response
  • the data field of the first HTTP response carries at least two data blocks, and each two data blocks are divided by the first split identifier, and each of the data blocks includes one The file to be obtained.
  • the generating the first HTTP response according to the at least two to-be-obtained files and the first split identifier includes:
  • the generating the data block according to each of the to-be-obtained files includes:
  • the generating the first HTTP response according to the at least two to-be-obtained files and the first split identifier further includes:
  • the generating the data block according to each of the to-be-obtained files includes:
  • the method for transmitting a batch file further includes:
  • an embodiment of the present invention provides a client, including:
  • a requesting unit configured to send a first hypertext transfer protocol HTTP request to the web server, where the first HTTP request carries a file object identifier for indicating a file to be acquired, and the number of the to-be-obtained files is at least two ;
  • a receiving unit configured to receive a first HTTP response sent by the web server according to the file object identifier, where the data domain of the first HTTP response carries at least two data blocks, between each two data blocks Segmentation by a first segmentation identifier, each of the data blocks including one of the files to be acquired;
  • the parsing unit is connected to the receiving unit, and configured to parse the first HTTP response to obtain the at least two files to be acquired.
  • the header field of the first HTTP response carries the first split identifier information
  • the parsing unit is configured to determine, according to the first split identifier information in the header field of the first HTTP response, the first split identifier, according to the first split identifier from the first HTTP response Extracting, by the data field, the at least two data blocks divided by the first segmentation identifier, and extracting the to-be-obtained file from each of the data blocks.
  • the header field of the first HTTP response further carries second split identifier information, where each of the data blocks includes An index, the to-be-obtained file, and verification information;
  • the parsing unit is configured to determine, according to the second split identifier information in the header field of the first HTTP response, a second split identifier, and extract, according to the second split identifier, from each of the data blocks.
  • the index of the second segmentation identifier, the file to be acquired, and the verification information are verified by the verification information, and if the verification is successful, the Get the file and save the index.
  • each of the data blocks includes an index, the to-be-obtained file, and verification information
  • the parsing unit is specifically configured to obtain an index length and a check information length, and sequentially extract the index, the check information, and the location from each of the data blocks according to the index length and the check information length.
  • the file to be obtained is checked by the verification information, and if the verification is successful, the file to be acquired and the index are saved.
  • the requesting unit is further configured to: if the verification fails or not in the data domain of the first HTTP response And identifying the end identifier, sending a second HTTP request to the web server, where the second HTTP request carries an index of the file to be acquired that is successfully verified by the last one;
  • the receiving unit is further configured to receive a second HTTP response sent by the web server, where the data domain of the second HTTP response carries at least one data block, and each of the data blocks includes an unsuccessfully received Pending documents;
  • the parsing unit is further configured to parse the second HTTP response to obtain the unsuccessfully received file to be acquired.
  • an embodiment of the present invention provides a web server, including:
  • a receiving unit configured to receive a first hypertext transfer protocol HTTP request sent by the client, where the first HTTP request carries a file object identifier for indicating a file to be acquired, where the number of the to-be-obtained files is at least two One
  • a processing unit configured to be connected to the receiving unit, configured to determine, according to the file object identifier, at least two files to be acquired, obtain a first segmentation identifier, and generate a first according to the at least two files to be acquired and the first segmentation identifier ⁇ HTTP response, where the data field of the first HTTP response Carrying at least two data blocks, each of which is divided by the first segmentation identifier, and each of the data blocks includes one file to be acquired;
  • a sending unit connected to the processing unit, configured to send the first HTTP response to the client.
  • the processing unit is configured to generate, according to the first split identifier, first split identifier information, and carry the first split identifier information in the first HTTP response.
  • the data block is generated according to each of the to-be-obtained files, and the first segmentation identifier is inserted between every two of the data blocks to form a data domain of the first HTTP response.
  • the processing unit is further configured to obtain an index of the to-be-obtained file for each of the to-be-obtained files, according to the Deleting the file to generate the verification information, acquiring the second segmentation identifier, inserting the second segmentation identifier between the index and the to-be-obtained file, and inserting between the to-be-obtained file and the verification information Generating, by the second segmentation identifier, the data block; generating, by the second segmentation identifier, second segmentation identifier information, and carrying the second segmentation identifier information in a header field of the first HTTP response.
  • the processing unit is further configured to obtain an index of the to-be-obtained file for each of the to-be-obtained files, according to the Deleting the file to generate the verification information, and the index, the verification information, and the to-be-obtained file are sequentially arranged to form the data block, wherein each of the indexes of the to-be-obtained file has the same length, each The lengths of the verification information of the file to be acquired are equal.
  • the receiving unit is further configured to receive a second HTTP request sent by the client, where The second HTTP request carries an index of the file to be acquired that is successfully verified by the last one;
  • the processing unit is further configured to: determine, according to the index of the file to be acquired that the verification is successful, the at least one unsuccessfully received file to be acquired, and generate the file according to the at least one unsuccessfully received file to be acquired and the first segmentation identifier.
  • a second HTTP response where the data field of the second HTTP response carries at least one data block, and each of the data blocks includes an unsuccessfully received file to be acquired;
  • an embodiment of the present invention provides a computer node for a client, where the computing node includes a processor, a communication interface, a memory, and a bus:
  • processor, the communication interface and the memory complete communication with each other through a bus
  • the communication interface is configured to send a first hypertext transfer protocol HTTP request to the web server, where the first HTTP request carries a file object identifier for indicating a file to be acquired, and the number of the to-be-obtained file is At least two; receiving a first HTTP response sent by the web server according to the file object identifier, where the data field of the first HTTP response carries at least two data blocks, and each two data blocks pass between Separating the first segmentation identifier, each of the data blocks includes one of the files to be acquired;
  • the processor is configured to execute a program
  • the memory is configured to store the program
  • the program is configured to parse the first HTTP response to obtain the at least two files to be acquired.
  • the header field of the first HTTP response carries the first split identifier information
  • the program is specifically configured to determine, according to the first split identifier information in the header field of the first HTTP response, the first split identifier, and the data from the first HTTP response according to the first split identifier Extracting, by the domain, the at least two data blocks divided by the first segmentation identifier, and extracting the to-be-obtained file from each of the data blocks.
  • the header field of the first HTTP response further carries second split identifier information, where each of the data blocks includes An index, the to-be-obtained file, and verification information;
  • the program is specifically configured to determine a second split identifier according to the second split identifier information in a header field of the first HTTP response, and extract a pass from each of the data blocks according to the second split identifier.
  • the index of the second segmentation identifier segmentation, the file to be acquired, and the verification information are verified by the verification information, and if the verification is successful, the to-be-obtained The file and the index are saved.
  • each of the data blocks includes an index, the to-be-obtained file, and check information;
  • the program is specifically configured to obtain an index length and a check information length, and sequentially extract the index, the check information, and the foregoing from each of the data blocks according to the index length and the check information length.
  • the file to be obtained is checked by the verification information, and if the verification is successful, the file to be acquired and the index are saved.
  • the communication interface is further configured to: if the verification fails or not in the data domain of the first HTTP response After the end identifier is identified, the second HTTP request is sent to the web server, where the second HTTP request carries an index of the file to be acquired that is successfully verified by the last one; and receives the second HTTP sent by the web server.
  • the data field of the second HTTP response carries at least one data block, and each of the data blocks includes an unsuccessfully received file to be acquired;
  • the program is further configured to parse the second HTTP response to obtain the unsuccessfully received file to be acquired.
  • an embodiment of the present invention provides a computer node for a Web server, where the computing node includes a processor, a communication interface, a memory, and a bus:
  • processor, the communication interface and the memory complete communication with each other through a bus
  • the communication interface is configured to receive a first hypertext transfer protocol HTTP request sent by the client, where the first HTTP request carries a file object identifier for indicating a file to be acquired, and the number of the to-be-obtained file is At least two; sending a first HTTP response to the client; the processor, configured to execute a program;
  • the memory is configured to store the program
  • the program is configured to determine, according to the file object identifier, at least two files to be acquired, obtain a first segmentation identifier, and generate the first HTTP response according to the at least two to-be-obtained files and the first segmentation identifier.
  • the data field of the first HTTP response carries at least two data blocks, and each of the two data blocks is divided by the first split identifier, and each of the data blocks includes one file to be acquired. .
  • the program is specifically configured to generate first split identifier information according to the first split identifier, and carry the first split identifier information in a header of the first HTTP response In the domain, generating the data block according to each of the to-be-obtained files, in each of the two Inserting the first segmentation identifier between the data blocks to form a data domain of the first HTTP response.
  • the program is further configured to obtain an index of the to-be-obtained file for each of the to-be-obtained files, according to the And the second segmentation identifier is inserted between the index and the to-be-obtained file, and the file is inserted between the to-be-obtained file and the verification information.
  • Generating the second segment identifier generating the data block; generating second segment identifier information according to the second segment identifier, and carrying the second segment header information in a header field of the first HTTP response.
  • the program is further configured to obtain an index of the to-be-obtained file for each of the to-be-obtained files, according to the The file to be obtained is generated by the file to be obtained, and the index, the check information, and the file to be obtained are sequentially arranged to form the data block, wherein the length of each index of the file to be obtained is equal, each The length of the check information of the file to be obtained is equal.
  • the communications interface is further configured to receive a second HTTP request sent by the client, where The second HTTP request carries an index of the file to be acquired that is successfully verified by the last one; and sends a second HTTP response to the client.
  • the program is further configured to: determine, according to the index of the file to be acquired that the verification is successful, at least one unsuccessfully received file to be acquired, according to the at least one unsuccessfully received file to be acquired and the first segmentation identifier
  • the second HTTP response where the data field of the second HTTP response carries at least one data block, and each of the data blocks includes a file to be acquired that is not successfully received.
  • the client sends a first hypertext transfer protocol HTTP request to the web server, where the first HTTP request carries a file object identifier for indicating the file to be acquired, and the file to be obtained is obtained.
  • the number of the packets is at least two, and receives a first HTTP response sent by the web server, where the data field of the first HTTP response carries at least two data blocks, and each of the two data blocks is divided by the first segmentation identifier, and each The data block includes a file to be acquired, and parses the first HTTP response to obtain at least two files to be acquired.
  • the HTTP request sent by the client to the web server carries the file object identifier for indicating at least two files, and correspondingly, the HTTP response returned by the web server to the client includes
  • the first segmentation identifies at least two files divided, and at least two files are transmitted in one HTTP transmission, which improves transmission efficiency and reduces system overhead.
  • FIG. 1 is a flowchart of a first batch file transmission method according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of a network application scenario according to an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of a data domain structure of a first HTTP response according to an embodiment of the present invention
  • FIG. 4 is a schematic diagram of a data domain structure of a second HTTP response according to an embodiment of the present invention
  • FIG. Response structure diagram ;
  • FIG. 6 is a schematic structural diagram of a first data block according to an embodiment of the present invention.
  • FIG. 7 is a schematic structural diagram of a second data block according to an embodiment of the present disclosure.
  • FIG. 8 is a flowchart of a second batch file transmission method according to an embodiment of the present invention.
  • FIG. 9 is a flowchart of a third batch file transmission method according to an embodiment of the present invention.
  • FIG. 10 is a flowchart of a fourth batch file transmission method according to an embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of a client according to an embodiment of the present disclosure.
  • FIG. 12 is a schematic structural diagram of a web server according to an embodiment of the present disclosure.
  • FIG. 13 is a schematic structural diagram of a computer node for a client according to an embodiment of the present invention
  • FIG. 14 is a schematic structural diagram of a computer node for a web server according to an embodiment of the present invention.
  • the technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention.
  • the embodiments are a part of the embodiments of the invention, and not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
  • FIG. 1 is a flowchart of a first batch file transmission method according to an embodiment of the present invention. As shown in FIG.
  • the batch file transmission method provided in this embodiment may be applied to a network application scenario based on HTTP transmission, in particular, an application scenario for performing large-scale data transmission across the Internet, as shown in FIG. 2 , in the application scenario.
  • the web server 82 and the plurality of clients 81 are included.
  • the communication between the client 81 and the web server 82 is based on HTTP.
  • the batch file transfer method provided by this embodiment can be implemented by a client client, and the client can be implemented by an electronic device with data processing capability such as a personal computer, a notebook computer, a tablet computer, a smart phone, or a server.
  • Step C10 Send a first hypertext transfer protocol HTTP request to the web server, where the first HTTP request carries a file object identifier for indicating a file to be acquired, and the number of the to-be-obtained files is at least two;
  • HTTP is an application layer protocol running on the TCP (Transmission Control Protocol).
  • TCP Transmission Control Protocol
  • the client first initiates a TCP connection request to the Web server to establish a TCP connection with the Web server. After the TCP connection is established, the client communicates with the Web server through a TCP connection.
  • the client sends a first HTTP request to the web server.
  • the first HTTP request includes a header field and a data domain.
  • the header field may include multiple header information.
  • the header information is Specifically, it can be divided by the carriage return, and the header field and the data domain can be divided by blank lines.
  • the file object identifier is specifically used to indicate the file that the client needs to obtain, that is, the file to be acquired, and the number of files to be acquired is at least two.
  • the client may request to obtain all files in a directory in the web server, and the file object identifier may be the name of the directory, or the client may request to obtain all files generated by the web server in a certain time range. , the file object identifier can be the time range.
  • the client may not know the number of files requested and the name of the file. If the user selects a certain file in the web server through the client, the file object identifier may be the file name of the file.
  • the file object identifier may be specifically set according to actual conditions, and is not limited to this embodiment.
  • the file object identifier may be carried in the header field of the first HTTP request in the form of header information, or may be carried in the first HTTP request data field.
  • the web server receives the first HTTP request, parses the first HTTP request, extracts the file object identifier from the first HTTP request, and determines the file to be acquired according to the file object identifier.
  • the web server obtains a first split identifier (Block Splitter), and the first split identifier may be pre-generated by using a preset algorithm, and the web server may generate the first split by using a preset algorithm after receiving the first HTTP request.
  • logo The first segmentation identifier may be a random number, such as a Universally Unique Identifier (UUID), or a combination of multiple UUIDs.
  • UUID Universally Unique Identifier
  • the first segmentation identifier may be generated by using other preset methods to ensure that the complexity of the generated first segmentation identifier is different from the file to be obtained, which is not limited to the embodiment. If the first segmentation identifier is pre-generated, the client may pre-arrange through the network protocol, so that the client can identify the first segmentation identifier. If the first segmentation identifier is generated by the web server in real time, the web server may carry header information indicating the first segmentation identifier in a header field of the first HTTP response sent to the client.
  • the web server generates a data block containing the file to be obtained according to the file to be obtained. For example, if the number of files to be obtained is ⁇ , ⁇ is an integer and ⁇ 2, the number of generated data blocks is also ⁇ .
  • the data block may further include other information related to the file to be acquired, such as an index, length information, or verification information, or may include only the file to be acquired.
  • the web server inserts a first segmentation identifier between every two data blocks, that is, the data blocks are divided by the first segmentation identifier to form a data field of the first HTTP response, as shown in FIG.
  • a first split identifier may be inserted in the header of the data field, and a first split identifier may be inserted at the end of the data domain.
  • the end of the data domain may also be inserted with an end identifier to indicate The data field ends.
  • the end identifier can be, for example, two consecutive carriage returns.
  • the web server sends the first HTTP response to the client.
  • Step C20 Receive a first HTTP response sent by the web server according to the file object identifier, where the data field of the first HTTP response carries at least two data blocks, and each of the two data blocks passes through a segmentation identifier segmentation, each of the data blocks includes one of the files to be acquired;
  • Step C30 Parse the first HTTP response to obtain the at least two files to be acquired.
  • the client receives the first HTTP response sent by the web server, parses the first HTTP response, and can identify each data by identifying the first segmentation identifier in the first HTTP response.
  • the blocks are extracted, and the files to be acquired in each data block are obtained.
  • the client sends a first hypertext transfer protocol HTTP request to the web server, where the first HTTP request carries a file object identifier for indicating the file to be acquired, and the number of files to be acquired is At least two, receiving a first HTTP response sent by the web server, where the data field of the first HTTP response carries at least two data blocks, and each of the two data blocks is divided by a first split identifier, and each data block
  • the file includes a file to be obtained, and parses the first HTTP response to obtain at least two files to be acquired.
  • the HTTP request sent by the client to the web server carries the file object identifier for indicating at least two files. Accordingly, the HTTP response returned by the web server to the client includes at least two files divided by the first split identifier. It realizes the transmission of at least two files in one HTTP transmission, which improves the transmission efficiency and reduces the system overhead.
  • the header field of the first HTTP response carries the first split identifier information.
  • step C30, parsing the first HTTP response, to obtain the at least two Obtaining a file may specifically include:
  • the first segment identifies the at least two data blocks divided, and the file to be acquired is extracted from each of the data blocks.
  • the format of the first HTTP response may be specifically referred to FIG. 5.
  • the header field of the first HTTP response carries a first split identifier header (Block Splitter Header), and the header field may also carry other header information (other headers).
  • the client may determine the first split identifier according to the first split identifier information in the header field of the first HTTP response.
  • the header field of the first HTTP response further carries the second split identifier information, where each of the data blocks includes an index, the to-be-obtained file, and check information.
  • the extracting the file to be obtained from each of the data blocks may include: determining, according to the second segmentation identifier information in the header field of the first HTTP response, a second segmentation identifier, according to the The second segmentation identifier extracts, from each of the data blocks, the index, the to-be-obtained file, and the verification information that are divided by the second segmentation identifier, and the to-be-obtained file is obtained by using the verification information.
  • the verification is performed, and if the verification is successful, the file to be acquired and the index are saved.
  • the data block generated by the web server according to the to-be-obtained file may include not only the to-be-obtained file, but also an index and verification information of the to-be-obtained file.
  • the index can be specifically the file name of the file to be obtained.
  • the serial number may be assigned to each file to be obtained, and the index may also be the serial number.
  • the verification information may be generated by using a preset check algorithm for the file to be obtained.
  • the preset check algorithm may be, but not limited to, an MD (Message Digest Algorithm) 5 or a SHA-1 (Secure Hash Algorithm). Abstract algorithm such as safe hash algorithm).
  • the Web server obtains a second split identifier (Inner Splitter), and the method for generating the second split identifier may be referred to the manner in which the first split identifier is generated, and details are not described herein.
  • the web server generates a second split identifier header ( Inner Splitter Header) according to the second split identifier, and divides the index, the file to be acquired, and the check information by the second split identifier, the index, the order of the file to be acquired, and the check information. Can be arranged according to preset rules. One implementation is shown in Figure 6.
  • the client may first determine the second segmentation identifier according to the second segmentation identifier information in the header field of the first HTTP response, and identify the second segmentation identifier of the data block. And extracting the index, the file to be obtained, and the verification information respectively, and checking the file to be obtained by using the verification information. If the verification is successful, the file to be obtained and the index may be correspondingly saved, and if the verification fails, the The web server retrieves the file again.
  • each of the data blocks includes an index, the to-be-obtained file, and the verification information.
  • the extracting the to-be-obtained file from each of the data blocks may include:
  • the length of the index of each file to be acquired is the same, and the length of the verification information of each file to be acquired is also the same.
  • the second partition identifier may not be included in the data block to save transmission bandwidth resources.
  • the index and verification information are arranged in front of the file to be acquired, as shown in FIG.
  • the client may segment the data block according to the length of the index and the length of the verification information to obtain an index, a verification information, and a file to be acquired, respectively.
  • the client checks the file to be obtained by using the verification information. If the verification is successful, the file to be acquired and the index may be saved correspondingly. If the test fails, you can retrieve the file from the web server.
  • FIG. 8 is a flowchart of a second batch file transmission method according to an embodiment of the present invention. As shown in FIG. 8, the batch file transmission method may further include:
  • Step C40 If the verification fails or the end identifier is not recognized in the data field of the first HTTP response, send a second HTTP request to the web server, where the second HTTP request carries the last school Check the index of the successfully acquired file;
  • Step C50 Receive a second HTTP response sent by the web server, where the data domain of the second HTTP response carries at least one data block, and each of the data blocks includes an unsuccessfully received file to be acquired.
  • Step C60 Parse the second HTTP response to obtain the to-be-obtained file that is not successfully received.
  • the client checks the file to be obtained by using the verification information. If the verification fails, it indicates that the file to be acquired is not successfully received due to network interruption or the like. Or there is no end identifier in the data field of the first HTTP response, indicating that the data field is not completely received.
  • the client may send a second HTTP request to the web server to obtain the unsuccessful received file.
  • the client may carry the tag information (Marker) in the second HTTP request, and the tag information may specifically be the index of the file to be acquired that is successfully verified by the last one.
  • the web server can learn the to-be-obtained file that the client has successfully received according to the tag information, and can also obtain the to-be-obtained file that the client has not successfully received, and pass the to-be-obtained file that the client has not successfully received through the second.
  • the HTTP response is returned to the client.
  • the format of the second HTTP response is the same as that of the first HTTP response, and is not described here.
  • the file name of the unsuccessful file can be determined according to the situation of the successfully received file.
  • the client can carry the file name in the second HTTP request to request the file that was not successfully received. By resuming the unsuccessfully received files, the amount of duplicate transmission and network bandwidth resources is reduced.
  • FIG. 9 is a flowchart of a third batch file transmission method according to an embodiment of the present invention.
  • the batch file transmission method provided in this embodiment may be implemented in conjunction with the method applied to the client according to any embodiment of the present invention. The specific implementation process is not described herein.
  • the batch file transfer method provided in this embodiment can be executed by a web server.
  • the batch file transmission method provided in this embodiment specifically includes: In step S10, the first hypertext transfer protocol HTTP request sent by the client is received, where the first HTTP request carries a file object identifier for indicating a file to be acquired, and the number of the to-be-obtained files is at least two;
  • Step S20 Determine at least two files to be acquired according to the file object identifier, obtain a first segmentation identifier, and generate an “HTTP response” according to the at least two to-be-obtained files and the first segmentation identifier, where the The data field of an HTTP response carries at least two data blocks, and each of the two data blocks is divided by the first partition identifier, and each of the data blocks includes one file to be acquired;
  • Step S30 Send the first HTTP response to the client.
  • the web server receives the first hypertext transfer protocol HTTP request sent by the client, where the first HTTP request carries a file object identifier for indicating the file to be acquired, and the number of files to be acquired And determining, by the at least two, the at least two files to be acquired according to the identifier of the file object, obtaining the first segmentation identifier, and generating a first HTTP response according to the at least two files to be acquired and the first segmentation identifier, where the data domain of the first HTTP response is The data carries at least two data blocks, and each of the two data blocks is divided by a first split identifier, and each data block includes a file to be acquired, and the first HTTP response is sent to the client.
  • the HTTP request sent by the client to the web server carries the file object identifier for indicating at least two files. Accordingly, the HTTP response returned by the web server to the client includes at least two files divided by the first split identifier. It realizes the transmission of at least two files in one HTTP transmission, which improves the transmission efficiency and reduces the system overhead.
  • step S20 the generating the first HTTP response according to the at least two to-be-obtained files and the first split identifier may include:
  • the generating the data block according to each of the to-be-obtained files may include:
  • Step S20 the generating the first HTTP response according to the at least two to-be-obtained files and the first split identifier, the method further includes:
  • the data block is generated according to each of the to-be-obtained files, and includes:
  • this embodiment provides a method for generating two types of data blocks, but a person skilled in the art uses other methods to generate a data block, so as to ensure that the client can extract the file to be obtained, which is not the embodiment. Limited.
  • FIG. 10 is a flowchart of a fourth batch file transmission method according to an embodiment of the present invention. As shown in FIG. 10, in this embodiment, the batch file transmission method may further include:
  • Step S40 Receive a second HTTP request sent by the client, where the second HTTP request carries an index of a file to be acquired that is successfully verified by the last one;
  • Step S50 Determine, according to the index of the file to be acquired that the verification is successful, at least one unsuccessfully received file to be acquired, and generate a second HTTP response according to the at least one unsuccessfully received file to be acquired and the first segmentation identifier.
  • the data field of the second HTTP response carries at least one data block, and each of the data blocks includes an unsuccessfully received file to be acquired.
  • Step S60 Send the second HTTP response to the Client.
  • FIG. 11 is a schematic structural diagram of a client according to an embodiment of the present invention.
  • the client 81 provided in this embodiment may implement various steps of the batch file transmission method applied to the client according to any embodiment of the present disclosure. The specific implementation process is not described herein.
  • the client 81 provided in this embodiment specifically includes a requesting unit 11, a receiving unit 12, and a parsing unit 13.
  • the requesting unit 11 is configured to send a first hypertext transfer protocol (HTTP) request to the web server, where the first HTTP request carries a file object identifier for indicating a file to be acquired, where the request is to be obtained.
  • the number of files is at least two.
  • the receiving unit 12 is configured to receive an “HTTP response” sent by the web server according to the file object identifier, where the data field of the “HTTP response” carries at least two data blocks, and each two data blocks The division is performed by a first division identifier, and each of the data blocks includes one of the files to be acquired.
  • the parsing unit 13 is connected to the receiving unit 12, and configured to parse the first HTTP response to obtain the at least two files to be acquired.
  • the requesting unit 11 sends a first hypertext transfer protocol HTTP request to the web server, where the first HTTP request carries a file object identifier for indicating the file to be acquired, and the number of files to be acquired is At least two, the receiving unit 12 receives the first HTTP response sent by the web server, where the data field of the first HTTP response carries at least two data blocks, and each two data blocks are divided by the first segmentation identifier, and each The data block includes a file to be acquired, and the parsing unit 13 parses the first HTTP response to obtain at least two files to be acquired.
  • the HTTP response returned by the web server to the client 81 includes at least two divided by the first split identifier.
  • the file realizes the transmission of at least two files in one HTTP transmission, which improves the transmission efficiency and reduces the system overhead.
  • the header field of the first HTTP response carries the first split identifier information.
  • the parsing unit 13 may be specifically configured to use according to the header field of the first HTTP response. Determining, by the first segmentation identifier information, the first segmentation identifier, and extracting, by the first segmentation identifier, the at least two data blocks segmented by the first segmentation identifier from a data domain of the first HTTP response Extracting the to-be-obtained file from each of the data blocks.
  • the header field of the first HTTP response further carries the second split identifier information, where the data block includes an index, the to-be-obtained file, and check information.
  • the parsing unit 13 Specifically, the second split identifier may be determined according to the second split identifier information in the header field of the first HTTP response, and the first partition identifier is extracted from each of the data blocks according to the second identifier.
  • the index of the two-division identifier segmentation, the file to be acquired, and the verification information are verified by the verification information, and if the verification is successful, the file to be acquired is The index is saved.
  • each of the data blocks includes an index, the to-be-obtained file, and check information.
  • the parsing unit 13 is specifically configured to obtain an index length and a check information length, according to the index length. And the length of the verification information, the index, the verification information, and the to-be-obtained file are sequentially extracted from each of the data blocks, and the to-be-obtained file is verified by the verification information, If the verification is successful, the file to be acquired and the index are saved.
  • the requesting unit 11 is further configured to send a second HTTP request to the web server if the verification fails or the end identifier is not identified in the data field of the first HTTP response, where The second HTTP request carries an index of the file to be acquired that is successfully verified by the last one.
  • the receiving unit 12 is further configured to receive a second HTTP response sent by the web server, where the data domain of the second HTTP response carries at least one data block, and each of the data blocks includes an unsuccessful reception.
  • the parsing unit 13 is further configured to parse the second HTTP response to obtain the unsuccessfully received file to be acquired.
  • FIG. 12 is a schematic structural diagram of a web server according to an embodiment of the present invention.
  • the Web server 82 provided in this embodiment may implement various steps of the batch file transmission method applied to the Web server according to any embodiment of the present invention. The specific implementation process is not described herein.
  • the web server 82 provided in this embodiment specifically includes a receiving unit 21, a processing unit 22, and a transmitting unit 23.
  • the receiving unit 21 is configured to receive a first hypertext transfer protocol HTTP request sent by the client, where the first HTTP request carries a file object identifier for indicating a file to be acquired, where the number of files to be acquired is At least two.
  • the processing unit 22 is connected to the receiving unit 21, and configured to determine, according to the file object identifier, at least two files to be acquired, and obtain a first segmentation identifier, according to the at least two files to be acquired and the first segmentation
  • the identifier generates a first HTTP response, where the data field of the first HTTP response carries at least two data blocks, and each of the two data blocks is divided by the first split identifier, and each of the data blocks includes One of the files to be acquired.
  • the sending unit 23 is connected to the processing unit 22 and configured to send the first HTTP response to the client.
  • the receiving unit 21 receives the first hypertext transfer protocol HTTP request sent by the client, where the first HTTP request carries a file object identifier indicating the file to be acquired, and the number of files to be acquired.
  • the processing unit 22 determines at least two files to be acquired according to the file object identifier, obtains the first segmentation identifier, and generates an first HTTP response according to the at least two files to be acquired and the first segmentation identifier, where the first HTTP response
  • the data field carries at least two data blocks, and each of the two data blocks is divided by a first split identifier. Each data block includes a file to be acquired, and the sending unit 23 sends the first HTTP response to the client.
  • the HTTP response returned by the web server 82 to the client includes at least two divided by the first split identifier.
  • the file realizes the transmission of at least two files in one HTTP transmission, which improves the transmission efficiency and reduces the system overhead.
  • the processing unit 22 is specifically configured to generate, according to the first split identifier, first split identifier information, and carry the first split identifier information in a header field of the first HTTP response.
  • the data block is generated according to each of the to-be-obtained files, and the first segmentation identifier is inserted between every two of the data blocks to form a data domain of the first HTTP response.
  • the receiving unit 21 is further configured to receive the second sent by the client.
  • An HTTP request wherein the second HTTP request carries an index of the last check successful to determine at least one unsuccessfully received file to be acquired, according to the at least one unsuccessfully received file to be acquired and the The first split identifier generates a second HTTP response, where the data field of the second HTTP response carries at least one data block, and each of the data blocks includes an unsuccessfully received file to be acquired.
  • the sending unit 23 is further configured to send the second HTTP response to the client.
  • FIG. 13 is a schematic structural diagram of a computer node for a client according to an embodiment of the present invention. As shown
  • the computing node 700 may be a smartphone, a tablet, a personal computer PC, a portable portable computer or a terminal, etc.
  • the specific embodiments of the present invention do not limit the specific implementation of the computing node.
  • Computing node 700 includes:
  • a processor 710 a communication interface 720, a memory 730, and a bus 740.
  • the processor 710, the communication interface 720, and the memory 730 complete communication with each other via the bus 740.
  • the communication interface 720 is configured to communicate with the web server, and send a first hypertext transfer protocol HTTP request to the web server, where the first HTTP request carries a file object identifier for indicating a file to be acquired, where the to-be-obtained The number of files is at least two; receiving a first HTTP response sent by the web server according to the file object identifier, where the data field of the first HTTP response carries at least two data blocks, each of two data The blocks are divided by a first segmentation identifier, and each of the data blocks includes one of the files to be acquired.
  • the processor 710 is configured to execute the program 732.
  • program 732 can include program code, the program code including computer operating instructions.
  • Processor 710 may be a central processing unit CPU or a specific integrated circuit ASIC
  • the memory 730 is configured to store the program 732.
  • Memory 730 may include high speed RAM memory and may also include non-volatile memory, such as at least one disk memory.
  • the program 732 may specifically include:
  • the parsing unit 13 is configured to parse the first HTTP response to obtain the at least two files to be acquired
  • the header field of the first HTTP response carries the first split identifier information
  • the parsing unit 13 is specifically configured to determine, according to the first split identifier information in the header field of the first HTTP response, the first split identifier, according to the first split identifier from the first HTTP response Extracting, by the data domain, the at least two data blocks divided by the first segmentation identifier, and extracting the to-be-obtained file from each of the data blocks.
  • the header field of the first HTTP response further carries the second split identifier header information, where each of the data blocks includes an index, the to-be-obtained file, and check information.
  • the parsing unit 13 is specifically configured to determine, according to the second split identifier information in the header field of the first HTTP response, a second split identifier, and extract, according to the second split identifier, from each of the data blocks. Determining, by the verification information, the to-be-obtained file by using the verification information that is divided by the second segmentation identifier, the to-be-obtained file, and the verification information, if the verification is successful, the The file to be acquired and the index are saved.
  • each of the data blocks includes an index, the to-be-obtained file, and check information.
  • the parsing unit 13 is specifically configured to obtain an index length and a check information length, according to the index length and the And verifying the length of the information, and extracting the index, the verification information, and the to-be-obtained file from each of the data blocks, and verifying the to-be-obtained file by using the verification information, if If successful, the file to be acquired and the index are saved.
  • the communication interface 720 is further configured to send a second HTTP request to the web server if the verification fails or the end identifier is not identified in the data field of the first HTTP response, where
  • the second HTTP request carries an index of the file to be acquired that is successfully verified, and receives a second HTTP response sent by the web server, where the data field of the second HTTP response carries at least one data block.
  • Each of the data blocks includes a file to be acquired that is not successfully received;
  • the parsing unit 13 is further configured to parse the second HTTP response to obtain the to-be-obtained file that is not successfully received.
  • FIG. 14 is a schematic structural diagram of a computer node for a web server according to an embodiment of the present invention.
  • the computer node 800 is applied to a web server provided by this embodiment.
  • Compute node 800 includes:
  • a processor 810 a communications interface 820, a memory 830, and a bus 840.
  • the processor 810, the communication interface 820, and the memory 830 complete communication with each other via the bus 840.
  • the communication interface 820 is configured to communicate with the client, and receive a first hypertext transfer protocol HTTP request sent by the client, where the first HTTP request carries a file for indicating that the file is to be acquired.
  • the file object identifier, the number of the files to be acquired is at least two; and the first HTTP response is sent to the client.
  • the processor 810 is configured to execute the program 832.
  • program 832 can include program code, the program code including computer operating instructions.
  • the processor 810 may be a central processing unit CPU, or an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention.
  • CPU central processing unit
  • ASIC Application Specific Integrated Circuit
  • the memory 830 is configured to store the program 832.
  • Memory 830 may include high speed RAM memory and may also include non-volatile memory, such as at least one disk memory.
  • the program 832 may specifically include:
  • the processing unit 22 is configured to determine, according to the file object identifier, at least two files to be acquired, obtain a first segmentation identifier, and generate the first HTTP response according to the at least two to-be-obtained files and the first segmentation identifier,
  • the data field of the first HTTP response carries at least two data blocks, and each of the two data blocks is divided by the first split identifier, and each of the data blocks includes one file to be acquired.
  • the processing unit 22 is specifically configured to generate first split identifier information according to the first split identifier, and carry the first split identifier information in a header field of the first HTTP response. And generating, according to each of the to-be-obtained files, the data block, inserting the first segmentation identifier between every two of the data blocks to form a data domain of the first HTTP response.
  • the processing unit 22 is further configured to: obtain, for each of the to-be-obtained files, an index of the file to be acquired, generate verification information according to the to-be-obtained file, and obtain a second segmentation identifier, where Inserting the second segmentation identifier between the index and the to-be-obtained file, inserting the second segmentation identifier between the to-be-obtained file and the verification information, and generating the data block;
  • the second split identifier generates second split identifier information, and the second split identifier information is carried in the header field of the first HTTP response.
  • the processing unit 22 is further configured to: obtain, for each of the to-be-obtained files, an index of the file to be acquired, generate verification information according to the to-be-obtained file, and use the index, the The verification information and the to-be-obtained file are sequentially arranged to form the data block, wherein the lengths of the indexes of each of the to-be-obtained files are equal, and the lengths of the verification information of each of the to-be-obtained files are equal.
  • the communication interface 820 is further configured to receive a second HTTP request sent by the client, where the second HTTP request carries an index of a file to be acquired that is successfully verified by the last one; A second HTTP response is sent to the client.
  • the processing unit 22 is further configured to: determine, according to the index of the file to be acquired that the verification is successful, at least one unsuccessfully received file to be acquired, according to the at least one unsuccessfully received file to be acquired and the first segmentation identifier Generating the second HTTP response, where the data field of the second HTTP response carries at least one data block, and each of the data blocks includes an unsuccessfully received file to be acquired
  • the disclosed systems, devices, and methods may be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not executed.
  • the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some communication interface, device or unit, and may be in electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the functions may be stored in a computer readable storage medium if implemented in the form of a software functional unit and sold or used as a standalone product.
  • the technical solution of the present invention which is essential to the prior art or part of the technical solution, may be embodied in the form of a software product stored in a storage medium, including a number of instructions to make a computer device (either a personal computer, a server, or Network devices, etc.) perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a removable hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like, which can store program codes. .
  • the method includes the steps of the foregoing method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.

Abstract

本发明实施例提供一种批量文件传输方法及设备,该批量文件传输方法包括:向Web服务器发送第一超文本传送协议HTTP请求,其中,第一HTTP请求中携带有用于指示待获取文件的文件对象标识,待获取文件的数量为至少两个;接收Web服务器根据文件对象标识发送的第一HTTP响应,其中,第一HTTP响应的数据域中携带有至少两个数据块,每两个数据块之间通过第一分割标识分割,每个数据块包括一个待获取文件;对第一HTTP响应进行解析,得到至少两个待获取文件。本发明实施例提供的批量文件传输方法及设备,实现了在一次HTTP传输中传输至少两个文件,提高了传输效率,降低了系统开销。

Description

批量文件传输方法及设备 技术领域 本发明实施例涉及通信技术, 尤其涉及一种批量文件传输方法及设备。 背景技术
超文本传送协议( Hypertext transfer protocol , 简称 HTTP )是超媒体系统 应用之间的通信协议。 在 HTTP传输中, 发起 HTTP请求( Request ) 的设备 为客户端 Client, 接收 HTTP请求并做出响应 ( Response ) 的设备为 Web服 务器。
现有技术中, Client需要从 Web服务器获取文件时, 向 Web服务器发送 的 HTTP请求, 该 HTTP请求中携带有需要获取的文件的标识等参数信息, Web服务器接收到该 HTTP请求后, 根据文件的标识等参数获取对应文件的 长度, 将文件长度作为 HTTP响应的头域信息, 将文件内容作为 HTTP响应 的数据域信息, 将该 HTTP响应发送给 Client。 Client每请求一个文件都要发 一次 HTTP请求, 相应地, Web服务器通过 HTTP响应返回该请求的文件。 当 Client需要获取大量文件时, Client和 Web服务器之间频繁的 HTTP请求 和 HTTP响应导致系统开销过大, 传输效率^^氏, 传输效果不佳。 发明内容 本发明实施例提供一种批量文件传输方法及设备, 以实现在一次 HTTP 传输中传输至少两个文件, 提高传输效率, 降低系统开销。
第一方面, 本发明实施例提供一种批量文件传输方法, 包括:
向 Web服务器发送第一超文本传送协议 HTTP请求, 其中, 所述第一
HTTP请求中携带有用于指示待获取文件的文件对象标识, 所述待获取文件 的数量为至少两个;
接收所述 Web服务器根据所述文件对象标识发送的第一 HTTP响应, 其 中, 所述第一 HTTP响应的数据域中携带有至少两个数据块, 每两个数据块 之间通过第一分割标识分割, 每个所述数据块包括一个所述待获取文件; 对所述第一 HTTP响应进行解析, 得到所述至少两个待获取文件。
在第一种可能的实现方式中, 所述第一 HTTP响应的头域中携带有第一 分割标识头信息;
所述对所述第一 HTTP响应进行解析, 得到所述至少两个待获取文件, 包括:
根据所述第一 HTTP响应的头域中的所述第一分割标识头信息确定所述 第一分割标识, 根据所述第一分割标识从所述第一 HTTP响应的数据域中提 取通过所述第一分割标识分割的所述至少两个数据块, 从每个所述数据块中 提取所述待获取文件。
结合第一方面的第一种可能的实现方式, 在第二种可能的实现方式中, 所述第一 HTTP响应的头域中还携带有第二分割标识头信息, 每个所述数据 块包括索引、 所述待获取文件和校验信息;
所述从每个所述数据块中提取所述待获取文件, 包括:
根据所述第一 HTTP响应的头域中的所述第二分割标识头信息确定第二 分割标识, 根据所述第二分割标识从每个所述数据块中提取通过所述第二分 割标识分割的所述索引、 所述待获取文件和所述校验信息, 通过所述校验信 息对所述待获取文件进行校验, 若校验成功, 则将所述待获取文件和所述索 引保存。
结合第一方面的第一种可能的实现方式, 在第三种可能的实现方式中, 每个所述数据块包括索引、 所述待获取文件和校验信息;
所述从每个所述数据块中提取所述待获取文件, 包括为:
获取索引长度和校验信息长度,根据所述索引长度和所述校验信息长度, 从每个所述数据块中依次提取所述索引、 所述校验信息和所述待获取文件, 通过所述校验信息对所述待获取文件进行校验, 若校验成功, 则将所述待获 取文件和所述索引保存。
结合第一方面的第二种或第三种可能的实现方式, 在第四种可能的实现 方式中, 所述批量文件传输方法, 还包括:
若检验失败或者在所述第一 HTTP响应的数据域中未识别到结束标识, 则向所述 Web服务器发送第二 HTTP请求, 其中, 所述第二 HTTP请求中携 带有最后一个校验成功的待获取文件的索引; 接收所述 Web服务器发送的第二 HTTP响应, 其中, 所述第二 HTTP响 应的数据域中携带有至少一个数据块, 每个所述数据块包括一个未成功接收 的待获取文件;
对所述第二 HTTP响应进行解析, 得到所述未成功接收的待获取文件。 第二方面, 本发明实施例提供一种批量文件传输方法, 包括:
接收客户端发送的第一超文本传送协议 HTTP 请求, 其中, 所述第一 HTTP请求中携带有用于指示待获取文件的文件对象标识, 所述待获取文件 的数量为至少两个;
根据所述文件对象标识确定至少两个待获取文件, 获取第一分割标识, 根据所述至少两个待获取文件和所述第一分割标识生成第一 HTTP响应, 将 所述第 ― HTTP响应发送给所述客户端, 其中, 所述第 ― HTTP响应的数据 域中携带有至少两个数据块,每两个数据块之间通过所述第一分割标识分割, 每个所述数据块包括一个所述待获取文件。
在第一种可能的实现方式中, 所述根据所述至少两个待获取文件和所述 第一分割标识生成第一 HTTP响应, 包括:
根据所述第一分割标识生成第一分割标识头信息, 将所述第一分割标识 头信息携带在所述第一 HTTP响应的头域中, 根据每个所述待获取文件分别 生成所述数据块, 在每两个所述数据块之间插入所述第一分割标识, 形成所 述第一 HTTP响应的数据域。
结合第二方面的第一种可能的实现方式, 在第二种可能的实现方式中, 所述根据每个所述待获取文件分别生成所述数据块, 包括:
对于每个所述待获取文件, 获取所述待获取文件的索引, 根据所述待获 取文件生成校验信息, 获取第二分割标识, 在所述索引和所述待获取文件之 间插入所述第二分割标识, 在所述待获取文件和所述校验信息之间插入所述 第二分割标识, 生成所述数据块;
所述根据所述至少两个待获取文件和所述第一分割标识生成第一 HTTP 响应, 还包括:
根据所述第二分割标识生成第二分割标识头信息, 将所述第二分割标识 头信息携带在所述第一 HTTP响应的头域中。
结合第二方面的第一种可能的实现方式, 在第三种可能的实现方式中, 所述根据每个所述待获取文件分别生成所述数据块, 包括:
对于每个所述待获取文件, 获取所述待获取文件的索引, 根据所述待获 取文件生成校验信息, 将所述索引、 所述校验信息和所述待获取文件依次排 列形成所述数据块, 其中, 每个所述待获取文件的索引的长度相等, 每个所 述待获取文件的校验信息的长度相等。
结合第二方面的第二种或第三种可能的实现方式, 在第四种可能的实现 方式中, 所述批量文件传输方法, 还包括:
接收所述客户端发送的第二 HTTP请求, 其中, 所述第二 HTTP请求中 携带有最后一个校验成功的待获取文件的索引;
根据所述校验成功的待获取文件的索引确定至少一个未成功接收的待获 取文件, 根据所述至少一个未成功接收的待获取文件和所述第一分割标识生 成第二 HTTP响应, 其中, 所述第二 HTTP响应的数据域中携带有至少一个 数据块, 每个所述数据块包括一个未成功接收的待获取文件;
将所述第二 HTTP响应发送给所述客户端。
第三方面, 本发明实施例提供一种客户端, 包括:
请求单元, 用于向 Web服务器发送第一超文本传送协议 HTTP请求, 其 中, 所述第一 HTTP请求中携带有用于指示待获取文件的文件对象标识, 所 述待获取文件的数量为至少两个;
接收单元, 用于接收所述 Web服务器根据所述文件对象标识发送的第一 HTTP响应, 其中, 所述第一 HTTP响应的数据域中携带有至少两个数据块, 每两个数据块之间通过第一分割标识分割, 每个所述数据块包括一个所述待 获取文件;
解析单元, 与所述接收单元相连, 用于对所述第一 HTTP响应进行解析, 得到所述至少两个待获取文件。
在第一种可能的实现方式中, 所述第一 HTTP响应的头域中携带有第一 分割标识头信息;
所述解析单元具体用于根据所述第一 HTTP响应的头域中的所述第一分 割标识头信息确定所述第一分割标识, 根据所述第一分割标识从所述第 ― HTTP 响应的数据域中提取通过所述第一分割标识分割的所述至少两个数据 块, 从每个所述数据块中提取所述待获取文件。 结合第三方面的第一种可能的实现方式, 在第二种可能的实现方式中, 所述第一 HTTP响应的头域中还携带有第二分割标识头信息, 每个所述数据 块包括索引、 所述待获取文件和校验信息;
所述解析单元具体用于根据所述第一 HTTP响应的头域中的所述第二分 割标识头信息确定第二分割标识, 根据所述第二分割标识从每个所述数据块 中提取通过所述第二分割标识分割的所述索引、 所述待获取文件和所述校验 信息, 通过所述校验信息对所述待获取文件进行校验, 若校验成功, 则将所 述待获取文件和所述索引保存。
结合第三方面的第一种可能的实现方式, 在第三种可能的实现方式中, 每个所述数据块包括索引、 所述待获取文件和校验信息;
所述解析单元具体用于获取索引长度和校验信息长度, 根据所述索引长 度和所述校验信息长度, 从每个所述数据块中依次提取所述索引、 所述校验 信息和所述待获取文件, 通过所述校验信息对所述待获取文件进行校验, 若 校验成功, 则将所述待获取文件和所述索引保存。
结合第三方面的第二种或第三种可能的实现方式, 在第四种可能的实现 方式中, 所述请求单元还用于若检验失败或者在所述第一 HTTP响应的数据 域中未识别到结束标识, 则向所述 Web服务器发送第二 HTTP请求, 其中, 所述第二 HTTP请求中携带有最后一个校验成功的待获取文件的索引;
所述接收单元还用于接收所述 Web服务器发送的第二 HTTP响应,其中, 所述第二 HTTP响应的数据域中携带有至少一个数据块, 每个所述数据块包 括一个未成功接收的待获取文件;
所述解析单元还用于对所述第二 HTTP响应进行解析, 得到所述未成功 接收的待获取文件。
第四方面, 本发明实施例提供一种 Web服务器, 包括:
接收单元, 用于接收客户端发送的第一超文本传送协议 HTTP请求, 其 中, 所述第一 HTTP请求中携带有用于指示待获取文件的文件对象标识, 所 述待获取文件的数量为至少两个;
处理单元, 与所述接收单元相连, 用于根据所述文件对象标识确定至少 两个待获取文件, 获取第一分割标识, 根据所述至少两个待获取文件和所述 第一分割标识生成第 ― HTTP响应, 其中, 所述第 ― HTTP响应的数据域中 携带有至少两个数据块, 每两个数据块之间通过所述第一分割标识分割, 每 个所述数据块包括一个所述待获取文件;
发送单元, 与所述处理单元相连, 用于将所述第一 HTTP响应发送给所 述客户端。
在第一种可能的实现方式中, 所述处理单元具体用于根据所述第一分割 标识生成第一分割标识头信息, 将所述第一分割标识头信息携带在所述第 ― HTTP 响应的头域中, 根据每个所述待获取文件分别生成所述数据块, 在每 两个所述数据块之间插入所述第一分割标识, 形成所述第一 HTTP响应的数 据域。
结合第四方面的第一种可能的实现方式, 在第二种可能的实现方式中, 所述处理单元还用于对于每个所述待获取文件,获取所述待获取文件的索引 , 根据所述待获取文件生成校验信息, 获取第二分割标识, 在所述索引和所述 待获取文件之间插入所述第二分割标识, 在所述待获取文件和所述校验信息 之间插入所述第二分割标识, 生成所述数据块; 根据所述第二分割标识生成 第二分割标识头信息, 将所述第二分割标识头信息携带在所述第一 HTTP响 应的头域中。
结合第四方面的第一种可能的实现方式, 在第三种可能的实现方式中, 所述处理单元还用于对于每个所述待获取文件,获取所述待获取文件的索引 , 根据所述待获取文件生成校验信息, 将所述索引、 所述校验信息和所述待获 取文件依次排列形成所述数据块, 其中, 每个所述待获取文件的索引的长度 相等, 每个所述待获取文件的校验信息的长度相等。
结合第四方面的第二种或第三种可能的实现方式, 在第四种可能的实现 方式中, 所述接收单元还用于接收所述客户端发送的第二 HTTP请求, 其中, 所述第二 HTTP请求中携带有最后一个校验成功的待获取文件的索引;
所述处理单元还用于根据所述校验成功的待获取文件的索引确定至少一 个未成功接收的待获取文件, 根据所述至少一个未成功接收的待获取文件和 所述第一分割标识生成第二 HTTP响应, 其中, 所述第二 HTTP响应的数据 域中携带有至少一个数据块, 每个所述数据块包括一个未成功接收的待获取 文件;
所述发送单元还用于将所述第二 HTTP响应发送给所述客户端。 第五方面, 本发明实施例提供一种用于客户端的计算机节点, 所述计算 节点包括处理器, 通信接口, 存储器和总线:
其中所述处理器、 所述通信接口和所述存储器通过总线完成相互间的通 信;
所述通信接口, 用于从向 Web服务器发送第一超文本传送协议 HTTP请 求, 其中, 所述第一 HTTP请求中携带有用于指示待获取文件的文件对象标 识, 所述待获取文件的数量为至少两个; 接收所述 Web服务器根据所述文件 对象标识发送的第一 HTTP响应, 其中, 所述第一 HTTP响应的数据域中携 带有至少两个数据块, 每两个数据块之间通过第一分割标识分割, 每个所述 数据块包括一个所述待获取文件;
所述处理器, 用于执行程序;
所述存储器, 用于存放所述程序;
其中所述程序, 用于对所述第一 HTTP响应进行解析, 得到所述至少两 个待获取文件。
在第一种可能的实现方式中, 所述第一 HTTP响应的头域中携带有第一 分割标识头信息;
所述程序具体用于根据所述第一 HTTP响应的头域中的所述第一分割标 识头信息确定所述第一分割标识, 根据所述第一分割标识从所述第一 HTTP 响应的数据域中提取通过所述第一分割标识分割的所述至少两个数据块, 从 每个所述数据块中提取所述待获取文件。
结合第五方面的第一种可能的实现方式, 在第二种可能的实现方式中, 所述第一 HTTP响应的头域中还携带有第二分割标识头信息, 每个所述数据 块包括索引、 所述待获取文件和校验信息;
所述程序具体用于根据所述第一 HTTP响应的头域中的所述第二分割标 识头信息确定第二分割标识, 根据所述第二分割标识从每个所述数据块中提 取通过所述第二分割标识分割的所述索引、所述待获取文件和所述校验信息, 通过所述校验信息对所述待获取文件进行校验, 若校验成功, 则将所述待获 取文件和所述索引保存。
结合第五方面的第一种可能的实现方式, 在第三种可能的实现方式中, 每个所述数据块包括索引、 所述待获取文件和校验信息; 所述程序具体用于获取索引长度和校验信息长度, 根据所述索引长度和 所述校验信息长度, 从每个所述数据块中依次提取所述索引、 所述校验信息 和所述待获取文件, 通过所述校验信息对所述待获取文件进行校验, 若校验 成功, 则将所述待获取文件和所述索引保存。
结合第五方面的第二种或第三种可能的实现方式, 在第四种可能的实现 方式中, 所述通信接口还用于若检验失败或者在所述第一 HTTP响应的数据 域中未识别到结束标识, 则向所述 Web服务器发送第二 HTTP请求, 其中, 所述第二 HTTP请求中携带有最后一个校验成功的待获取文件的索引; 接收 所述 Web服务器发送的第二 HTTP响应, 其中, 所述第二 HTTP响应的数据 域中携带有至少一个数据块, 每个所述数据块包括一个未成功接收的待获取 文件;
所述程序还用于对所述第二 HTTP响应进行解析, 得到所述未成功接收 的待获取文件。
第六方面, 本发明实施例提供一种用于 Web服务器的计算机节点, 所述 计算节点包括处理器, 通信接口, 存储器和总线:
其中所述处理器、 所述通信接口和所述存储器通过总线完成相互间的通 信;
所述通信接口,用于接收客户端发送的第一超文本传送协议 HTTP请求, 其中, 所述第一 HTTP请求中携带有用于指示待获取文件的文件对象标识, 所述待获取文件的数量为至少两个; 将第一 HTTP响应发送给所述客户端; 所述处理器, 用于执行程序;
所述存储器, 用于存放所述程序;
其中所述程序, 用于根据所述文件对象标识确定至少两个待获取文件, 获取第一分割标识, 根据所述至少两个待获取文件和所述第一分割标识生成 所述第一 HTTP响应, 其中, 所述第一 HTTP响应的数据域中携带有至少两 个数据块, 每两个数据块之间通过所述第一分割标识分割, 每个所述数据块 包括一个所述待获取文件。
在第一种可能的实现方式中, 所述程序具体用于根据所述第一分割标识 生成第一分割标识头信息,将所述第一分割标识头信息携带在所述第 ― HTTP 响应的头域中, 根据每个所述待获取文件分别生成所述数据块, 在每两个所 述数据块之间插入所述第一分割标识, 形成所述第一 HTTP响应的数据域。 结合第六方面的第一种可能的实现方式, 在第二种可能的实现方式中, 所述程序还用于对于每个所述待获取文件, 获取所述待获取文件的索引, 根 据所述待获取文件生成校验信息, 获取第二分割标识, 在所述索引和所述待 获取文件之间插入所述第二分割标识, 在所述待获取文件和所述校验信息之 间插入所述第二分割标识, 生成所述数据块; 根据所述第二分割标识生成第 二分割标识头信息, 将所述第二分割标识头信息携带在所述第一 HTTP响应 的头域中。
结合第六方面的第一种可能的实现方式, 在第三种可能的实现方式中, 所述程序还用于对于每个所述待获取文件, 获取所述待获取文件的索引, 根 据所述待获取文件生成校验信息, 将所述索引、 所述校验信息和所述待获取 文件依次排列形成所述数据块, 其中, 每个所述待获取文件的索引的长度相 等, 每个所述待获取文件的校验信息的长度相等。
结合第六方面的第二种或第三种可能的实现方式, 在第四种可能的实现 方式中, 所述通信接口还用于接收所述客户端发送的第二 HTTP请求, 其中, 所述第二 HTTP请求中携带有最后一个校验成功的待获取文件的索引; 将第 二 HTTP响应发送给所述客户端。
所述程序还用于根据所述校验成功的待获取文件的索引确定至少一个未 成功接收的待获取文件, 根据所述至少一个未成功接收的待获取文件和所述 第一分割标识生成所述第二 HTTP响应, 其中, 所述第二 HTTP响应的数据 域中携带有至少一个数据块, 每个所述数据块包括一个未成功接收的待获取 文件。
本发明实施例提供的批量文件传输方法及设备,客户端向 Web服务器发 送第一超文本传送协议 HTTP请求, 其中, 第一 HTTP请求中携带有用于指 示待获取文件的文件对象标识, 待获取文件的数量为至少两个, 接收 Web服 务器发送的第一 HTTP响应, 其中, 第一 HTTP响应的数据域中携带有至少 两个数据块, 每两个数据块之间通过第一分割标识分割, 每个数据块包括一 个待获取文件, 对第一 HTTP响应进行解析, 得到至少两个待获取文件。 由 于客户端向 Web服务器发送的 HTTP请求中携带有用于指示至少两个文件的 文件对象标识, 相应地, Web服务器向客户端返回的 HTTP响应中包括通过 第一分割标识分割的至少两个文件, 实现了在一次 HTTP传输中传输至少两 个文件, 提高了传输效率, 降低了系统开销。 附图说明
实施例或现有技术描述中所需要使用的附图作一简单地介绍, 显而易见 地, 下面描述中的附图是本发明的一些实施例, 对于本领域普通技术人员 来讲, 在不付出创造性劳动性的前提下, 还可以根据这些附图获得其他的 附图。
图 1为本发明实施例提供的第一种批量文件传输方法流程图;
图 2为本发明实施例提供的网络应用场景示意图;
图 3为本发明实施例提供的第一种 HTTP响应的数据域结构示意图; 图 4为本发明实施例提供的第二种 HTTP响应的数据域结构示意图; 图 5为本发明实施例提供的 HTTP响应结构示意图;
图 6为本发明实施例提供的第一种数据块结构示意图;
图 7为本发明实施例提供的第二种数据块结构示意图;
图 8为本发明实施例提供的第二种批量文件传输方法流程图;
图 9为本发明实施例提供的第三种批量文件传输方法流程图;
图 10为本发明实施例提供的第四种批量文件传输方法流程图;
图 11为本发明实施例提供的客户端结构示意图;
图 12为本发明实施例提供的 Web服务器结构示意图;
图 13为本发明实施例提供的用于客户端的计算机节点结构示意图; 图 14为本发明实施例提供的用于 Web服务器的计算机节点结构示意图。 具体实施方式 为使本发明实施例的目的、 技术方案和优点更加清楚, 下面将结合本 发明实施例中的附图, 对本发明实施例中的技术方案进行清楚、 完整地描 述,显然, 所描述的实施例是本发明一部分实施例, 而不是全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在没有作出创造性劳动前提 下所获得的所有其他实施例, 都属于本发明保护的范围。 图 1为本发明实施例提供的第一种批量文件传输方法流程图。 如图 1所 示, 本实施例提供的批量文件传输方法具体可以应用于基于 HTTP传输的网 络应用场景, 尤其是跨互联网进行大批量数据传输的应用场景, 如图 2所示, 在该应用场景中, 包括 Web服务器 82和多个客户端 81。 客户端 81与 Web 服务器 82之间的通信基于 HTTP。 本实施例提供的批量文件传输方法可以通 过客户端 Client来执行, 该客户端可以通过个人计算机、 笔记本电脑、 平板 电脑、 智能手机或服务器等具有数据处理能力的电子设备来实现。
本实施例提供的批量文件传输方法具体包括:
步骤 C10、 向 Web服务器发送第一超文本传送协议 HTTP请求, 其中, 所述第一 HTTP请求中携带有用于指示待获取文件的文件对象标识, 所述待 获取文件的数量为至少两个;
具体地, 用户通过客户端访问 Web服务器, 以从 Web服务器获取文件。 HTTP是运行在 TCP ( Transmission Control Protocol, 传输控制协议)之上的 应用层协议, 客户端首先向 Web服务器发起 TCP连接请求, 以与 Web服务 器建立 TCP连接。 该 TCP连接建立后, 客户端再通过 TCP连接与 Web服务 器进行通信。
客户端向 Web服务器发送第一 HTTP请求, 第一 HTTP请求包括头域 ( Header )和数据域( Body ) , 头域中可以包括多个头信息, 当头域中包括 多个头信息时, 头信息之间具体可以通过回车分割, 头域和数据域可以通过 空行分割。
文件对象标识具体用以指示客户端所需要获取的文件, 即待获取文件, 待获取文件的数量为至少两个。 具体地, 客户端可以请求获取 Web服务器中 某个目录下的所有文件, 则该文件对象标识可以为该目录的名称, 或者客户 端可以请求获取 Web服务器在某个时间范围内所生成的所有文件, 则该文件 对象标识可以为该时间范围。 在上述应用场景下, 客户端可以不知道请求获 取的文件的数量和文件的名称。 若用户通过客户端选择获取 Web服务器中的 某些特定文件时, 则该文件对象标识可以为文件的文件名。 文件对象标识可 以根据实际情况而具体设置, 不以本实施例为限。 该文件对象标识可以以头 信息的形式携带在第一 HTTP请求的头域中, 也可以携带在第一 HTTP请求 数据域中。 Web服务器接收到该第一 HTTP请求, 对第 ― HTTP请求进行解析, 从 第一 HTTP请求中提取该文件对象标识, 并根据该文件对象标识确定待获取 文件。 Web服务器获取第一分割标识(Block Splitter ) , 该第一分割标识具 体可以为通过预设算法预先生成的, Web服务器也可以在接收到第一 HTTP 请求后再通过预设算法生成该第一分割标识。 第一分割标识具体可以为随机 数, 例如通用唯一识别码(Universally Unique Identifier, 简称 UUID ) , 或者 多个 UUID的组合。 也可以釆用其他预设方法生成该第一分割标识, 以保证 生成的第一分割标识的复杂性以与待获取文件区分即可,不以本实施例为限。 若该第一分割标识为预先生成的, 则可以通过网络协议与客户端进行预先约 定, 以使得客户端可以识别该第一分割标识。 若该第一分割标识为 Web服务 器实时生成的, 则 Web服务器可以在发送给客户端的第一 HTTP响应的头域 中携带用以指示该第一分割标识的头信息。
Web 服务器根据待获取文件生成包含有该待获取文件的数据块 (Data Block ) , 例如待获取文件的数量为 Ν, Ν为整数且^ > 2, 则生成的数据块 的数量也为 Ν。 数据块中除了包括该待获取文件, 还可以包括其他与该待获 取文件相关的信息, 例如索引、 长度信息或检验信息等, 也可以只包括该待 获取文件。 Web服务器在每两个数据块之间插入一个第一分割标识, 即数据 块两两之间通过第一分割标识分割, 形成第一 HTTP响应的数据域, 如图 3 所示。 在实际应用中, 还可以在数据域的头部插入一个第一分割标识, 在数 据域的尾部插入一个第一分割标识, 如图 4所示, 数据域的尾部还可以插入 结束标识, 以指示该数据域结束。 该结束标识例如可以为两个连续的回车符。 Web服务器将该第一 HTTP响应发送给客户端。
步骤 C20、接收所述 Web服务器根据所述文件对象标识发送的第一 HTTP 响应, 其中, 所述第一 HTTP响应的数据域中携带有至少两个数据块, 每两 个数据块之间通过第一分割标识分割, 每个所述数据块包括一个所述待获取 文件;
步骤 C30、 对所述第一 HTTP响应进行解析, 得到所述至少两个待获取 文件。
具体地,客户端接收 Web服务器发送的该第一 HTTP响应,对第一 HTTP 响应进行解析, 通过识别第 ― HTTP响应中的第一分割标识可以将每个数据 块提取出来, 进而获得每个数据块中的待获取文件。
本实施例提供的批量文件传输方法,客户端向 Web服务器发送第一超文 本传送协议 HTTP请求, 其中, 第一 HTTP请求中携带有用于指示待获取文 件的文件对象标识, 待获取文件的数量为至少两个, 接收 Web服务器发送的 第一 HTTP响应, 其中, 第一 HTTP响应的数据域中携带有至少两个数据块, 每两个数据块之间通过第一分割标识分割,每个数据块包括一个待获取文件, 对第一 HTTP响应进行解析, 得到至少两个待获取文件。 由于客户端向 Web 服务器发送的 HTTP请求中携带有用于指示至少两个文件的文件对象标识, 相应地, Web服务器向客户端返回的 HTTP响应中包括通过第一分割标识分 割的至少两个文件, 实现了在一次 HTTP传输中传输至少两个文件, 提高了 传输效率, 降低了系统开销。
在本实施例中, 所述第一 HTTP响应的头域中携带有第一分割标识头信 息; 相应地, 步骤 C30、 所述对所述第一 HTTP响应进行解析, 得到所述至 少两个待获取文件, 具体可以包括:
根据所述第一 HTTP响应的头域中的所述第一分割标识头信息确定所述 第一分割标识, 根据所述第一分割标识从所述第一 HTTP响应的数据域中提 取通过所述第一分割标识分割的所述至少两个数据块, 从每个所述数据块中 提取所述待获取文件。
具体地, 第一 HTTP响应的格式具体可以参照图 5。 该第一 HTTP响应 的头域中携带有第一分割标识头信息 (Block Splitter Header ) , 头域中还可 以携带有其他头信息 (other Headers ) 。 客户端可以根据第一 HTTP响应的 头域中的第一分割标识头信息确定该第一分割标识。
在本实施例中, 所述第一 HTTP响应的头域中还携带有第二分割标识头 信息, 每个所述数据块包括索引、 所述待获取文件和校验信息;
所述从每个所述数据块中提取所述待获取文件, 具体可以包括: 根据所述第一 HTTP响应的头域中的所述第二分割标识头信息确定第二 分割标识, 根据所述第二分割标识从每个所述数据块中提取通过所述第二分 割标识分割的所述索引、 所述待获取文件和所述校验信息, 通过所述校验信 息对所述待获取文件进行校验, 若校验成功, 则将所述待获取文件和所述索 引保存。 具体地, Web服务器在根据待获取文件生成的数据块可以不仅包含该待 获取文件, 还可以包括该待获取文件的索引和校验信息。 索引具体可以为待 获取文件的文件名。 Web服务器在根据文件对象标识确定至少两个待获取文 件时, 可以为每个待获取文件分配序列号, 索引也可以为该序列号。 校验信 息具体可以为对待获取文件通过预设校验算法处理后生成的, 该预设校验算 法可以为但不限于 MD( Message Digest Algorithm,消息摘要算法)5或 SHA-1 ( Secure Hash Algorithm, 安全哈希算法)等摘要算法。 该校验信息用于对待 获取文件的完整性和安全性进行校验。 Web服务器获取第二分割标识(Inner Splitter ) , 该第二分割标识的生成方式可以参照第一分割标识的生成方式, 在此不再赘述。 Web 服务器根据该第二分割标识生成第二分割标识头信息 ( Inner Splitter Header ) , 通过第二分割标识将索引、 待获取文件和检验信息 两两分割开, 索引、 待获取文件和检验信息的顺序可以按照预设规则排列。 一种实现方式如图 6所示。
客户端在将待获取文件从数据块中提取出来的过程中, 可以首先根据第 一 HTTP响应的头域中第二分割标识头信息确定该第二分割标识, 通过识别 数据块的第二分割标识, 以将索引、 待获取文件和检验信息分别提取出来, 并通过检验信息对该待获取文件进行检验, 若校验成功, 可以将该待获取文 件和索引对应保存, 若检验失败, 则可以向 Web服务器重新获取文件。
在本实施例中, 每个所述数据块包括索引、 所述待获取文件和校验信息; 所述从每个所述数据块中提取所述待获取文件, 具体可以包括:
获取索引长度和校验信息长度,根据所述索引长度和所述校验信息长度, 从每个所述数据块中依次提取所述索引、 所述校验信息和所述待获取文件, 通过所述校验信息对所述待获取文件进行校验, 若校验成功, 则将所述待获 取文件和所述索引保存。
具体地, 在另一种实现方式中, 每个待获取文件的索引的长度相同, 每 个待获取文件的校验信息的长度也相同。 则该数据块中可以不包括第二分割 标识, 以节省传输带宽资源。 优选地, 索引和校验信息排在待获取文件的前 面, 如图 7所示。 则客户端可以根据索引长度和检验信息长度对数据块进行 分割, 以分别获取索引、 校验信息和待获取文件。 客户端通过检验信息对该 待获取文件进行检验, 若校验成功, 可以将该待获取文件和索引对应保存, 若检验失败, 则可以向 Web服务器重新获取文件。
图 8为本发明实施例提供的第二种批量文件传输方法流程图。 如图 8所 示, 该批量文件传输方法, 还可以包括:
步骤 C40、 若检验失败或者在所述第一 HTTP响应的数据域中未识别到 结束标识,则向所述 Web服务器发送第二 HTTP请求,其中,所述第二 HTTP 请求中携带有最后一个校验成功的待获取文件的索引;
步骤 C50、 接收所述 Web服务器发送的第二 HTTP响应, 其中, 所述第 二 HTTP响应的数据域中携带有至少一个数据块, 每个所述数据块包括一个 未成功接收的待获取文件;
步骤 C60、 对所述第二 HTTP响应进行解析, 得到所述未成功接收的待 获取文件。
具体地, 客户端通过校验信息对待获取文件进行校验, 校验失败时, 表 明可能由于网络中断等原因, 该待获取文件并未成功接收。 或者第一 HTTP 响应的数据域中没有结束标识, 表明数据域没有完整接收。 则客户端可以向 Web服务器发送第二 HTTP请求, 以获取未成功接收到的待获取文件。
客户端可以在第二 HTTP请求的中携带标记信息 ( Marker ) , 该标记信 息具体可以为最后一个校验成功的待获取文件的索引。 则 Web服务器可以根 据该标记信息, 获知客户端已经成功接收到的待获取文件, 也可以获知客户 端未成功接收到的待获取文件, 并将客户端未成功接收到的待获取文件通过 第二 HTTP响应返回给客户端。 第二 HTTP响应的格式与第一 HTTP响应的 格式相同, 在此不再赘述。
在实际应用中, 若客户端知道需要获取的文件, 则可以根据成功接收到 的文件的情况确定未成功接收到的文件的文件名。 客户端可以将文件名携带 在第二 HTTP请求中, 以请求获取未成功接收到的文件。 通过对未成功接收 的文件的续传, 减少了重复传输量和网络带宽资源的占用。
图 9为本发明实施例提供的第三种批量文件传输方法流程图。 如图 9所 示, 本实施例提供的批量文件传输方法具体可以与本发明任意实施例提供的 应用于客户端的方法配合实现, 具体实现过程在此不再赘述。 本实施例提供 的批量文件传输方法可以通过 Web服务器来执行。
本实施例提供的批量文件传输方法具体包括: 步骤 S10、 接收客户端发送的第一超文本传送协议 HTTP请求, 其中, 所述第一 HTTP请求中携带有用于指示待获取文件的文件对象标识, 所述待 获取文件的数量为至少两个;
步骤 S20、 根据所述文件对象标识确定至少两个待获取文件, 获取第一 分割标识,根据所述至少两个待获取文件和所述第一分割标识生成第 ― HTTP 响应, 其中, 所述第一 HTTP响应的数据域中携带有至少两个数据块, 每两 个数据块之间通过所述第一分割标识分割, 每个所述数据块包括一个所述待 获取文件;
步骤 S30、 将所述第一 HTTP响应发送给所述客户端。
本实施例提供的批量文件传输方法, Web服务器接收客户端发送的第一 超文本传送协议 HTTP请求, 其中, 第一 HTTP请求中携带有用于指示待获 取文件的文件对象标识, 待获取文件的数量为至少两个, 根据文件对象标识 确定至少两个待获取文件, 获取第一分割标识, 根据至少两个待获取文件和 第一分割标识生成第一 HTTP响应, 其中, 第一 HTTP响应的数据域中携带 有至少两个数据块, 每两个数据块之间通过第一分割标识分割, 每个数据块 包括一个待获取文件, 将第 ― HTTP响应发送给客户端。 由于客户端向 Web 服务器发送的 HTTP请求中携带有用于指示至少两个文件的文件对象标识, 相应地, Web服务器向客户端返回的 HTTP响应中包括通过第一分割标识分 割的至少两个文件, 实现了在一次 HTTP传输中传输至少两个文件, 提高了 传输效率, 降低了系统开销。
在本实施例中, 步骤 S20, 所述根据所述至少两个待获取文件和所述第 一分割标识生成第一 HTTP响应 , 具体可以包括:
根据所述第一分割标识生成第一分割标识头信息, 将所述第一分割标识 头信息携带在所述第一 HTTP响应的头域中, 根据每个所述待获取文件分别 生成所述数据块, 在每两个所述数据块之间插入所述第一分割标识, 形成所 述第一 HTTP响应的数据域。
在本实施例中, 所述根据每个所述待获取文件分别生成所述数据块, 具 体可以包括:
对于每个所述待获取文件, 获取所述待获取文件的索引, 根据所述待获 取文件生成校验信息, 获取第二分割标识, 在所述索引和所述待获取文件之 间插入所述第二分割标识, 在所述待获取文件和所述校验信息之间插入所述 第二分割标识, 生成所述数据块;
步骤 S20, 所述根据所述至少两个待获取文件和所述第一分割标识生成 第一 HTTP响应, 还可以包括:
根据所述第二分割标识生成第二分割标识头信息, 将所述第二分割标识 头信息携带在所述第一 HTTP响应的头域中。
在本实施例中, 所述根据每个所述待获取文件分别生成所述数据块, 包 括:
对于每个所述待获取文件, 获取所述待获取文件的索引, 根据所述待获 取文件生成校验信息, 将所述索引、 所述校验信息和所述待获取文件依次排 列形成所述数据块, 其中, 每个所述待获取文件的索引的长度相等, 每个所 述待获取文件的校验信息的长度相等。
值得注意的是, 本实施例提供了两种数据块的生成方式, 但是本领域技 术人员釆用其他方式生成数据块, 以保证客户端可以将待获取文件提取出来 即可, 不以本实施例为限。
图 10为本发明实施例提供的第四种批量文件传输方法流程图。 如图 10 所示, 在本实施例中, 该批量文件传输方法还可以包括:
步骤 S40、接收所述客户端发送的第二 HTTP请求,其中,所述第二 HTTP 请求中携带有最后一个校验成功的待获取文件的索引;
步骤 S50、 根据所述校验成功的待获取文件的索引确定至少一个未成功 接收的待获取文件, 根据所述至少一个未成功接收的待获取文件和所述第一 分割标识生成第二 HTTP响应, 其中, 所述第二 HTTP响应的数据域中携带 有至少一个数据块, 每个所述数据块包括一个未成功接收的待获取文件; 步骤 S60、 将所述第二 HTTP响应发送给所述客户端。
图 11为本发明实施例提供的客户端结构示意图。 如图 11所示, 本实施 例提供的客户端 81 具体可以实现本发明任意实施例提供的应用于客户端的 批量文件传输方法的各个步骤, 具体实现过程在此不再赘述。 本实施例提供 的客户端 81具体包括请求单元 11、接收单元 12和解析单元 13。 所述请求单 元 11用于向 Web服务器发送第一超文本传送协议 HTTP请求, 其中, 所述 第一 HTTP请求中携带有用于指示待获取文件的文件对象标识, 所述待获取 文件的数量为至少两个。 所述接收单元 12用于接收所述 Web服务器根据所 述文件对象标识发送的第 ― HTTP响应, 其中, 所述第 ― HTTP响应的数据 域中携带有至少两个数据块, 每两个数据块之间通过第一分割标识分割, 每 个所述数据块包括一个所述待获取文件。 所述解析单元 13 与所述接收单元 12相连, 用于对所述第一 HTTP响应进行解析, 得到所述至少两个待获取文 件。
本实施例提供的客户端 81 , 请求单元 11向 Web服务器发送第一超文本 传送协议 HTTP请求, 其中, 第一 HTTP请求中携带有用于指示待获取文件 的文件对象标识, 待获取文件的数量为至少两个, 接收单元 12接收 Web服 务器发送的第一 HTTP响应, 其中, 第一 HTTP响应的数据域中携带有至少 两个数据块, 每两个数据块之间通过第一分割标识分割, 每个数据块包括一 个待获取文件, 解析单元 13对第一 HTTP响应进行解析, 得到至少两个待获 取文件。 由于客户端 81向 Web服务器发送的 HTTP请求中携带有用于指示 至少两个文件的文件对象标识,相应地, Web服务器向客户端 81返回的 HTTP 响应中包括通过第一分割标识分割的至少两个文件, 实现了在一次 HTTP传 输中传输至少两个文件, 提高了传输效率, 降低了系统开销。
在本实施例中, 所述第一 HTTP响应的头域中携带有第一分割标识头信 息; 相应地, 所述解析单元 13具体可以用于根据所述第一 HTTP响应的头域 中的所述第一分割标识头信息确定所述第一分割标识, 根据所述第一分割标 识从所述第一 HTTP响应的数据域中提取通过所述第一分割标识分割的所述 至少两个数据块, 从每个所述数据块中提取所述待获取文件。
在本实施例中, 所述第一 HTTP响应的头域中还携带有第二分割标识头 信息, 每个所述数据块包括索引、 所述待获取文件和校验信息; 所述解析单 元 13具体可以用于根据所述第一 HTTP响应的头域中的所述第二分割标识头 信息确定第二分割标识, 根据所述第二分割标识从每个所述数据块中提取通 过所述第二分割标识分割的所述索引、 所述待获取文件和所述校验信息, 通 过所述校验信息对所述待获取文件进行校验, 若校验成功, 则将所述待获取 文件和所述索引保存。
在本实施例中, 每个所述数据块包括索引、 所述待获取文件和校验信息; 所述解析单元 13具体用于获取索引长度和校验信息长度,根据所述索引长度 和所述校验信息长度, 从每个所述数据块中依次提取所述索引、 所述校验信 息和所述待获取文件, 通过所述校验信息对所述待获取文件进行校验, 若校 验成功, 则将所述待获取文件和所述索引保存。
在本实施例中, 所述请求单元 11 还用于若检验失败或者在所述第一 HTTP 响应的数据域中未识别到结束标识, 则向所述 Web服务器发送第二 HTTP请求, 其中, 所述第二 HTTP请求中携带有最后一个校验成功的待获 取文件的索引。 所述接收单元 12还用于接收所述 Web服务器发送的第二 HTTP响应, 其中, 所述第二 HTTP响应的数据域中携带有至少一个数据块, 每个所述数据块包括一个未成功接收的待获取文件。所述解析单元 13还用于 对所述第二 HTTP响应进行解析, 得到所述未成功接收的待获取文件。
图 12为本发明实施例提供的 Web服务器结构示意图。 如图 12所示, 本 实施例提供的 Web服务器 82具体可以实现本发明任意实施例提供的应用于 Web服务器的批量文件传输方法的各个步骤, 具体实现过程在此不再赘述。 本实施例提供的 Web服务器 82具体包括接收单元 21、处理单元 22和发送单 元 23。 所述接收单元 21 用于接收客户端发送的第一超文本传送协议 HTTP 请求, 其中, 所述第一 HTTP请求中携带有用于指示待获取文件的文件对象 标识, 所述待获取文件的数量为至少两个。 所述处理单元 22与所述接收单元 21相连, 用于根据所述文件对象标识确定至少两个待获取文件, 获取第一分 割标识, 根据所述至少两个待获取文件和所述第一分割标识生成第一 HTTP 响应, 其中, 所述第一 HTTP响应的数据域中携带有至少两个数据块, 每两 个数据块之间通过所述第一分割标识分割, 每个所述数据块包括一个所述待 获取文件。所述发送单元 23与所述处理单元 22相连,用于将所述第一 HTTP 响应发送给所述客户端。
本实施例提供的 Web服务器 82, 接收单元 21接收客户端发送的第一超 文本传送协议 HTTP请求, 其中, 第一 HTTP请求中携带有用于指示待获取 文件的文件对象标识,待获取文件的数量为至少两个, 处理单元 22根据文件 对象标识确定至少两个待获取文件, 获取第一分割标识, 根据至少两个待获 取文件和第一分割标识生成第 ― HTTP响应, 其中, 第一 HTTP响应的数据 域中携带有至少两个数据块, 每两个数据块之间通过第一分割标识分割, 每 个数据块包括一个待获取文件,发送单元 23将第 ― HTTP响应发送给客户端。 由于客户端向 Web服务器 82发送的 HTTP请求中携带有用于指示至少两个 文件的文件对象标识,相应地, Web服务器 82向客户端返回的 HTTP响应中 包括通过第一分割标识分割的至少两个文件, 实现了在一次 HTTP传输中传 输至少两个文件, 提高了传输效率, 降低了系统开销。
在本实施例中,所述处理单元 22具体可以用于根据所述第一分割标识生 成第一分割标识头信息, 将所述第一分割标识头信息携带在所述第一 HTTP 响应的头域中, 根据每个所述待获取文件分别生成所述数据块, 在每两个所 述数据块之间插入所述第一分割标识, 形成所述第一 HTTP响应的数据域。 获取所述待获取文件的索引, 根据所述待获取文件生成校验信息, 获取第二 分割标识, 在所述索引和所述待获取文件之间插入所述第二分割标识, 在所 述待获取文件和所述校验信息之间插入所述第二分割标识,生成所述数据块; 根据所述第二分割标识生成第二分割标识头信息, 将所述第二分割标识头信 息携带在所述第一 HTTP响应的头域中。 获取所述待获取文件的索引, 根据所述待获取文件生成校验信息, 将所述索 引、 所述校验信息和所述待获取文件依次排列形成所述数据块, 其中, 每个 所述待获取文件的索引的长度相等, 每个所述待获取文件的校验信息的长度 相等。
在本实施例中,所述接收单元 21还可以用于接收所述客户端发送的第二
HTTP请求, 其中, 所述第二 HTTP请求中携带有最后一个校验成功的待获 的索引确定至少一个未成功接收的待获取文件, 根据所述至少一个未成功接 收的待获取文件和所述第一分割标识生成第二 HTTP响应, 其中, 所述第二 HTTP 响应的数据域中携带有至少一个数据块, 每个所述数据块包括一个未 成功接收的待获取文件。所述发送单元 23还可以用于将所述第二 HTTP响应 发送给所述客户端。
图 13为本发明实施例提供的用于客户端的计算机节点结构示意图。如图
13所示, 本实施例提供的应用于客户端的计算机节点 700。 计算节点 700可 能是智能手机、 平板电脑、 个人计算机 PC、 可携带的便携式计算机或终端等 等, 本发明具体实施例并不对计算节点的具体实现做限定。 计算节点 700包 括:
处理器 (processor)710, 通信接口(Communications Interface)720 , 存储器 (memory)730, 总线 740。
处理器 710,通信接口 720,存储器 730通过总线 740完成相互间的通信。 通信接口 720, 用于与 Web服务器通信, 从向 Web服务器发送第一超文 本传送协议 HTTP请求, 其中, 所述第一 HTTP请求中携带有用于指示待获 取文件的文件对象标识, 所述待获取文件的数量为至少两个; 接收所述 Web 服务器根据所述文件对象标识发送的第一 HTTP响应,其中,所述第一 HTTP 响应的数据域中携带有至少两个数据块, 每两个数据块之间通过第一分割标 识分割, 每个所述数据块包括一个所述待获取文件。
处理器 710, 用于执行程序 732。
具体地, 程序 732可以包括程序代码, 所述程序代码包括计算机操作指 令。
处理器 710 可能是一个中央处理器 CPU, 或者是特定集成电路 ASIC
( Application Specific Integrated Circuit ) , 或者是被配置成实施本发明实施例 的一个或多个集成电路。
存储器 730,用于存放程序 732。存储器 730可能包含高速 RAM存储器, 也可能还包括非易失性存储器(non-volatile memory ) , 例如至少一个磁盘存 储器。 程序 732具体可以包括:
解析单元 13 , 用于对所述第一 HTTP响应进行解析, 得到所述至少两个 待获取文件
程序 732中单元的具体实现参见图 11所示实施例中的相应单元,在此不 赘述。
在本实施例中, 所述第一 HTTP响应的头域中携带有第一分割标识头信 息;
所述解析单元 13具体用于根据所述第一 HTTP响应的头域中的所述第一 分割标识头信息确定所述第一分割标识, 根据所述第一分割标识从所述第 ― HTTP 响应的数据域中提取通过所述第一分割标识分割的所述至少两个数据 块, 从每个所述数据块中提取所述待获取文件。 在本实施例中, 所述第一 HTTP响应的头域中还携带有第二分割标识头 信息, 每个所述数据块包括索引、 所述待获取文件和校验信息;
所述解析单元 13具体用于根据所述第一 HTTP响应的头域中的所述第二 分割标识头信息确定第二分割标识, 根据所述第二分割标识从每个所述数据 块中提取通过所述第二分割标识分割的所述索引、 所述待获取文件和所述校 验信息, 通过所述校验信息对所述待获取文件进行校验, 若校验成功, 则将 所述待获取文件和所述索引保存。
在本实施例中, 每个所述数据块包括索引、 所述待获取文件和校验信息; 所述解析单元 13具体用于获取索引长度和校验信息长度,根据所述索引 长度和所述校验信息长度, 从每个所述数据块中依次提取所述索引、 所述校 验信息和所述待获取文件, 通过所述校验信息对所述待获取文件进行校验, 若校验成功 , 则将所述待获取文件和所述索引保存。
在本实施例中, 所述通信接口 720还用于若检验失败或者在所述第一 HTTP 响应的数据域中未识别到结束标识, 则向所述 Web服务器发送第二 HTTP请求, 其中, 所述第二 HTTP请求中携带有最后一个校验成功的待获 取文件的索引; 接收所述 Web服务器发送的第二 HTTP响应, 其中, 所述第 二 HTTP响应的数据域中携带有至少一个数据块, 每个所述数据块包括一个 未成功接收的待获取文件;
所述解析单元 13还用于对所述第二 HTTP响应进行解析,得到所述未成 功接收的待获取文件。
图 14为本发明实施例提供的用于 Web服务器的计算机节点结构示意图。 如图 14所示,本实施例提供的应用于 Web服务器的计算机节点 800。计算节 点 800可能计算能力的主机服务器、 个人计算机 PC或可携带的便携式计算 机等等,本发明具体实施例并不对计算节点的具体实现做限定。计算节点 800 包括:
处理器 (processor)810, 通信接口(Communications Interface)820 , 存储器 (memory)830, 总线 840。
处理器 810,通信接口 820,存储器 830通过总线 840完成相互间的通信。 通信接口 820, 用于与客户端通信, 接收客户端发送的第一超文本传送 协议 HTTP请求, 其中, 所述第一 HTTP请求中携带有用于指示待获取文件 的文件对象标识, 所述待获取文件的数量为至少两个; 将第一 HTTP响应发 送给所述客户端。
处理器 810, 用于执行程序 832。
具体地, 程序 832可以包括程序代码, 所述程序代码包括计算机操作指 令。
处理器 810 可能是一个中央处理器 CPU, 或者是特定集成电路 ASIC ( Application Specific Integrated Circuit ) , 或者是被配置成实施本发明实施例 的一个或多个集成电路。
存储器 830,用于存放程序 832。存储器 830可能包含高速 RAM存储器, 也可能还包括非易失性存储器( non-volatile memory ) , 例如至少一个磁盘存 储器。 程序 832具体可以包括:
处理单元 22, 用于根据所述文件对象标识确定至少两个待获取文件, 获 取第一分割标识, 根据所述至少两个待获取文件和所述第一分割标识生成所 述第一 HTTP响应, 其中, 所述第一 HTTP响应的数据域中携带有至少两个 数据块, 每两个数据块之间通过所述第一分割标识分割, 每个所述数据块包 括一个所述待获取文件。
在本实施例中,所述处理单元 22具体用于根据所述第一分割标识生成第 一分割标识头信息, 将所述第一分割标识头信息携带在所述第一 HTTP响应 的头域中, 根据每个所述待获取文件分别生成所述数据块, 在每两个所述数 据块之间插入所述第一分割标识, 形成所述第一 HTTP响应的数据域。
在本实施例中, 所述处理单元 22还用于对于每个所述待获取文件, 获取 所述待获取文件的索引, 根据所述待获取文件生成校验信息, 获取第二分割 标识, 在所述索引和所述待获取文件之间插入所述第二分割标识, 在所述待 获取文件和所述校验信息之间插入所述第二分割标识, 生成所述数据块; 根 据所述第二分割标识生成第二分割标识头信息, 将所述第二分割标识头信息 携带在所述第 ― HTTP响应的头域中。
在本实施例中, 所述处理单元 22还用于对于每个所述待获取文件, 获取 所述待获取文件的索引, 根据所述待获取文件生成校验信息, 将所述索引、 所述校验信息和所述待获取文件依次排列形成所述数据块, 其中, 每个所述 待获取文件的索引的长度相等,每个所述待获取文件的校验信息的长度相等。 在本实施例中, 所述通信接口 820还用于接收所述客户端发送的第二 HTTP请求, 其中, 所述第二 HTTP请求中携带有最后一个校验成功的待获 取文件的索引; 将第二 HTTP响应发送给所述客户端。
所述处理单元 22还用于根据所述校验成功的待获取文件的索引确定至 少一个未成功接收的待获取文件, 根据所述至少一个未成功接收的待获取文 件和所述第一分割标识生成所述第二 HTTP响应, 其中, 所述第二 HTTP响 应的数据域中携带有至少一个数据块, 每个所述数据块包括一个未成功接收 的待获取文件
所属领域的技术人员可以清楚地了解到, 为描述的方便和简洁, 上述描 述的系统、 装置和单元的具体工作过程, 可以参考前述方法实施例中的对应 过程, 在此不再赘述。
在本申请所提供的几个实施例中, 应该理解到, 所揭露的系统、 装置和 方法, 可以通过其它的方式实现。 例如, 以上所描述的装置实施例仅仅是示 意性的, 例如, 所述单元的划分, 仅仅为一种逻辑功能划分, 实际实现时可 以有另外的划分方式, 例如多个单元或组件可以结合或者可以集成到另一个 系统, 或一些特征可以忽略, 或不执行。 另一点, 所显示或讨论的相互之间 的耦合或直接耦合或通信连接可以是通过一些通信接口, 装置或单元的间接 耦合或通信连接, 可以是电性, 机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的, 作 为单元显示的部件可以是或者也可以不是物理单元, 即可以位于一个地方, 或者也可以分布到多个网络单元上。 可以根据实际的需要选择其中的部分或 者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中, 也可以是各个单元单独物理存在, 也可以两个或两个以上单元集成在一个单 元中。
所述功能如果以 软件功能单元的形式实现并作为独立的产品销售或使 用时, 可以存储在一个计算机可读取存储介质中。 基于这样的理解, 本发明 的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分 可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中, 包括若干指令用以使得一台计算机设备(可以是个人计算机, 服务器, 或者 网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。 而前述的 存储介质包括: U盘、 移动硬盘、 只读存储器(ROM, Read-Only Memory ) 、 随机存取存储器 ( RAM, Random Access Memory ) 、 磁碟或者光盘等各种可 以存储程序代码的介质。
本领域普通技术人员可以理解: 实现上述方法实施例的全部或部分步骤 可以通过程序指令相关的硬件来完成, 前述的程序可以存储于一计算机可读 取存储介质中, 该程序在执行时, 执行包括上述方法实施例的步骤; 而前述 的存储介质包括: ROM, RAM, 磁碟或者光盘等各种可以存储程序代码的介 质。
最后应说明的是: 以上各实施例仅用以说明本发明的技术方案, 而非对 其限制; 尽管参照前述各实施例对本发明进行了详细的说明, 本领域的普通 技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改, 或者对其中部分或者全部技术特征进行等同替换; 而这些修改或者替换, 并 不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims

权 利 要 求 书
1、 一种批量文件传输方法, 其特征在于, 包括:
向 Web服务器发送第一超文本传送协议 HTTP请求, 其中, 所述第一 HTTP请求中携带有用于指示待获取文件的文件对象标识, 所述待获取文件 的数量为至少两个;
接收所述 Web服务器根据所述文件对象标识发送的第一 HTTP响应, 其 中, 所述第一 HTTP响应的数据域中携带有至少两个数据块, 每两个数据块 之间通过第一分割标识分割, 每个所述数据块包括一个所述待获取文件; 对所述第一 HTTP响应进行解析, 得到所述至少两个待获取文件。
2、 根据权利要求 1 所述的批量文件传输方法, 其特征在于: 所述第一
HTTP响应的头域中携带有第一分割标识头信息;
所述对所述第一 HTTP响应进行解析, 得到所述至少两个待获取文件, 包括:
根据所述第一 HTTP响应的头域中的所述第一分割标识头信息确定所述 第一分割标识, 根据所述第一分割标识从所述第一 HTTP响应的数据域中提 取通过所述第一分割标识分割的所述至少两个数据块, 从每个所述数据块中 提取所述待获取文件。
3、 根据权利要求 2 所述的批量文件传输方法, 其特征在于: 所述第一 HTTP 响应的头域中还携带有第二分割标识头信息, 每个所述数据块包括索 引、 所述待获取文件和校验信息;
所述从每个所述数据块中提取所述待获取文件, 包括:
根据所述第一 HTTP响应的头域中的所述第二分割标识头信息确定第二 分割标识, 根据所述第二分割标识从每个所述数据块中提取通过所述第二分 割标识分割的所述索引、 所述待获取文件和所述校验信息, 通过所述校验信 息对所述待获取文件进行校验, 若校验成功, 则将所述待获取文件和所述索 引保存。
4、 根据权利要求 2所述的批量文件传输方法, 其特征在于, 每个所述数 据块包括索引、 所述待获取文件和校验信息;
所述从每个所述数据块中提取所述待获取文件, 包括为:
获取索引长度和校验信息长度,根据所述索引长度和所述校验信息长度, 从每个所述数据块中依次提取所述索引、 所述校验信息和所述待获取文件, 通过所述校验信息对所述待获取文件进行校验, 若校验成功, 则将所述待获 取文件和所述索引保存。
5、根据权利要求 3或 4所述的批量文件传输方法,其特征在于,还包括: 若检验失败或者在所述第一 HTTP响应的数据域中未识别到结束标识, 则向所述 Web服务器发送第二 HTTP请求, 其中, 所述第二 HTTP请求中携 带有最后一个校验成功的待获取文件的索引;
接收所述 Web服务器发送的第二 HTTP响应, 其中, 所述第二 HTTP响 应的数据域中携带有至少一个数据块, 每个所述数据块包括一个未成功接收 的待获取文件;
对所述第二 HTTP响应进行解析, 得到所述未成功接收的待获取文件。
6、 一种批量文件传输方法, 其特征在于, 包括:
接收客户端发送的第一超文本传送协议 HTTP 请求, 其中, 所述第一 HTTP请求中携带有用于指示待获取文件的文件对象标识, 所述待获取文件 的数量为至少两个;
根据所述文件对象标识确定至少两个待获取文件, 获取第一分割标识, 根据所述至少两个待获取文件和所述第一分割标识生成第一 HTTP响应, 将 所述第 ― HTTP响应发送给所述客户端, 其中, 所述第 ― HTTP响应的数据 域中携带有至少两个数据块,每两个数据块之间通过所述第一分割标识分割, 每个所述数据块包括一个所述待获取文件。
7、 根据权利要求 6所述的批量文件传输方法, 其特征在于, 所述根据所 述至少两个待获取文件和所述第一分割标识生成第一 HTTP响应, 包括: 根据所述第一分割标识生成第一分割标识头信息, 将所述第一分割标识 头信息携带在所述第一 HTTP响应的头域中, 根据每个所述待获取文件分别 生成所述数据块, 在每两个所述数据块之间插入所述第一分割标识, 形成所 述第一 HTTP响应的数据域。
8、 根据权利要求 7所述的批量文件传输方法, 其特征在于, 所述根据每 个所述待获取文件分别生成所述数据块, 包括:
对于每个所述待获取文件, 获取所述待获取文件的索引, 根据所述待获 取文件生成校验信息, 获取第二分割标识, 在所述索引和所述待获取文件之 间插入所述第二分割标识, 在所述待获取文件和所述校验信息之间插入所述 第二分割标识, 生成所述数据块;
所述根据所述至少两个待获取文件和所述第一分割标识生成第一 HTTP 响应, 还包括:
根据所述第二分割标识生成第二分割标识头信息, 将所述第二分割标识 头信息携带在所述第一 HTTP响应的头域中。
9、 根据权利要求 7所述的批量文件传输方法, 其特征在于, 所述根据每 个所述待获取文件分别生成所述数据块, 包括:
对于每个所述待获取文件, 获取所述待获取文件的索引, 根据所述待获 取文件生成校验信息, 将所述索引、 所述校验信息和所述待获取文件依次排 列形成所述数据块, 其中, 每个所述待获取文件的索引的长度相等, 每个所 述待获取文件的校验信息的长度相等。
10、 根据权利要求 8或 9所述的批量文件传输方法, 其特征在于, 还包 括:
接收所述客户端发送的第二 HTTP请求, 其中, 所述第二 HTTP请求中 携带有最后一个校验成功的待获取文件的索引;
根据所述校验成功的待获取文件的索引确定至少一个未成功接收的待获 取文件, 根据所述至少一个未成功接收的待获取文件和所述第一分割标识生 成第二 HTTP响应, 其中, 所述第二 HTTP响应的数据域中携带有至少一个 数据块, 每个所述数据块包括一个未成功接收的待获取文件;
将所述第二 HTTP响应发送给所述客户端。
11、 一种客户端, 其特征在于, 包括:
请求单元, 用于向 Web服务器发送第一超文本传送协议 HTTP请求, 其 中, 所述第一 HTTP请求中携带有用于指示待获取文件的文件对象标识, 所 述待获取文件的数量为至少两个;
接收单元, 用于接收所述 Web服务器根据所述文件对象标识发送的第一 HTTP响应, 其中, 所述第一 HTTP响应的数据域中携带有至少两个数据块, 每两个数据块之间通过第一分割标识分割, 每个所述数据块包括一个所述待 获取文件;
解析单元, 与所述接收单元相连, 用于对所述第一 HTTP响应进行解析, 得到所述至少两个待获取文件。
12、 根据权利要求 11所述的客户端, 其特征在于: 所述第一 HTTP响应 的头域中携带有第一分割标识头信息;
所述解析单元具体用于根据所述第一 HTTP响应的头域中的所述第一分 割标识头信息确定所述第一分割标识, 根据所述第一分割标识从所述第 ― HTTP 响应的数据域中提取通过所述第一分割标识分割的所述至少两个数据 块, 从每个所述数据块中提取所述待获取文件。
13、 根据权利要求 12所述的客户端, 其特征在于: 所述第一 HTTP响应 的头域中还携带有第二分割标识头信息, 每个所述数据块包括索引、 所述待 获取文件和校验信息;
所述解析单元具体用于根据所述第一 HTTP响应的头域中的所述第二分 割标识头信息确定第二分割标识, 根据所述第二分割标识从每个所述数据块 中提取通过所述第二分割标识分割的所述索引、 所述待获取文件和所述校验 信息, 通过所述校验信息对所述待获取文件进行校验, 若校验成功, 则将所 述待获取文件和所述索引保存。
14、 根据权利要求 12所述的客户端, 其特征在于: 每个所述数据块包括 索引、 所述待获取文件和校验信息;
所述解析单元具体用于获取索引长度和校验信息长度, 根据所述索引长 度和所述校验信息长度, 从每个所述数据块中依次提取所述索引、 所述校验 信息和所述待获取文件, 通过所述校验信息对所述待获取文件进行校验, 若 校验成功, 则将所述待获取文件和所述索引保存。
15、 根据权利要求 13或 14所述的客户端, 其特征在于:
所述请求单元还用于若检验失败或者在所述第一 HTTP响应的数据域中 未识别到结束标识, 则向所述 Web服务器发送第二 HTTP请求, 其中, 所述 第二 HTTP请求中携带有最后一个校验成功的待获取文件的索引;
所述接收单元还用于接收所述 Web服务器发送的第二 HTTP响应,其中, 所述第二 HTTP响应的数据域中携带有至少一个数据块, 每个所述数据块包 括一个未成功接收的待获取文件;
所述解析单元还用于对所述第二 HTTP响应进行解析, 得到所述未成功 接收的待获取文件。
16、 一种 Web服务器, 其特征在于, 包括:
接收单元, 用于接收客户端发送的第一超文本传送协议 HTTP请求, 其 中, 所述第一 HTTP请求中携带有用于指示待获取文件的文件对象标识, 所 述待获取文件的数量为至少两个;
处理单元, 与所述接收单元相连, 用于根据所述文件对象标识确定至少 两个待获取文件, 获取第一分割标识, 根据所述至少两个待获取文件和所述 第一分割标识生成第 ― HTTP响应, 其中, 所述第 ― HTTP响应的数据域中 携带有至少两个数据块, 每两个数据块之间通过所述第一分割标识分割, 每 个所述数据块包括一个所述待获取文件;
发送单元, 与所述处理单元相连, 用于将所述第一 HTTP响应发送给所 述客户端。
17、 根据权利要求 16所述的 Web服务器, 其特征在于: 所述处理单元 具体用于根据所述第一分割标识生成第一分割标识头信息, 将所述第一分割 标识头信息携带在所述第一 HTTP响应的头域中, 根据每个所述待获取文件 分别生成所述数据块, 在每两个所述数据块之间插入所述第一分割标识, 形 成所述第一 HTTP响应的数据域。
18、 根据权利要求 17所述的 Web服务器, 其特征在于: 所述处理单元 还用于对于每个所述待获取文件, 获取所述待获取文件的索引, 根据所述待 获取文件生成校验信息, 获取第二分割标识, 在所述索引和所述待获取文件 之间插入所述第二分割标识, 在所述待获取文件和所述校验信息之间插入所 述第二分割标识, 生成所述数据块; 根据所述第二分割标识生成第二分割标 识头信息,将所述第二分割标识头信息携带在所述第一 HTTP响应的头域中。
19、 根据权利要求 17所述的 Web服务器, 其特征在于: 所述处理单元 还用于对于每个所述待获取文件, 获取所述待获取文件的索引, 根据所述待 获取文件生成校验信息, 将所述索引、 所述校验信息和所述待获取文件依次 排列形成所述数据块, 其中, 每个所述待获取文件的索引的长度相等, 每个 所述待获取文件的校验信息的长度相等。
20、 根据权利要求 18或 19所述的 Web服务器, 其特征在于:
所述接收单元还用于接收所述客户端发送的第二 HTTP请求, 其中, 所 述第二 HTTP请求中携带有最后一个校验成功的待获取文件的索引; 所述处理单元还用于根据所述校验成功的待获取文件的索引确定至少一 个未成功接收的待获取文件, 根据所述至少一个未成功接收的待获取文件和 所述第一分割标识生成第二 HTTP响应, 其中, 所述第二 HTTP响应的数据 域中携带有至少一个数据块, 每个所述数据块包括一个未成功接收的待获取 文件;
所述发送单元还用于将所述第二 HTTP响应发送给所述客户端。
21、 一种用于客户端的计算机节点, 其特征在于, 所述计算节点包括处 理器, 通信接口, 存储器和总线:
其中所述处理器、 所述通信接口和所述存储器通过总线完成相互间的通 信;
所述通信接口, 用于从向 Web服务器发送第一超文本传送协议 HTTP请 求, 其中, 所述第一 HTTP请求中携带有用于指示待获取文件的文件对象标 识, 所述待获取文件的数量为至少两个; 接收所述 Web服务器根据所述文件 对象标识发送的第一 HTTP响应, 其中, 所述第一 HTTP响应的数据域中携 带有至少两个数据块, 每两个数据块之间通过第一分割标识分割, 每个所述 数据块包括一个所述待获取文件;
所述处理器, 用于执行程序;
所述存储器, 用于存放所述程序;
其中所述程序, 用于对所述第一 HTTP响应进行解析, 得到所述至少两 个待获取文件。
22、 根据权利要求 21所述的用于客户端的计算机节点, 其特征在于: 所 述第 ― HTTP响应的头域中携带有第一分割标识头信息;
所述程序具体用于根据所述第一 HTTP响应的头域中的所述第一分割标 识头信息确定所述第一分割标识, 根据所述第一分割标识从所述第一 HTTP 响应的数据域中提取通过所述第一分割标识分割的所述至少两个数据块, 从 每个所述数据块中提取所述待获取文件。
23、 根据权利要求 22所述的用于客户端的计算机节点, 其特征在于: 所 述第一 HTTP响应的头域中还携带有第二分割标识头信息, 每个所述数据块 包括索引、 所述待获取文件和校验信息;
所述程序具体用于根据所述第一 HTTP响应的头域中的所述第二分割标 识头信息确定第二分割标识, 根据所述第二分割标识从每个所述数据块中提 取通过所述第二分割标识分割的所述索引、所述待获取文件和所述校验信息, 通过所述校验信息对所述待获取文件进行校验, 若校验成功, 则将所述待获 取文件和所述索引保存。
24、 根据权利要求 22所述的用于客户端的计算机节点, 其特征在于: 每 个所述数据块包括索引、 所述待获取文件和校验信息;
所述程序具体用于获取索引长度和校验信息长度, 根据所述索引长度和 所述校验信息长度, 从每个所述数据块中依次提取所述索引、 所述校验信息 和所述待获取文件, 通过所述校验信息对所述待获取文件进行校验, 若校验 成功, 则将所述待获取文件和所述索引保存。
25、 根据权利要求 23或 24所述的用于客户端的计算机节点, 其特征在 于:
所述通信接口还用于若检验失败或者在所述第一 HTTP响应的数据域中 未识别到结束标识, 则向所述 Web服务器发送第二 HTTP请求, 其中, 所述 第二 HTTP请求中携带有最后一个校验成功的待获取文件的索引; 接收所述 Web服务器发送的第二 HTTP响应, 其中, 所述第二 HTTP响应的数据域中 携带有至少一个数据块,每个所述数据块包括一个未成功接收的待获取文件; 所述程序还用于对所述第二 HTTP响应进行解析, 得到所述未成功接收 的待获取文件。
26、 一种用于 Web服务器的计算机节点, 其特征在于, 所述计算节点包 括处理器, 通信接口, 存储器和总线:
其中所述处理器、所述通信接口和所述存储器通过总线完成相互间的通信; 所述通信接口,用于接收客户端发送的第一超文本传送协议 HTTP请求, 其中, 所述第一 HTTP请求中携带有用于指示待获取文件的文件对象标识, 所述待获取文件的数量为至少两个; 将第一 HTTP响应发送给所述客户端; 所述处理器, 用于执行程序;
所述存储器, 用于存放所述程序;
其中所述程序, 用于根据所述文件对象标识确定至少两个待获取文件, 获取第一分割标识, 根据所述至少两个待获取文件和所述第一分割标识生成 所述第一 HTTP响应, 其中, 所述第一 HTTP响应的数据域中携带有至少两 个数据块, 每两个数据块之间通过所述第一分割标识分割, 每个所述数据块 包括一个所述待获取文件。
27、 根据权利要求 26所述的用于 Web服务器的计算机节点, 其特征在 于:
所述程序具体用于根据所述第一分割标识生成第一分割标识头信息, 将 所述第一分割标识头信息携带在所述第一 HTTP响应的头域中, 根据每个所 述待获取文件分别生成所述数据块, 在每两个所述数据块之间插入所述第一 分割标识, 形成所述第一 HTTP响应的数据域。
28、 根据权利要求 27所述的用于 Web服务器的计算机节点, 其特征在 于:
所述程序还用于对于每个所述待获取文件,获取所述待获取文件的索引, 根据所述待获取文件生成校验信息, 获取第二分割标识, 在所述索引和所述 待获取文件之间插入所述第二分割标识, 在所述待获取文件和所述校验信息 之间插入所述第二分割标识, 生成所述数据块; 根据所述第二分割标识生成 第二分割标识头信息, 将所述第二分割标识头信息携带在所述第一 HTTP响 应的头域中。
29、 根据权利要求 27所述的用于 Web服务器的计算机节点, 其特征在于: 所述程序还用于对于每个所述待获取文件,获取所述待获取文件的索引, 根据所述待获取文件生成校验信息, 将所述索引、 所述校验信息和所述待获 取文件依次排列形成所述数据块, 其中, 每个所述待获取文件的索引的长度 相等, 每个所述待获取文件的校验信息的长度相等。
30、 根据权利要求 28或 29所述的用于 Web服务器的计算机节点, 其特 征在于:
所述通信接口还用于接收所述客户端发送的第二 HTTP请求, 其中, 所 述第二 HTTP请求中携带有最后一个校验成功的待获取文件的索引; 将第二 HTTP响应发送给所述客户端。
所述程序还用于根据所述校验成功的待获取文件的索引确定至少一个未 成功接收的待获取文件,根据所述至少一个未成功接收的待获取文件和所述第 一分割标识生成所述第二 HTTP响应, 其中, 所述第二 HTTP响应的数据域中 携带有至少一个数据块, 每个所述数据块包括一个未成功接收的待获取文件。
PCT/CN2012/085740 2012-12-03 2012-12-03 批量文件传输方法及设备 WO2014085959A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201280002902.8A CN103229486B (zh) 2012-12-03 2012-12-03 批量文件传输方法及设备
PCT/CN2012/085740 WO2014085959A1 (zh) 2012-12-03 2012-12-03 批量文件传输方法及设备

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2012/085740 WO2014085959A1 (zh) 2012-12-03 2012-12-03 批量文件传输方法及设备

Publications (1)

Publication Number Publication Date
WO2014085959A1 true WO2014085959A1 (zh) 2014-06-12

Family

ID=48838361

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/085740 WO2014085959A1 (zh) 2012-12-03 2012-12-03 批量文件传输方法及设备

Country Status (2)

Country Link
CN (1) CN103229486B (zh)
WO (1) WO2014085959A1 (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106656920B (zh) * 2015-10-30 2019-09-06 北京国双科技有限公司 Http服务的处理方法、装置、存储介质及处理器
CN109600403B (zh) * 2017-09-30 2021-11-02 北京国双科技有限公司 一种发送信息的方法及装置
CN109150984B (zh) * 2018-07-27 2021-11-02 平安科技(深圳)有限公司 获取数据资源的方法和装置
CN110120938B (zh) * 2019-04-02 2021-11-16 视联动力信息技术股份有限公司 一种协转服务器的控制方法和装置
CN110162619A (zh) * 2019-05-27 2019-08-23 上海吉江数据技术有限公司 在线对比阅读系统、方法及装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1801804A (zh) * 2005-01-31 2006-07-12 刘体元 批量上载文件方法及系统
CN102164178A (zh) * 2011-03-28 2011-08-24 华为技术有限公司 内容获取方法及客户端
CN102497415A (zh) * 2011-03-22 2012-06-13 苏州阔地网络科技有限公司 一种文件批量处理的传输控制方法及系统
CN102571739A (zh) * 2011-05-26 2012-07-11 中兴通讯股份有限公司 批量数据的传输方法及装置

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102420840A (zh) * 2010-09-27 2012-04-18 西安龙飞软件有限公司 一种基于brew的Http递进式视频播放器的实现方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1801804A (zh) * 2005-01-31 2006-07-12 刘体元 批量上载文件方法及系统
CN102497415A (zh) * 2011-03-22 2012-06-13 苏州阔地网络科技有限公司 一种文件批量处理的传输控制方法及系统
CN102164178A (zh) * 2011-03-28 2011-08-24 华为技术有限公司 内容获取方法及客户端
CN102571739A (zh) * 2011-05-26 2012-07-11 中兴通讯股份有限公司 批量数据的传输方法及装置

Also Published As

Publication number Publication date
CN103229486B (zh) 2016-10-05
CN103229486A (zh) 2013-07-31

Similar Documents

Publication Publication Date Title
CN104320377B (zh) 一种流媒体文件的防盗链方法及设备
JP5792850B2 (ja) ネットワーク上でのファイルフォルダ送信
US7702917B2 (en) Data transfer using hyper-text transfer protocol (HTTP) query strings
EP2633667B1 (en) System and method for on the fly protocol conversion in obtaining policy enforcement information
US10693858B2 (en) CDN-based access control method and related device
EP3297243B1 (en) Trusted login method and device
WO2013143403A1 (zh) 一种访问网站的方法和系统
WO2014085959A1 (zh) 批量文件传输方法及设备
WO2009046642A1 (fr) Procédé de distribution de données, système distribution de données et dispositifs de corrélation dans un réseau périphérique
CN103347092A (zh) 一种识别缓存文件的方法及装置
WO2012034518A1 (zh) 一种提供包含网页地址的消息的方法和系统
WO2016127436A1 (zh) 数据上载的方法、装置及系统
WO2014000148A1 (zh) 一种资源获取方法及装置
US9473592B2 (en) Methods for optimizing a web content proxy server and devices thereof
WO2012139474A1 (zh) 数据的获取方法、设备和系统
WO2017097106A1 (zh) 一种文件差量的传输方法以及装置
WO2013078797A1 (zh) 网络文件传输方法及系统
CN102833327B (zh) 基于http的客户端类型的识别方法和装置
CN110730189B (zh) 一种通信认证方法、装置、设备及存储介质
WO2013091345A1 (zh) 无线网页浏览资源优化方法、装置及系统
US20130268662A1 (en) Hypertext transfer protocol http stream association method and device
CA2848175A1 (en) Methods for optimizing a web content proxy server and devices thereof
WO2014166078A1 (zh) 数据发送处理方法及路由器
JP6089346B2 (ja) オブジェクトを取得する方法、装置およびシステム
US20140310341A1 (en) Information processing apparatus, system, method and medium

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: 12889649

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 14397165

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12889649

Country of ref document: EP

Kind code of ref document: A1