CN106572135A - Network request processing method and device - Google Patents
Network request processing method and device Download PDFInfo
- Publication number
- CN106572135A CN106572135A CN201510650373.8A CN201510650373A CN106572135A CN 106572135 A CN106572135 A CN 106572135A CN 201510650373 A CN201510650373 A CN 201510650373A CN 106572135 A CN106572135 A CN 106572135A
- Authority
- CN
- China
- Prior art keywords
- request
- text
- merging
- length
- amalgamation result
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
Abstract
The invention discloses a network request processing method and device. The processing method comprises the following steps: a plurality of requests are obtained, request texts of the plurality of requests are combined and therefore a combined text is obtained; length of the combined text is less than or equal to a preset threshold value, and a combination request carrying the combined text is sent to a server. The network request processing method and device helps solve a technical problem that network resources are wasted when http requests are sent via a client end, and network resources can be saved when network requests are sent.
Description
Technical field
The present invention relates to data processing field, in particular to a kind of processing method and processing device of network request.
Background technology
Fig. 1 is a kind of theory diagram of the HTML protocol communications according to prior art, as shown in figure 1, in input request
URL (i.e. output URL in Fig. 1) after, http clients (i.e. http browsers) initiate http please
Ask, the request includes:Request row, request header and request body.Set up a Socket to http-server designated port
Connection.Then http-server processes http request.The http that client is sended over is monitored in designated port
Request.Once receiving http request, server (to client) returns a statusline and (response) message,
File, error message or some other information that the message body of message is possibly asked.Http browsers respond http
Request, the response http request include answer code, head response and response body.
Wherein, Socket:Commonly referred to as " socket ", for describing IP address and port, it is a communication chain
Handle, can be used to realize the communication between different virtual machine or different computers.Two programs on network pass through
The exchange of data is realized in one two-way communication connection, and one end of this connection is referred to as a socket.
Http protocol (Hypertext Transfer Protocol, HTTP) supports B/S
(Browser/Server, browser/server framework) system and C/S (Client/Server client terminals/service
Device framework) system, what requesting method was conventional has GET, HEAD, POST etc., be in current internet communication using than
A kind of wide agreement, http protocol request row are made up of three parts:Request row, message header ask text.
Request row is started with a method symbol, is separated with space, is followed by the version of the URL and agreement asked.
As HTTP is stateless agreement, connection every time only processes a request, and the company of foundation is needed before receiving request
Connect, after terminating, need release connection.Wherein, stateless refers to that agreement does not have memory ability for issued transaction.Lack
If state means that subsequent treatment needs information above, it must retransmit, and may so cause connection every time to pass
The data volume increase sent.On the other hand, when server does not need previous message, its response is just very fast.
In HTML protocols, such a case, such as one get requests transmission request every time are frequently encountered
Parameter length is very little, and the time spent in each foundation connection of Socket connections and release connection will be much larger than very
It is used for the time of data transfer.If HTML sends, request frequency is high, and actually the utilization rate of transmission is all very every time
Low.If asked, text is very short, and the time is all wasted in request substantially, and the proportion of http request head is very
Greatly, the wasting of resources can be greatly caused, and increases bandwidth.
Waste the problem of Internet resources, not yet propose at present effectively to solve when http request is sent for above-mentioned client
Certainly scheme.
The content of the invention
A kind of processing method and processing device of network request is embodiments provided, at least to solve wave during http request
Take the technical problem of Internet resources.
A kind of one side according to embodiments of the present invention, there is provided processing method of network request, the processing method bag
Include:Obtain multiple requests;The request text of multiple requests is merged and obtains merging text, wherein, merge the length of text
Degree is less than or equal to predetermined threshold value;The merging request transmission for merging text will be carried to server.
Further, the request text merging of multiple requests is obtained merging text includes:Multiple from multiple requests please
First request start of text in text is asked to perform following steps, until the length of amalgamation result is more than predetermined threshold value,
And using the amalgamation result of last circulate operation as the request text for merging request, wherein, current request text is first
Beginning turns to first request text;Obtain the next request text in multiple request texts;To current request text and
Next request text is merged, and obtains amalgamation result;If the length of amalgamation result is less than or equal to predetermined threshold value,
Using amalgamation result as circulate operation next time current request text.
Further, current request text and next request text are merged, obtaining amalgamation result includes:It is logical
Cross separator current request text and next request text join end to end, obtain amalgamation result, wherein, merge knot
Length of the length of fruit for current request text, the sum of the length of the length and separator of next request text.
Further, the next request text obtained in multiple request texts includes:By generate multiple requests according to
Time sequencing is saved into request queue;Next request is obtained from request queue, and extracts corresponding with next request
Next request text.
Another aspect according to embodiments of the present invention, additionally provides a kind of processing method of network request, the processing method
Including:The merging request that client sends is received, wherein, merge request to carry the request for merging text, merge
Text is obtained by merging the request text of multiple requests;Decomposed based on the separator in the request text for merging request and closed
And request obtains multiple requests;The response message of multiple requests is back to into client.
Another aspect according to embodiments of the present invention, additionally provides a kind of processing meanss of network request, the processing meanss
Including:Acquisition module, for obtaining multiple requests;Merging module, for the request text of multiple requests is merged
To merging text, wherein, the length for merging text is less than or equal to predetermined threshold value;Sending module, for conjunction will be carried
And the merging request of text is sent to server.
Further, merging module includes:Loop module, for first from multiple request texts of multiple requests
Individual request start of text, calls acquisition module, merges submodule and judge module, until the length of amalgamation result is more than pre-
If threshold value, and using the amalgamation result of last circulate operation as the request text for merging request, wherein, current request
Text is initialized to first request text;Acquisition module, for obtaining the next request in multiple request texts
Text;Merge submodule, for merging to current request text and next request text, obtain amalgamation result;
Judge module, if the length for amalgamation result is less than or equal to predetermined threshold value, using amalgamation result as circulating next time
The current request text of operation.
Further, merging submodule includes:Processing module, for by separator by current request text and next
Individual request text joins end to end, and obtains amalgamation result, wherein, the length of amalgamation result for current request text length,
The sum of the length of the length and separator of next request text.
Further, acquisition module includes:Preserving module, for the multiple requests for generating are preserved sequentially in time
Enter request queue;Extraction module, for next request is obtained from request queue, and extracts right with next request
The next request text answered.
Another aspect according to embodiments of the present invention, additionally provides a kind of processing meanss of network request, the processing meanss
Including:Receiver module, for receiving the merging request of client transmission, wherein, merge request just to carry merging
The request of text, merges text and is obtained by merging the request text of multiple requests;Decomposing module, for being asked based on merging
Separator in the request text asked decomposes merging request and obtains multiple requests;Module is returned, for by multiple requests
Response message is back to client.
In embodiments of the present invention, after client is got because of the multiple requests produced by user's triggering, client
The request text of multiple requests can be merged the merging text for length being obtained less than predetermined threshold value, then will carry the conjunction
And the merging request of text is sent to server.By above-described embodiment, can improve
During the request of request text, due to losing time caused by the proportion of request header institute bigger than request text and taking larger band
Wide phenomenon, so as to the mode for utilizing the request text by multiple requests to merge, reduces transmitted per unit time request
Quantity, reached the purpose for reducing bandwidth, and then when solving http request, wasted the technical problem of Internet resources,
Realize the technique effect that client saves Internet resources when network request is carried out.
Description of the drawings
Accompanying drawing described herein is used for providing a further understanding of the present invention, constitutes the part of the application, this
Bright schematic description and description does not constitute inappropriate limitation of the present invention for explaining the present invention.In accompanying drawing
In:
Fig. 1 is a kind of theory diagram of the HTML protocol communications according to prior art;
Fig. 2 is a kind of flow chart of the processing method of network request according to embodiments of the present invention;
Fig. 3 is the theory diagram of the merging of network request text according to embodiments of the present invention;
Fig. 4 is the flow chart of the processing method of another kind of network request according to embodiments of the present invention;
Fig. 5 is a kind of schematic diagram of the processing meanss of network request according to embodiments of the present invention;And
Fig. 6 is the schematic diagram of the processing meanss of another kind of network request according to embodiments of the present invention.
Specific embodiment
In order that those skilled in the art more fully understand the present invention program, below in conjunction with the embodiment of the present invention
Accompanying drawing, is clearly and completely described to the technical scheme in the embodiment of the present invention, it is clear that described embodiment
The only embodiment of a present invention part, rather than the embodiment of whole.Based on the embodiment in the present invention, ability
The every other embodiment obtained under the premise of creative work is not made by domain those of ordinary skill, should all belong to
The scope of protection of the invention.
It should be noted that description and claims of this specification and the term " first " in above-mentioned accompanying drawing, "
Two " it is etc. for distinguishing similar object, without for describing specific order or precedence.It should be appreciated that this
The data that sample is used can be exchanged in the appropriate case, so as to embodiments of the invention described herein can with except
Here the order beyond those for illustrating or describing is implemented.Additionally, term " comprising " and " having " and they
Any deformation, it is intended that cover non-exclusive process, the side for including, for example, containing series of steps or unit
Method, system, product or equipment are not necessarily limited to those steps clearly listed or unit, but may include unclear
List or other intrinsic for these processes, method, product or equipment step or unit.
Embodiment 1
According to embodiments of the present invention, there is provided a kind of embodiment of the processing method of network request, it should be noted that
Can perform in the such as computer system of one group of computer executable instructions the step of the flow process of accompanying drawing is illustrated,
And, although show logical order in flow charts, but in some cases, can be with suitable different from herein
Sequence performs shown or described step.
Fig. 2 is a kind of flow chart of the processing method of network request according to embodiments of the present invention, as shown in Fig. 2 should
Processing method comprises the steps:
Step S202, obtains multiple requests.
Step S204, the request text of multiple requests is merged and obtains merging text, wherein, the length for merging text is little
In equal to predetermined threshold value.
Step S206, will carry the merging request transmission for merging text to server.
Using the above embodiment of the present invention, after client is got because of the multiple requests produced by user's triggering, visitor
The request text of multiple requests can be merged the merging text for obtaining length less than predetermined threshold value at family end, then will carry
The merging request of the merging text is sent to server.By above-described embodiment, can improve and individually transmission is carried
It is shorter request text request when, due to request header proportion than request text it is big institute caused by lose time and take compared with
The phenomenon of big bandwidth, so as to the mode for utilizing the request text by multiple requests to merge, reduces transmitted per unit time
The quantity of request, has reached the purpose for reducing bandwidth, and then has solved waste network money when client sends http request
The technical problem in source, realizes the effect that client saves Internet resources when request is sent.
Alternatively, the request text merging of multiple requests being obtained merging text can include:From the multiple of multiple requests
First request start of text in request text, performs following steps, until the length of amalgamation result is more than predetermined threshold value,
And using the amalgamation result of last circulate operation as the request text for merging request, wherein, current request text is first
Beginning turns to first request text:Obtain the next request text in multiple request texts;To current request text and
Next request text is merged, and obtains amalgamation result;If the length of amalgamation result is less than or equal to predetermined threshold value,
Using amalgamation result as circulate operation next time current request text.
In the above-described embodiments, after client gets multiple requests produced because user triggers, from multiple requests
Multiple request texts in first request start of text perform circulate operation, the circulation comprises the steps:By
One request text is initialized as current request text;Obtain next request text;Current request text and the next one
Request text merging obtains amalgamation result, if the length of amalgamation result is less than or equal to predetermined threshold value, the amalgamation result is made
For the current request text for circulating next time.Multiple request texts are repeated in performing circulate operation, until currently please
Text and the length of the amalgamation result of next request text is asked to be more than predetermined threshold value, then by the conjunction of last circulate operation
And result is used as the request text for merging request, then the merging request transmission for merging text will be carried to server.It is logical
Above-described embodiment is crossed, the length of text is asked by automatic decision, merged request text the mechanism for sending, realize
Client is fast and effectively merged and the effect for sending to the request text of multiple requests.
Specifically, after client gets multiple requests produced because user triggers, multiple from multiple requests please
Ask first in text request start of text to be judged, can first judge the length of this first request text, such as
Really the length of this first request text is less than or equal to predetermined threshold value, then in judging multiple request texts of multiple requests
The length of second request text.Wherein, predetermined threshold value can be HTML protocol uniform resource localizer (Uniform
Resource Locator, URL) maximum that limits, such as restriction of the IE browser to URL length is 2000 bytes,
Restriction of other browsers to URL length is generally higher than IE browser.
The concrete determination methods of length for judging second request text are:Using first request text as current request
Text, and second request text (the next request texts in i.e. multiple request texts) is obtained, first is asked
Text (i.e. current request text) and second request text (i.e. next request text) merge, if merging
As a result length is less than or equal to predetermined threshold value, then judge the length of the 3rd request text in multiple request texts.
The concrete determination methods of length for judging the 3rd request text are:By first request text and second request
The amalgamation result of text as current request text, and obtain the 3rd request text (i.e. it is multiple request texts under
One request text), to first request text and the amalgamation result (i.e. current request text) of second request text
Merge with the 3rd request text (i.e. next request text), if the first request text for obtaining, second
The length of the amalgamation result of individual request text and the 3rd request text is less than or equal to predetermined threshold value, then judge multiple requests
The length of the 4th request text in text.
The concrete determination methods of length for judging the 4th request text are:Text, second request are asked by first
The amalgamation result of text and the 3rd request text is used as current request text, and it is (i.e. more to obtain the 4th request text
Next request text in individual request text), to first request text, second request text and the 3rd request
The amalgamation result (i.e. current request text) of text and the 4th request text (i.e. next request text) are closed
And, the amalgamation result of first request text, second request text and the 3rd request text is obtained, if the merging
As a result length is less than or equal to predetermined threshold value, then judge the length of the 5th request text in multiple request texts.
The method for judging second request text of concrete determination methods and above-mentioned judgement of the 5th request text is consistent, and
By that analogy, operation is circulated, the length of next request text is judged.Judge the method for subsequent request text all
It is consistent with the method for second request text of above-mentioned judgement, will not be described here.
If when n-th request text were judged, the merging to first request text to (N-1) individual request text
As a result (i.e. current request text) and n-th request text (i.e. next request text) are merged, and obtain the
One request text to n-th asks the amalgamation result of text, if the length of the amalgamation result is more than predetermined threshold value,
By the amalgamation result (amalgamation result of i.e. last circulate operation) of first request text to (N-1) individual request text
As the request text for merging request, then the merging request transmission for merging text will be carried to server.N is nature
Number.
It should be noted that the length of above-mentioned request text is generally less than the maximum that HTML agreements URL are limited, it is above-mentioned
The judgement to first request text in judge process can be omitted, and can directly judge the length of second request text
Degree, that is, judge whether first request text and the amalgamation result of second request text are less than or equal to predetermined threshold value.
The request text merging of multiple requests is obtained merging text can include:From multiple request texts of multiple requests
In first request start of text perform following steps, until the length of amalgamation result is more than predetermined threshold value, and will be upper
Request text of the amalgamation result of one cycle operation as merging request, wherein, current request text is initialized to
First request text:Obtain the next request text in multiple request texts;To current request text and the next one
Request text is merged, and obtains amalgamation result;If the length of amalgamation result is less than or equal to predetermined threshold value, will merge
As a result as the current request text of circulate operation next time.
The process that the request text of multiple requests merges is described in detail with reference to Fig. 3.
If as shown in figure 3, serial number N of multiple request texts of multiple requests, wherein, N is natural number, if many
The length of first request text N1 in individual request text is 200 bytes (i.e. N1 length=200 byte), the
The length of two request text N2 is 300 bytes (i.e. N2 length=300 byte), the 3rd request text N3's
Length is 300 bytes (i.e. N3 length=300 byte).
The first situation, if limiting length (i.e. predetermined threshold value) for 2000 byte when, first, obtain first request
The length of text N1 is 200 bytes (i.e. N1 length=200 byte), judges the length of first request text N1,
Because 200 bytes (are preset not less than limited length less than the length of the request text N1 of 2000 bytes, i.e., first
Threshold value), then first request text N1 is initialized as current request text, obtains the length of second request text N2
For 300 bytes (i.e. N2 length=300 byte), by first request text N1 (i.e. current request text) and the
Two request text N2 (i.e. next request text) merge, and obtain amalgamation result N (1+2), amalgamation result N
(1+2) length is 500 bytes (i.e. N (1+2) length=500 byte), judges first request text N1 (i.e.
Current request text) and second request text N2 (i.e. next request text) amalgamation result N (1+2) length
Spend whether not less than limited length (i.e. predetermined threshold value), as 500 bytes are less than 2000 bytes, then by amalgamation result
Current request texts of the N (1+2) as circulate operation next time.
The length for obtaining the 3rd request text N3 is 300 bytes (i.e. N3 length=300 byte), by first
Request text N1 and second amalgamation result N (1+2) (i.e. current request text) for asking text N2 and the 3rd
Request text N3 merges, and obtains first request text N1, text N2 and the 3rd request text N3 of second request
Amalgamation result N (1+2+3), the length of amalgamation result N (1+2+3) is that (i.e. N (1+2+3) is long for 700 bytes
=700 bytes of degree), then judge whether the length of amalgamation result N (1+2+3) (presets threshold not less than limited length
Value), as limited length (i.e. predetermined threshold value) is 2000 bytes, then also need to be circulated next time again, and repeat
Above-mentioned steps.Until the length of the amalgamation result in the new circulate operation that obtains is more than predetermined threshold value, and by the last time
The amalgamation result of circulate operation is used as the request text for merging request, then will carry the merging request transmission for merging text
To server.
Second situation, if limiting length (i.e. predetermined threshold value) for 600 byte when, first, obtain first request
The length of text N1 is 200 bytes (i.e. N1 length=200 byte), judges the length of first request text N1
Whether not less than limited length (i.e. predetermined threshold value), because 200 bytes are less than the request of 2000 bytes, i.e., first just
The length of literary N1 is initialized as current request not less than limited length (i.e. predetermined threshold value), then first request text N1
Text, the length for obtaining second request text N2 is 300 bytes (i.e. N2 length=300 byte), by first
Individual request text N1 (i.e. current request text) is merged with second request text N2 (i.e. next request text),
Amalgamation result N (1+2) is obtained, the length of amalgamation result N (1+2) is 500 bytes (i.e. N (1+2) length=500
Byte), judge that first request text N1 (i.e. current request text) and second request text N2 are (i.e. next
Request text) amalgamation result N (1+2) length whether not less than limited length (i.e. predetermined threshold value), due to 500
Byte be less than 600 bytes, then using amalgamation result N (1+2) as circulate operation next time current request text.
The length for obtaining the 3rd request text N3 is 300 bytes (i.e. N3 length=300 byte), by first
The request of the amalgamation result N (1+2) of request text N1 and second request text N2 and the 3rd request text N3
Merge, obtain first request text N1, the amalgamation result of text N2 and the 3rd request text N3 of second request
N (1+2+3), the length of amalgamation result N (1+2+3) is 700 bytes (i.e. N (1+2+3) length=700 byte),
The length of amalgamation result N (1+2+3) is judged again whether not less than limited length (i.e. predetermined threshold value), due to limiting
Length (i.e. predetermined threshold value) is 600 bytes, therefore the length of the amalgamation result N (1+2+3) for obtaining is grown more than limiting
Degree (i.e. predetermined threshold value), then using the amalgamation result N (1+2) of last circulate operation as merge ask request just
Text, then the merging request transmission for merging text will be carried to server.
Alternatively, current request text and next request text are merged, obtaining amalgamation result can include:
Current request text and next request text are joined end to end by separator, obtain amalgamation result, wherein, merge
As a result length of the length for current request text, the sum of the length of the length and separator of next request text.
In the above-described embodiments, after client obtains multiple requests, the from multiple request texts of multiple requests
One request start of text, performs following steps, and these steps include that the next one obtained in multiple request texts is just asked
Text;Current request text and next request text are joined end to end by separator, obtain amalgamation result, wherein,
The length of amalgamation result is the length of the length, the length of next request text and separator of current request text
With.If the length of amalgamation result is less than or equal to predetermined threshold value, using amalgamation result as the current of circulate operation next time
Request text, the request text of multiple requests is merged and obtains merging text, each step of above-mentioned circulation is repeated,
Until the length of amalgamation result is more than predetermined threshold value, and using the amalgamation result of last circulate operation as merging request
Request text, then the merging request transmission for merging text will be carried to server.By above-described embodiment, solve
The problem that solicited message after merging is not easily distinguishable, realizes and each request text is rationally merged, and be difficult
The effect obscured.
Specifically, judge the length of the request text (i.e. first request text) of first request of multiple solicited messages
Degree, if first request text size is less than or equal to predetermined threshold value, judges the length of second request text.Such as
Two request text size sum adds separator (accounting for 1-2 byte) length less than predetermined threshold value, then please by second
Ask and merge with first request.First request is connected with second request ending, and first request and the
It is separated with the separator specified between two requests.Judge the length of the 3rd request text after the completion of merging again,
Length such as the 3rd request text adds separator (accounting for 1-2 byte) with the length sum of the request text of amalgamation result
Length, less than or equal to predetermined threshold value, then again the 3rd request is merged with front two articles of requests, with the separator specified
It is separated, by that analogy.
If the length sum of the length of n-th request text and the amalgamation result of last circulate operation, along with point
Every the total length of symbol (accounting for 1-2 byte), more than predetermined threshold value the maximum of restriction (e.g., HTML agreements), then
No longer merge, and the amalgamation result of last circulate operation corresponding request is sent to into processing server.
Alternatively, the next request text obtained in multiple request texts includes:By generate multiple requests according to when
Between be sequentially saved into request queue;Next request is obtained from request queue, and extracts corresponding with next request
Next request text.
In the above-described embodiments, after client obtains multiple requests, the from multiple request texts of multiple requests
One request start of text, performs following steps, and these steps can include:Will be the multiple requests for generating suitable according to the time
Sequence is saved into request queue;Next request is obtained from request queue, and extracts corresponding next with next request
Individual request text;Current request text and next request text are joined end to end by separator, obtain amalgamation result,
Wherein, the length of amalgamation result is length, the length of next request text and the separator of current request text
The sum of length.If the length of amalgamation result is less than or equal to predetermined threshold value, using amalgamation result as circulate operation next time
Current request text, the request text of multiple requests is merged and obtains merging text, each of above-mentioned circulation is repeated
Individual step, until the length of the amalgamation result in new circulation is more than predetermined threshold value, and by the conjunction of last circulate operation
And result is used as the request text for merging request, then the merging request transmission for merging text will be carried to server.It is logical
Above-described embodiment is crossed, orderly arrangement is realized and is extracted the effect of the request text of multiple requests.
Specifically, after client obtains each request, these requests directly will not be sent to server one by one, but
A request queue, and multiple requests that client (such as HTML clients) is initiated are set up first by the original of first in first out
Then (i.e. time sequencing) is put into message queue.
Alternatively, the merging request transmission for merging text will carried to before server, processing method can also be wrapped
Include:Set up and the annexation between server;The merging request for carrying merging text is sent to server to be included:
Sent by annexation and merge request to server.
In the above-described embodiments, after client is got because of the multiple requests produced by user's triggering, client can
So that the request text of multiple requests is merged the merging text for obtaining length less than predetermined threshold value, client is first set up and is taken
Annexation between business device, is sent by annexation and asks to send to server by the merging for carrying the merging text.
By above-described embodiment, realize the effect of the transmission between each client and server of effectively utilizes, it is to avoid request
The waste of resource.
Alternatively, merging request is being sent to server by annexation, processing method can also include:Connect
Server is received to merging the response message of request;Disconnect relation.
In the above-described embodiments, after client is got because of the multiple requests produced by user's triggering, client can
So that the request text of multiple requests is merged the merging text for obtaining length less than predetermined threshold value, client is first set up and is taken
Annexation between business device, is sent by annexation and asks to send to server by the merging for carrying the merging text,
The server is received to the response message for merging request;Disconnect the annexation.By above-described embodiment,
Realize in the case where ensureing that transmission data is constant, reduce client (such as HTML clients) and send the secondary of request
Number, has saved the time and has improve the effect of bandwidth.
Embodiment 2
According to embodiments of the present invention, there is provided a kind of embodiment of the processing method of network request, it should be noted that
Can perform in the such as computer system of one group of computer executable instructions the step of the flow process of accompanying drawing is illustrated,
And, although show logical order in flow charts, but in some cases, can be with suitable different from herein
Sequence performs shown or described step.
As shown in figure 4, the processing method comprises the steps:
Step S402, the merging for receiving client transmission are asked, wherein, merge request to carry asking for merging text
Ask, merge text and obtained by merging the request text of multiple requests.
Step S404, decomposes merging request based on the separator in the request text for merging request and obtains multiple requests.
The response message of multiple requests is back to client by step S406.
In the above-described embodiments, server receive client send merging request after, based on merge request please
Ask the separator in text to decompose to merge request and obtain multiple requests, and the response message of multiple requests is back to into client
End.By above-described embodiment, server can fast and accurately be decomposed to the merging request that client sends, be obtained
To each solicited message for needing, so as to reach the purpose for reducing bandwidth, and then net is wasted when solving http request
The technical problem of network resource, realizes the effect that server saves Internet resources when request is received.
Alternatively, after the separator decomposition merging request in based on the request text for merging request obtains multiple requests,
The processing method can also include:Multiple requests after record decomposition.
In the above-described embodiments, server receive client send merging request after, based on merge request please
Ask the separator in text to decompose to merge request and obtain multiple requests, and record multiple requests after decomposition, by multiple requests
Corresponding multiple response messages are back to client.By above-described embodiment, effective accurate delivery is realized with record
The effect of request, improve subsequently carries out the convenience of process such as consulting to the request.
Embodiment 3
According to embodiments of the present invention, a kind of embodiment of the processing meanss of network request is additionally provided, Fig. 5 is according to this
The schematic diagram of the processing meanss of a kind of network request of inventive embodiments, as shown in figure 5, the processing meanss include:Obtain
Delivery block 10, merging module 30 and sending module 50.
Wherein, acquisition module 10, for obtaining multiple requests.
Merging module 30, merges for the request text by multiple requests and obtains merging text, wherein, merge text
Length is less than or equal to predetermined threshold value.
Sending module 50, sends to server for will carry the merging for merging text request.
Using the above embodiment of the present invention, after client is got because of the multiple requests produced by user's triggering, visitor
The request text of multiple requests can be merged the merging text for obtaining length less than predetermined threshold value at family end, then will carry
The merging request of the merging text is sent to server.By above-described embodiment, can improve and individually transmission is carried
It is shorter request text request when, due to request header proportion than request text it is big institute caused by lose time and take compared with
The phenomenon of big bandwidth, so as to the mode for utilizing the request text by multiple requests to merge, reduces transmitted per unit time
The quantity of request, has reached the purpose for reducing bandwidth, and then the technology of waste Internet resources has been asked when solving http request
Topic, realizes the effect that client saves Internet resources when request is sent.
Alternatively, merging module can include:Loop module, acquisition module, merging submodule and judge module.
Wherein, loop module, called for first request start of text from multiple request texts of multiple requests
Acquisition module, merge submodule and judge module, until the length of amalgamation result is more than predetermined threshold value, and by the last time
Request text of the amalgamation result of circulate operation as merging request, wherein, current request text is initialized to first
Individual request text.
Acquisition module, for obtaining the next request text in multiple request texts.
Merge submodule, for merging to current request text and next request text, obtain amalgamation result;
Judge module, if the length for amalgamation result is less than or equal to predetermined threshold value, using amalgamation result as next time
The current request text of circulate operation.
In the above-described embodiments, after client gets multiple requests produced because user triggers, from multiple requests
Multiple request texts in first request start of text perform circulate operation, the circulation comprises the steps:By
One request text is initialized as current request text;Obtain next request text;Current request text and the next one
Request text merging obtains amalgamation result, if the length of amalgamation result is less than or equal to predetermined threshold value, the amalgamation result is made
For the current request text for circulating next time.Multiple request texts are repeated in performing circulate operation, until currently please
Text and the length of the amalgamation result of next request text is asked to be more than predetermined threshold value, then by the conjunction of last circulate operation
And result is used as the request text for merging request, then the merging request transmission for merging text will be carried to server.It is logical
Above-described embodiment is crossed, the length of text is asked by automatic decision, merged request text the mechanism for sending, realize
Client is fast and effectively merged and the effect for sending to the request text of multiple requests.
Alternatively, merging submodule can include:Processing module.
The processing module, for current request text and next request text being joined end to end by separator, is obtained
Amalgamation result, wherein, the length of amalgamation result is the length of current request text, the length of next request text with
And the sum of the length of separator.
In the above-described embodiments, after client obtains multiple requests, the from multiple request texts of multiple requests
One request start of text, performs following steps, and these steps include that the next one obtained in multiple request texts is just asked
Text;Current request text and next request text are joined end to end by separator, obtain amalgamation result, wherein,
The length of amalgamation result is the length of the length, the length of next request text and separator of current request text
With.If the length of amalgamation result is less than or equal to predetermined threshold value, using amalgamation result as the current of circulate operation next time
Request text, the request text of multiple requests is merged and obtains merging text, each step of above-mentioned circulation is repeated,
Until the length of amalgamation result is more than predetermined threshold value, and using the amalgamation result of last circulate operation as merging request
Request text, then the merging request transmission for merging text will be carried to server.By above-described embodiment, solve
The problem that solicited message after merging is not easily distinguishable, realizes and each request text is rationally merged, and be difficult
The effect obscured.
Alternatively, acquisition module can include:Preserving module and extraction module.
Wherein, preserving module, for the multiple requests for generating are saved into request queue sequentially in time.
Extraction module, for next request is obtained from request queue, and extracts corresponding next with next request
Individual request text.
In the above-described embodiments, after client obtains multiple requests, the from multiple request texts of multiple requests
One request start of text, performs following steps, and these steps include:The multiple requests for generating are protected sequentially in time
It is stored in request queue;The next request of acquisition from request queue, and the extraction next one corresponding with next request please
Seek text;Current request text and next request text are joined end to end by separator, obtain amalgamation result, its
In, the length of amalgamation result is the length of the length of current request text, the length of next request text and separator
The sum of degree.If the length of amalgamation result is less than or equal to predetermined threshold value, using amalgamation result as circulate operation next time
Current request text, the request text of multiple requests is merged and obtains merging text, and above-mentioned circulation each is repeated
Step, until the length of amalgamation result is more than predetermined threshold value, and using the amalgamation result of last circulate operation as merging
The request text of request, then the merging request transmission for merging text will be carried to server.By above-described embodiment,
Realize orderly arrangement and extract the effect of the request text of multiple requests.
Alternatively, processing meanss can also include:Module is set up, this sets up module, for merging will be being carried just
The merging request of text is sent to before server, is set up and the annexation between server.
Sending module can include:Sending submodule, merges request to server for sending by annexation.
In the above-described embodiments, after client is got because of the multiple requests produced by user's triggering, client can
So that the request text of multiple requests is merged the merging text for obtaining length less than predetermined threshold value, client is first set up and is taken
Annexation between business device, is sent by annexation and asks to send to server by the merging for carrying the merging text.
By above-described embodiment, realize the effect of the transmission between each client and server of effectively utilizes, it is to avoid request
The waste of resource.
Alternatively, sending submodule can include:Receiver module and disconnection module.
Wherein, receiver module, for sending merging request to server by annexation, receives service
Device is to merging the response message asked.
Module is disconnected, for disconnecting relation.
In the above-described embodiments, after client is got because of the multiple requests produced by user's triggering, client can
So that the request text of multiple requests is merged the merging text for obtaining length less than predetermined threshold value, client is first set up and is taken
Annexation between business device, is sent by annexation and asks to send to server by the merging for carrying the merging text,
The server is received to the response message for merging request;Disconnect the annexation.By above-described embodiment,
Realize in the case where ensureing that transmission data is constant, reduce client (such as HTML clients) and send the secondary of request
Number, has saved the time and has improve the effect of bandwidth.
Embodiment 4
According to embodiments of the present invention, the embodiment of the processing meanss of another kind of network request is additionally provided, Fig. 6 is basis
The schematic diagram of the processing meanss of another kind of network request of the embodiment of the present invention, as shown in fig. 6, the processing meanss include:
Receiver module 20, decomposing module 40, return module 60.
Wherein, receiver module 20, for receiving the merging request of client transmission, wherein, merge request to carry
Merge the request of text, merge text and obtained by merging the request text of multiple requests.
Decomposing module 40, decomposes merging request for the separator in the request text based on merging request and obtains multiple asking
Ask.
Module 60 is returned, for the response message of multiple requests is back to client.
In the above-described embodiments, server receive client send merging request after, based on merge request please
Ask the separator in text to decompose to merge request and obtain multiple requests, and the response message of multiple requests is back to into client
End.By above-described embodiment, server can fast and accurately be decomposed to the merging request that client sends, be obtained
To each solicited message for needing, so as to reach the purpose for reducing bandwidth, and then net is wasted when solving http request
The technical problem of network resource, realizes the effect that server saves Internet resources when request is received.
Alternatively, the processing meanss can also include:Logging modle, the logging modle are being asked based on the merging
After the separator decomposition merging request in the request text asked obtains the plurality of request, after recording the decomposition
The plurality of request.
In the above-described embodiments, server receive client send merging request after, based on merge request please
Ask the separator in text to decompose to merge request and obtain multiple requests, and record multiple requests after decomposition, by multiple requests
Corresponding response message is back to client.By above-described embodiment, effective accurate delivery is realized with record request
Effect, improve subsequently carries out the convenience of process such as consulting to the request.
The quantity of the corresponding response message of multiple requests in above-described embodiment can be one or more.
The embodiments of the present invention are for illustration only, do not represent the quality of embodiment.
In the above embodiment of the present invention, the description to each embodiment all emphasizes particularly on different fields, and does not have in certain embodiment
The part of detailed description, may refer to the associated description of other embodiment.
In several embodiments provided herein, it should be understood that disclosed technology contents, other can be passed through
Mode realize.Wherein, device embodiment described above is only schematic, such as division of described unit,
Can be a kind of division of logic function, when actually realizing, can have other dividing mode, such as multiple units or component
Can with reference to or be desirably integrated into another system, or some features can be ignored, or not perform.It is another, institute
The coupling each other for showing or discussing or direct-coupling or communication connection can be by some interfaces, unit or mould
The INDIRECT COUPLING of block or communication connection, can be electrical or other forms.
The unit as separating component explanation can be or may not be it is physically separate, it is aobvious as unit
The part for showing can be or may not be physical location, you can local to be located at one, or can also be distributed to
On multiple units.Some or all of unit therein can be selected according to the actual needs to realize this embodiment scheme
Purpose.
In addition, each functional unit in each embodiment of the invention can be integrated in a processing unit, it is also possible to
It is that unit is individually physically present, it is also possible to which two or more units are integrated in a unit.It is above-mentioned integrated
Unit both can be realized in the form of hardware, it would however also be possible to employ the form of SFU software functional unit is realized.
If the integrated unit is realized and as independent production marketing or use using in the form of SFU software functional unit
When, can be stored in a computer read/write memory medium.Based on such understanding, technical scheme
The part for substantially contributing to prior art in other words or all or part of the technical scheme can be produced with software
The form of product is embodied, and the computer software product is stored in a storage medium, including some instructions to make
Obtain a computer equipment (can be personal computer, server or network equipment etc.) and perform each enforcement of the present invention
The all or part of step of example methods described.And aforesaid storage medium includes:USB flash disk, read only memory (ROM,
Read-Only Memory), random access memory (RAM, Random Access Memory), portable hard drive, magnetic
Dish or CD etc. are various can be with the medium of store program codes.
The above is only the preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art
For member, under the premise without departing from the principles of the invention, some improvements and modifications can also be made, these improve and moisten
Decorations also should be regarded as protection scope of the present invention.
Claims (10)
1. a kind of processing method of network request, it is characterised in that include:
Obtain multiple requests;
The request text of the plurality of request is merged and obtains merging text, wherein, the length for merging text
Less than or equal to predetermined threshold value;
The merging request for merging text will be carried to send to server.
2. processing method according to claim 1, it is characterised in that the request text of the plurality of request is merged
Obtaining the merging text includes:
First request start of text from multiple request texts of the plurality of request, performs following steps, directly
Length to amalgamation result is more than the predetermined threshold value, and using the amalgamation result of last circulate operation as described
Merge the request text of request, wherein, current request text is initialized to first request text;
Obtain the next request text in the plurality of request text;
Current request text and the next request text are merged, the amalgamation result is obtained;
If the length of the amalgamation result is less than or equal to the predetermined threshold value, using the amalgamation result as next
The current request text of secondary circulate operation.
3. processing method according to claim 2, it is characterised in that to the current request text and described next
Individual request text is merged, and obtaining the amalgamation result includes:
The current request text and the next request text are joined end to end by separator, obtain described
Amalgamation result,
Wherein, the length of the amalgamation result be the length of the current request text, the next request just
The sum of the length of the length and the separator of text.
4. processing method according to claim 2, it is characterised in that obtain described in the plurality of request text
Next request text includes:
The plurality of request for generating is saved into into request queue sequentially in time;
Next request is obtained from the request queue, and is extracted and the next one corresponding next one of request
Request text.
5. a kind of processing method of network request, it is characterised in that include:
The merging request that client sends is received, wherein, it is described to merge request to carry the request for merging text,
The text that merges is obtained by the request text of the multiple requests of merging;
The separator in request text based on the merging request decomposes the merging request and obtains the plurality of asking
Ask;
The response message of the plurality of request is back to into the client.
6. a kind of processing meanss of network request, it is characterised in that include:
Acquisition module, for obtaining multiple requests;
Merging module, merges for the request text by the plurality of request and obtains merging text, wherein, it is described
The length for merging text is less than or equal to predetermined threshold value;
Sending module, sends to server for will carry the merging request for merging text.
7. processing meanss according to claim 6, it is characterised in that the merging module includes:
Loop module, adjusted for first request start of text from multiple request texts of the plurality of request
With acquisition module, merge submodule and judge module, until the length of amalgamation result is more than the predetermined threshold value,
And using the amalgamation result of last circulate operation as the request text for merging request, wherein, current request
Text is initialized to first request text;
Acquisition module, for obtaining the next request text in the plurality of request text;
Merge submodule, for merging to current request text and the next request text, obtain institute
State amalgamation result;
Judge module, if the length for the amalgamation result is less than or equal to the predetermined threshold value, by the conjunction
And result is used as the current request text of circulate operation next time.
8. processing meanss according to claim 7, it is characterised in that the merging submodule includes:
Processing module, for the current request text and the next one are asked text head and the tail by separator
It is connected, obtains the amalgamation result, wherein, the length of the amalgamation result is the length of the current request text
The sum of degree, the length of the length and the separator of the next request text.
9. processing meanss according to claim 7, it is characterised in that the acquisition module includes:
Preserving module, for the plurality of request for generating is saved into request queue sequentially in time;
Extraction module, for next request is obtained from the request queue, and extraction please with the next one
Seek corresponding next request text.
10. a kind of processing meanss of network request, it is characterised in that include:
Receiver module, for receiving the merging request of client transmission, wherein, it is described to merge request to carry
Merge the request of text, the merging text is obtained by merging the request text of multiple requests;
Decomposing module, for decomposing the merging request based on the separator in the request text for merging request
Obtain the plurality of request;
Module is returned, for the response message of the plurality of request is back to the client.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510650373.8A CN106572135A (en) | 2015-10-09 | 2015-10-09 | Network request processing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510650373.8A CN106572135A (en) | 2015-10-09 | 2015-10-09 | Network request processing method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106572135A true CN106572135A (en) | 2017-04-19 |
Family
ID=58507333
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510650373.8A Pending CN106572135A (en) | 2015-10-09 | 2015-10-09 | Network request processing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106572135A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107342983A (en) * | 2017-06-09 | 2017-11-10 | 深圳震有科技股份有限公司 | A kind of transactional handles the method and system of the efficient UDP communications of more subpackages |
CN110047371A (en) * | 2018-01-15 | 2019-07-23 | 北京四维图新科技股份有限公司 | A kind of rendering method and device of Vector Electronic Map |
WO2021164163A1 (en) * | 2020-02-21 | 2021-08-26 | 苏州浪潮智能科技有限公司 | Request processing method and apparatus, device and storage medium |
CN116319733A (en) * | 2022-09-09 | 2023-06-23 | 中央军委政治工作部军事人力资源保障中心 | Cross-network service switching system and method |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110066676A1 (en) * | 2009-09-14 | 2011-03-17 | Vadim Kleyzit | Method and system for reducing web page download time |
CN102184231A (en) * | 2011-05-12 | 2011-09-14 | 广州市动景计算机科技有限公司 | Method and device for acquiring page resources |
CN102377650A (en) * | 2010-08-12 | 2012-03-14 | 华为技术有限公司 | Data transmission processing method, device and system |
CN102387206A (en) * | 2011-10-20 | 2012-03-21 | 镇江睿泰信息科技有限公司 | Synthesis method and system of concurrent request of Web service |
CN103701714A (en) * | 2013-12-25 | 2014-04-02 | 北京奇虎科技有限公司 | Page extraction method, server and network system |
-
2015
- 2015-10-09 CN CN201510650373.8A patent/CN106572135A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110066676A1 (en) * | 2009-09-14 | 2011-03-17 | Vadim Kleyzit | Method and system for reducing web page download time |
CN102377650A (en) * | 2010-08-12 | 2012-03-14 | 华为技术有限公司 | Data transmission processing method, device and system |
CN102184231A (en) * | 2011-05-12 | 2011-09-14 | 广州市动景计算机科技有限公司 | Method and device for acquiring page resources |
CN102387206A (en) * | 2011-10-20 | 2012-03-21 | 镇江睿泰信息科技有限公司 | Synthesis method and system of concurrent request of Web service |
CN103701714A (en) * | 2013-12-25 | 2014-04-02 | 北京奇虎科技有限公司 | Page extraction method, server and network system |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107342983A (en) * | 2017-06-09 | 2017-11-10 | 深圳震有科技股份有限公司 | A kind of transactional handles the method and system of the efficient UDP communications of more subpackages |
CN110047371A (en) * | 2018-01-15 | 2019-07-23 | 北京四维图新科技股份有限公司 | A kind of rendering method and device of Vector Electronic Map |
WO2021164163A1 (en) * | 2020-02-21 | 2021-08-26 | 苏州浪潮智能科技有限公司 | Request processing method and apparatus, device and storage medium |
CN116319733A (en) * | 2022-09-09 | 2023-06-23 | 中央军委政治工作部军事人力资源保障中心 | Cross-network service switching system and method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106572135A (en) | Network request processing method and device | |
CN104253741B (en) | A kind of method for sending information, relevant apparatus and system | |
CN105162626B (en) | Network flow depth recognition system and recognition methods based on many-core processor | |
CN105656763A (en) | Message pushing method and message pushing device | |
CN106412861B (en) | A kind of short message distribution method and system | |
CN104935641B (en) | A kind of method and apparatus for accelerating file transmission | |
CN104468309B (en) | A kind of efficient adaptation method of low speed SMP and high speed password card | |
CN106533932A (en) | Method and device for pushing instant message | |
CN102611641B (en) | Gather the method and system that instant messaging record carries out gathering | |
CN108124007A (en) | The method and apparatus of message data real-time Transmission | |
CN104113599B (en) | A kind of caching method, device and proxy server | |
CN107567107A (en) | A kind of method and device for transmitting data | |
CN107911398A (en) | Authentication method, device and the system of identity information | |
CN102571575A (en) | Session information creation method, device and system | |
CN107332857A (en) | A kind of network data transmission method, device, system and storage medium | |
CN106599296A (en) | Method and system for acquiring page data | |
CN109889312A (en) | Multilink data transmission method, device and computer readable storage medium | |
CN104283972B (en) | Information push method, equipment and system based on browser | |
CN108810936A (en) | A kind of configuration method and device of LoRa terminals | |
CN109326116A (en) | Ammeter parameter batch delivery method and system | |
CN113055348B (en) | Cross-platform data request method and device and electronic equipment | |
CN103856395B (en) | A kind of method and system called good friend on webpage and discussed | |
CN103873443A (en) | Information processing method, local proxy server and network proxy server | |
CN106385516B (en) | A kind of method, apparatus and terminal of the transfer of setting business | |
CN107786552A (en) | Single-point logging method, system and computer equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 100083 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing Applicant after: Beijing Guoshuang Technology Co.,Ltd. Address before: 100086 Cuigong Hotel, 76 Zhichun Road, Shuangyushu District, Haidian District, Beijing Applicant before: Beijing Guoshuang Technology Co.,Ltd. |