CN103905477A - HTTP request processing method and server - Google Patents

HTTP request processing method and server Download PDF

Info

Publication number
CN103905477A
CN103905477A CN201210572917.XA CN201210572917A CN103905477A CN 103905477 A CN103905477 A CN 103905477A CN 201210572917 A CN201210572917 A CN 201210572917A CN 103905477 A CN103905477 A CN 103905477A
Authority
CN
China
Prior art keywords
territory
current field
request
cross
advance
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.)
Granted
Application number
CN201210572917.XA
Other languages
Chinese (zh)
Other versions
CN103905477B (en
Inventor
杨琦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201210572917.XA priority Critical patent/CN103905477B/en
Publication of CN103905477A publication Critical patent/CN103905477A/en
Application granted granted Critical
Publication of CN103905477B publication Critical patent/CN103905477B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The application discloses a HTTP request processing method and server. The method comprises the following steps: a HTTP request of a client and specified parameters carried in the HTTP request are received; the current domain calls a HTTP interface of a domain which is associated with the current domain in advance, and the specified parameters carried in the HTTP request are sent to the called HTTP interface; the current domain is the domain corresponding to a page to which the client accesses at present; and the received parameters are stored into the cookie of the domain which is associated with the current domain in advance by the called HTTP interface. According to the application, the parameters in the webpage access process can be applied to other domains.

Description

A kind of method and server of processing HTTP request
Technical field
The present invention relates to network field, relate in particular to a kind of method and server of the HTTP of processing request.
Background technology
Along with the development of network technology, website towards user numerous, use different terminals, such as high-end smartphones, low-end mobile phone, PAD, PC etc., performance and the screen resolution of terminal are different; For wireless product, different user is because selected network access and service provider are different, and corresponding speed of surfing the Internet also differs greatly.Therefore, in the time that user enters website, website can be according to user's terminal equipment and speed of surfing the Internet, offers the webpage version of user's optimum; And also can provide manual switchover function to facilitate user independently to select simultaneously.
For big-and-middle-sized the Internet general website, because the development of business and classification all can exist multiple domain names simultaneously, such as just there is the business that the domain name such as taobao.com, tmall.com is corresponding different in Alibaba.In the time that user is switched to the webpage under different domain names, a lot of parameters need to reset, and such as webpage version may need to reselect, user name need to be rewritten etc.
Taking webpage version as example, at present, in the time that user opens a webpage with browser, the javascript code in webpage is for the consideration of secure context, is not allow the cross-domain object that calls other pages.Understanding is simply exactly the restriction with source policy because of javascript, and the js under a.com domain name cannot operate the object in the webpage under b.com or c.a.com domain name.Whether cross-domain is to be judged together by agreement, subdomain, main territory, port numbers.Cross-domain judgement for different situations is as shown in the table:
The cross-domain judgement of table one, different situations
Figure BDA00002647864800011
Figure BDA00002647864800021
In existing cross-domain general website, the switching of webpage version mainly contains following two kinds of methods:
In the URL (URL(uniform resource locator)) in each access, to bring parameter for identifying different web pages version (as a v parameter, the value of v parameter is to represent high definition version at 0 o'clock, the value of v parameter for be to represent trade edition at 1 o'clock).But, owing to increasing new argument in URL, can increase URL length; And when user is in the time that other territory network address of primary input are browsed, can lose the webpage version of former selection.
Another kind is to use interactive function, preserves the current webpage version identifier of user in session.And session need to have lasting function, while facilitating user to enter website next time, can keep the webpage version of former selection.But session needs persistence, huge for the required memory space of large-scale website; Reduce page response speed.Summary of the invention
The technical problem that the application will solve is that the parameter while how making accessed web page is applied to other territory.
In order to address the above problem, the application provides a kind of method of the HTTP of processing request, comprising:
The HTTP request and the described HTTP that receive client ask the designated parameter of carrying;
Call and the current field HTTP interface in associated territory in advance at the current field, and entrained designated parameter in described HTTP request is sent to called HTTP interface; Described the current field is the territory that the page of client current accessed is corresponding;
Invoked HTTP interface is saved in described and the current field in advance in the cookie under associated territory by received parameter.
Further, call and the current field HTTP interface in associated territory in advance by the mode of JSONP at the current field;
Describedly call with the current field and before the step of the HTTP interface in associated territory, also comprise in advance at the current field:
In the server in each associated with the current field territory, be the open authority that uses JSONP mode to call this territory HTTP interface of the current field respectively.
Further, described the current field call with the current field in advance the step of the HTTP interface in associated territory comprise:
The current field send cross-domain call request to the current field HTTP interface in associated territory in advance, in described cross-domain call request, carry the designated parameter of carrying in the title of call back function, described HTTP request and should and the current field cookie in associated territory in advance;
The step that invoked HTTP interface is saved in received parameter in the cookie under corresponding field comprises:
With the current field in advance the HTTP interface in associated territory receive after described cross-domain call request, use the designated parameter of carrying in this cross-domain call request, upgrade the corresponding contents in cookie entrained in this cross-domain call request;
Cookie after upgrading is carried in described call back function and is returned.
Further, send cross-domain call request to also comprising before the step of the HTTP interface in associated territory in advance with the current field at the current field:
The server of the current field first from the current field in advance the server in associated territory obtain a token, in described cross-domain call request, carry this token; The validity of this token is for once; With the current field this token of server buffer in associated territory in advance, and record what obtain this token is the server of the current field;
Described and the current field in advance the HTTP interface in associated territory also comprise after receiving the step of cross-domain call request:
With the current field in advance the server in associated territory judge that token entrained in cross-domain call request is whether consistent with the token that server buffer memory, the current field obtains;
If consistent, use the designated parameter of carrying in this cross-domain call request to upgrade the step of the corresponding contents in cookie entrained in this cross-domain call request; If inconsistent, return to the message of malloc failure malloc.
Further, described HTTP request is for switching the request of webpage version, and the entrained designated parameter of this request is selected webpage version.
The present invention also provides a kind of server, comprising:
Receiver module, asks the designated parameter of carrying for the HTTP request and the described HTTP that receive client;
Calling module, for calling in this territory and this territory HTTP interface in associated territory in advance, and sends to called HTTP interface by entrained designated parameter in described HTTP request;
Interface module, for when the HTTP in this territory interface is when associated territory is called and receives designated parameter in advance with this territory, is saved in this parameter in the cookie under this territory.
Further, described calling module calls and this territory HTTP interface in associated territory in advance by the mode of JSONP in this territory;
Described interface module be also used to this territory in advance the open JSONP of use in associated territory mode call the authority of this territory HTTP interface.
Further, described calling module call in this territory with this territory in advance the HTTP interface in associated territory refer to:
Described calling module send in this territory cross-domain call request to this territory HTTP interface in associated territory in advance, in described cross-domain call request, carry the designated parameter of carrying in the title of call back function, described HTTP request and should and this territory cookie in associated territory in advance;
Described interface module is saved in parameter in the cookie under this territory and refers to:
Described interface module is received after described cross-domain call request, uses the described designated parameter of carrying in this cross-domain call request, upgrades the corresponding contents in cookie entrained in this cross-domain call request; Cookie after upgrading is carried in described call back function and is returned.
Further, described calling module sends cross-domain call request to this territory in advance before the HTTP interface in associated territory in this territory, also for first from this territory in advance the server in associated territory obtain a token, in described cross-domain call request, carry this token;
Described server also comprises:
Security module, for according to and this territory token of request generation of the server in associated territory in advance, the validity of this token is for once; Token is returned to the server of this token of request, this token of buffer memory record obtain the server of this token;
Described interface module is when receiving after described cross-domain call request, also consistent for judging the token whether entrained token of this cross-domain call request obtain with server described security module buffer memory, that send this cross-domain call request; If consistent, use the designated parameter of carrying in this cross-domain call request to upgrade the corresponding contents in cookie entrained in this cross-domain call request; If inconsistent, return to the message of malloc failure malloc.
Further, described HTTP request is for switching the request of webpage version, and the entrained designated parameter of this request is selected webpage version.
The present invention also provides a kind of server, comprising:
Receiving element, asks the designated parameter of carrying for the HTTP request and the described HTTP that receive client;
Call unit, for calling at the current field and the current field HTTP interface in associated territory in advance, and sends to called HTTP interface by entrained designated parameter in described HTTP request; Described the current field is the territory that the page of client current accessed is corresponding;
HTTP interface, for being saved in the cookie under this territory by received parameter when called.
Further, described call unit calls and the current field HTTP interface in associated territory in advance by the mode of JSONP at the current field;
With the current field in advance the HTTP interface in associated territory be also used to the open JSONP of use of the current field mode to call the authority of this HTTP interface.
Further, described call unit the current field call with the current field in advance the HTTP interface in associated territory refer to:
Described call unit the current field send cross-domain call request to the current field HTTP interface in associated territory in advance, in described cross-domain call request, carry the designated parameter of carrying in the title of call back function, described HTTP request and should and the current field cookie in associated territory in advance;
Described HTTP interface is saved in received parameter in the cookie under this territory and refers to:
HTTP interface is received after described cross-domain call request, uses the designated parameter of carrying in this cross-domain call request, upgrades the corresponding contents in cookie entrained in this cross-domain call request; Cookie after upgrading is carried in described call back function and is returned.
Further, described server also comprises:
The safe safety unit corresponding with each territory respectively;
Safe unit corresponding to the current field for from the current field in advance safe unit corresponding to associated territory obtain a token; The validity of this token is for once;
With the current field this token of safe unit buffer memory corresponding to associated territory in advance, and record obtains this token is the current field;
Described call unit carries this token in described cross-domain call request;
Described HTTP interface is being also for receiving after cross-domain call request, first judges that the token that territory safe unit buffer memory, that send this cross-domain call request token that whether token entrained in cross-domain call request is corresponding with this territory obtains is consistent; If consistent, use the designated parameter of carrying in this cross-domain call request to upgrade the corresponding contents in cookie entrained in this cross-domain call request; If inconsistent, return to the message of malloc failure malloc.
Further, described HTTP request is for switching the request of webpage version, and the entrained designated parameter of this request is selected webpage version.
At least one embodiment of the application is by the cross-domain mode of writing cookie, thereby can make parameter in cross-domain situation not need repeatedly setting; Such as switching for webpage version.Need not select at service end persistence user's version; Do not need to transform URL; User also can open the webpage version of last selection from primary input network address.Certainly, arbitrary product of enforcement the application must not necessarily need to reach above-described all advantages simultaneously.
Brief description of the drawings
Fig. 1 is the schematic flow sheet of embodiment mono-;
Fig. 2 is the schematic flow sheet in the alternative of embodiment mono-.
Embodiment
Below in conjunction with drawings and Examples, the application's technical scheme is described in detail.
It should be noted that, if do not conflicted, each feature in the embodiment of the present application and embodiment can mutually combine, all within the application's protection range.In addition, although there is shown logical order in flow process, in some cases, can carry out shown or described step with the order being different from herein.
Embodiment mono-, a kind of method of processing HTTP (HTML (Hypertext Markup Language)) request, as shown in Figure 1, comprise step S101~103.
HTTP request and the described HTTP of S101, reception client ask the designated parameter of carrying; S102, call and the current field HTTP interface in associated territory in advance at the current field, and entrained designated parameter in described HTTP request is sent to called HTTP interface; Described the current field is the territory that the page of client current accessed is corresponding.
S103, invoked HTTP interface are saved in described and the current field in advance in the cookie under associated territory by received parameter.
HTTP request has such characteristic: in the time calling the HTTP interface in a territory, the server end that the cookie under this called territory can be taken to called territory with call request, client (being such as but not limited to browser) be processed and be returned to server end can to cookie.
The current field is to the processing procedure of HTTP request with existing, that is: according to HTTP, request is upgraded the cookie of the current field and returns to described client, and is reported to the server of the current field to process this HTTP request.This process can be parallel with above-mentioned steps S102, S103.
Described and the current field in advance associated territory can comprise one or more; When comprising that when multiple, such as territory A, territory B, territory C, it is kept at the parameter of receiving respectively in the cookie of territory A, territory B, territory C.
In a kind of alternative of the present embodiment, described HTTP request is for switching the request of webpage version; It is selected webpage version that this HTTP asks entrained designated parameter, common available v Parametric Representation.
Understandable, it can be also other information (such as accounts information) that this HTTP asks entrained designated parameter.In the another kind of alternative of the present embodiment, described HTTP request is logging request, and it is username and password that this HTTP asks entrained designated parameter.
In other alternative, described designated parameter can also be that other is kept at the parameter in cookie.
In a kind of alternative of the present embodiment, call and the current field HTTP interface in associated territory in advance by the mode of JSONP at the current field;
Before step S102, can also comprise:
In the server in each associated with the current field territory, be the open authority that uses JSONP mode to call this territory HTTP interface of the current field respectively.
Associated territory can specify in advance as required in advance with the current field, also can give tacit consent to the current field and belong to a territory under website together; Owing to having opened the JSONP function of HTTP interface for the current field, thus with the current field in advance the HTTP interface in associated territory can receive the cross-domain call request of carrying out in JSONP mode in the current field.
JSONP full name is " JSON with padding ", and it has utilized the characteristic that the <script> label in HTML can cross-domain request.In simple terms JSONP will " title of the function that will be used for processing cross-domain call request result " also as the parameter of cross-domain request, described in passing to, with the current field server end in associated territory in advance, be somebody's turn to do " processing the function of cross-domain call request result " normally call back function; Then this server end (is a string JSON character string by this cross-domain call request result, and JSON character string is the data that can be resolved by JS) as parameter, be carried in the function of above-mentioned function name representative (being carried in call back function), and return to client executing; In described cross-domain call request result, comprise the cookie after renewal, thereby the cookie after upgrading can be kept in the cookie of corresponding field.
Described step S102 specifically can comprise:
The current field send cross-domain call request to the current field HTTP interface in associated territory in advance, in described cross-domain call request, carry the designated parameter of carrying in the title of call back function, described HTTP request and should and the current field cookie in associated territory in advance.
Accordingly, step S103 specifically can comprise:
With the current field in advance the HTTP interface in associated territory receive after described cross-domain call request, use the designated parameter of carrying in this cross-domain call request, upgrade the corresponding contents (such as upgrading the value of v parameter) in cookie entrained in this cross-domain call request;
Cookie after upgrading is carried in described call back function and is returned.
The corresponding field of so just the cookie in other territory also being planted to client has suffered.
Suppose that the current field is A territory, cross-domain call request is to send to B territory, in cross-domain call request, carries the cookie in B territory, and this cookie obtains from the client in access A territory.
In the alternative having, client had not been accessed B territory, therefore in client, there is no the cookie in B territory; In the case, in cross-domain call request, can not carry the cookie in B territory, the HTTP interface in B territory can be directly generates a new cookie according to described designated parameter, and returns to client, like this in client under B territory also by the cookie having after renewal.
In a kind of alternative of the present embodiment, describedly send cross-domain call request to also comprising before the step of the HTTP interface in associated territory in advance with the current field at the current field:
The server of the current field first from the current field in advance the server in associated territory obtain a token, in described cross-domain call request, carry this token; The validity of this token is for once; With the current field this token of server buffer in associated territory in advance, and record what obtain this token is the server of the current field;
Described and the current field in advance the HTTP interface in associated territory can also comprise after receiving the step of cross-domain call request:
With the current field in advance the server in associated territory judge that token entrained in cross-domain call request is whether consistent with the token that server buffer memory, the current field obtains;
If consistent, use the designated parameter of carrying in this cross-domain call request to upgrade the step of the corresponding contents in cookie entrained in this cross-domain call request; If inconsistent, return to the message of malloc failure malloc.
When pre-determining behind associated territory, each territory, the token that just can arrange used each other between the background server in two associated territories in advance; While there is multiple associated territory in advance in the current field, the background server of the current field from advance the background server of associated not same area can obtain the token of agreement separately; Receiving the background server in the territory of cross-domain call request, is by the token in cross-domain call request, and token buffer memory and that belong to this cross-domain call request transmit leg compares.
In a kind of alternative, suppose that cross-domain general website contains the web page resources under A, B, tri-territories of C, wherein B territory, C territory are all associated in advance with A territory, and client is user browser; User browser sends the HTTP request that webpage version switches under A territory, autonomous switch webpage version by lower version to hight version (in this alternative, the v parameter value of hight version is " 0 "), as shown in Figure 2, user triggers the function functionA (such as a button in user's webpage clicking or trigger other control etc.) for switching webpage version under A territory, follow-uply will carry out following step S201~S205.
S201, prepare the HTTP interface in other territory: the mode cross-domain request B territory by JSONP under A territory is the functionC for the treatment of cross-domain request for the treatment of the function functionB of cross-domain request and C territory, and carry the value " 0 " of v parameter;
S202, functionB plant the value of received v parameter (being " 0 " in this alternative) in the v parameter under the cookie of the B territory of user browser, and functionC is in the v parameter under the value of v parameter corresponding current user selected webpage version (being " 0 " in this alternative) kind is under the cookie of the C territory of user browser.
S203, functionA plant the value of v parameter corresponding current user selected webpage version (being " 0 " in this alternative) in the v parameter under the cookie of the A territory of user browser.
The execution sequence of step S202, S203 is not limit.
S204, functionA ask server, by request with cookie in the value of v parameter, get the webpage of current selected release (being hight version in this alternative);
S205, when user is in the network address in browser address bar input B territory/C territory or click the network address in B territory/C territory or carry out other similarly when the operation of the resource in request B territory/C territory under the webpage in A territory, the cookie in B territory/C territory on the band of capital, thereby also can obtain the specified version resource of v parameter in cookie, the webpage of therefore opening is still the last hight version of selecting of user.
In the time that user switches to high-end webpage version and browses a page in territory in a website, if when user continues to browse another webpage in other predetermined territory, webpage version is still high-end webpage version like this.
Embodiment bis-, a kind of server, comprising:
Receiver module, asks the designated parameter of carrying for the HTTP request and the described HTTP that receive client;
Calling module, for calling in this territory and this territory HTTP interface in associated territory in advance, and sends to called HTTP interface by entrained designated parameter in described HTTP request;
Interface module, for when the HTTP in this territory interface is when associated territory is called and receives designated parameter in advance with this territory, is saved in this parameter in the cookie under this territory.
" this territory " of the present embodiment indication is the territory that this server is managed; Each territory and background server are one to one, and the background server is here a logical concept.In a property server, likely manage multiple territories, conventionally can use multiple virtual servers to manage respectively different territories; Also likely realize in multiple property server in a territory, but these multiple property server can logically be looked as a whole, jointly as the background server in this territory.
Above-mentioned calling module, receiver module and interface module can belong to identical or different property server physically, but logically all belong to the background server in some territories, and this territory is " this territory " that above-mentioned three modules are thought; In the background server of same area, can not comprise separately above-mentioned three modules.
In a kind of alternative of the present embodiment, described calling module calls and this territory HTTP interface in associated territory in advance by the mode of JSONP in this territory;
Described interface module be also used to this territory in advance the open JSONP of use in associated territory mode call the authority of this territory HTTP interface.
In a kind of alternative of the present embodiment, described calling module call in this territory with this territory in advance the HTTP interface in associated territory refer to:
Described calling module send in this territory cross-domain call request to this territory HTTP interface in associated territory in advance, in described cross-domain call request, carry the designated parameter of carrying in the title of call back function, described HTTP request and should and this territory cookie in associated territory in advance.
Described interface module is saved in parameter in the cookie under this territory and refers to:
Described interface module is received after described cross-domain call request, uses the designated parameter of carrying in this cross-domain call request, upgrades the corresponding contents in cookie entrained in this cross-domain call request; Cookie after upgrading is carried in described call back function and is returned.
Suppose that this territory is A territory, cross-domain call request is to send to B territory, in cross-domain call request, carries the cookie in B territory, and this cookie obtains from the client in access A territory.In the alternative having, because client had not been accessed B territory, therefore in client, there is no the cookie in B territory; In the case, in cross-domain call request, can not carry the cookie in B territory, the HTTP interface in B territory can be directly generates a new cookie according to described designated parameter, and returns to client, like this in client under B territory also by the cookie having after renewal.
In a kind of alternative of the present embodiment, described calling module sends cross-domain call request to this territory in advance before the HTTP interface in associated territory in this territory, also for first from this territory in advance the server in associated territory obtain a token, in described cross-domain call request, carry this token;
Described server also comprises:
Security module, for according to and this territory token of request generation of the server in associated territory in advance, the validity of this token is for once; Token is returned to the server of this token of request, this token of buffer memory record obtain the server of this token;
Described interface module is when receiving after described cross-domain call request, also consistent for judging the token whether entrained token of this cross-domain call request obtain with server described security module buffer memory, that send this cross-domain call request; If consistent, use the designated parameter of carrying in this cross-domain call request to upgrade the corresponding contents in cookie entrained in this cross-domain call request; If inconsistent, return to the message of malloc failure malloc.
In a kind of alternative of the present embodiment, described HTTP request is for switching the request of webpage version, and the entrained designated parameter of this request is selected webpage version.In other alternative, described HTTP request can be also logging request, and it is username and password that this HTTP asks entrained designated parameter; Described designated parameter can also be other to be kept at described in the parameter in cookie HTTP request corresponding can be other request of having carried designated parameter.
Embodiment tri-, a kind of server, comprising:
Receiving element, asks the designated parameter of carrying for the HTTP request and the described HTTP that receive client;
Call unit, for calling at the current field and the current field HTTP interface in associated territory in advance, and sends to called HTTP interface by entrained designated parameter in described HTTP request; Described the current field is the territory that the page of client current accessed is corresponding;
HTTP interface, for being saved in the cookie under this territory by received parameter when called.
In a kind of alternative of the present embodiment, described call unit calls and the current field HTTP interface in associated territory in advance by the mode of JSONP at the current field;
With the current field in advance the HTTP interface in associated territory be also used to the open JSONP of use of the current field mode to call the authority of this HTTP interface.
In a kind of alternative of the present embodiment, described call unit the current field call with the current field in advance the HTTP interface in associated territory refer to:
Described call unit the current field send cross-domain call request to the current field HTTP interface in associated territory in advance, in described cross-domain call request, carry the designated parameter of carrying in the title of call back function, described HTTP request and should and the current field cookie in associated territory in advance.
In this alternative, described HTTP interface is saved in received parameter in the cookie under this territory and refers to:
HTTP interface is received after described cross-domain call request, uses the designated parameter of carrying in this cross-domain call request, upgrades the corresponding contents in cookie entrained in this cross-domain call request; Cookie after upgrading is carried in described call back function and is returned.
In a kind of alternative of the present embodiment, described server system also comprises:
The safe safety unit corresponding with each territory respectively;
Safe unit corresponding to the current field for from the current field in advance safe unit corresponding to associated territory obtain a token; The validity of this token is for once;
With the current field this token of safe unit buffer memory corresponding to associated territory in advance, and record obtains this token is the current field;
Described call unit carries this token in described cross-domain call request;
Described HTTP interface is being also for receiving after cross-domain call request, first judges that the token that territory safe unit buffer memory, that send this cross-domain call request token that whether token entrained in cross-domain call request is corresponding with this territory obtains is consistent; If consistent, use the designated parameter of carrying in this cross-domain call request to upgrade the corresponding contents in cookie entrained in this cross-domain call request; If inconsistent, return to the message of malloc failure malloc.
In a kind of alternative of the present embodiment, described HTTP request is for switching the request of webpage version, and the entrained designated parameter of this request is selected webpage version.In other alternative, described HTTP request can be also logging request, and it is username and password that this HTTP asks entrained designated parameter; Described designated parameter can also be other to be kept at described in the parameter in cookie HTTP request corresponding can be other request of having carried designated parameter.
One of ordinary skill in the art will appreciate that all or part of step in said method can carry out instruction related hardware by program and complete, described program can be stored in computer-readable recording medium, as read-only memory, disk or CD etc.Alternatively, all or part of step of above-described embodiment also can realize with one or more integrated circuits.Correspondingly, the each module/unit in above-described embodiment can adopt the form of hardware to realize, and also can adopt the form of software function module to realize.The application is not restricted to the combination of the hardware and software of any particular form.
Certainly; the application also can have other various embodiments; in the situation that not deviating from the application's spirit and essence thereof; those of ordinary skill in the art are when making various corresponding changes and distortion according to the application, but these corresponding changes and distortion all should belong to the protection range of the application's claim.

Claims (15)

1. a method of processing HTTP request, is characterized in that, comprising:
The HTTP request and the described HTTP that receive client ask the designated parameter of carrying;
Call and the current field HTTP interface in associated territory in advance at the current field, and entrained designated parameter in described HTTP request is sent to called HTTP interface; Described the current field is the territory that the page of client current accessed is corresponding;
Invoked HTTP interface is saved in described and the current field in advance in the cookie under associated territory by received parameter.
2. the method for claim 1, is characterized in that:
Call and the current field HTTP interface in associated territory in advance by the mode of JSONP at the current field;
Describedly call with the current field and before the step of the HTTP interface in associated territory, also comprise in advance at the current field:
In the server in each associated with the current field territory, be the open authority that uses JSONP mode to call this territory HTTP interface of the current field respectively.
3. method as claimed in claim 2, is characterized in that, described the current field call with the current field in advance the step of the HTTP interface in associated territory comprise:
The current field send cross-domain call request to the current field HTTP interface in associated territory in advance, in described cross-domain call request, carry the designated parameter of carrying in the title of call back function, described HTTP request and should and the current field cookie in associated territory in advance;
The step that invoked HTTP interface is saved in received parameter in the cookie under corresponding field comprises:
With the current field in advance the HTTP interface in associated territory receive after described cross-domain call request, use the designated parameter of carrying in this cross-domain call request, upgrade the corresponding contents in cookie entrained in this cross-domain call request;
Cookie after upgrading is carried in described call back function and is returned.
4. method as claimed in claim 3, is characterized in that, sends cross-domain call request to also comprising before the step of the HTTP interface in associated territory in advance with the current field at the current field:
The server of the current field first from the current field in advance the server in associated territory obtain a token, in described cross-domain call request, carry this token; The validity of this token is for once; With the current field this token of server buffer in associated territory in advance, and record what obtain this token is the server of the current field;
Described and the current field in advance the HTTP interface in associated territory also comprise after receiving the step of cross-domain call request:
With the current field in advance the server in associated territory judge that token entrained in cross-domain call request is whether consistent with the token that server buffer memory, the current field obtains;
If consistent, use the designated parameter of carrying in this cross-domain call request to upgrade the step of the corresponding contents in cookie entrained in this cross-domain call request; If inconsistent, return to the message of malloc failure malloc.
5. method according to any one of claims 1 to 4, is characterized in that:
Described HTTP request is for switching the request of webpage version, and the entrained designated parameter of this request is selected webpage version.
6. a server, is characterized in that, comprising:
Receiver module, asks the designated parameter of carrying for the HTTP request and the described HTTP that receive client;
Calling module, for calling in this territory and this territory HTTP interface in associated territory in advance, and sends to called HTTP interface by entrained designated parameter in described HTTP request;
Interface module, for when the HTTP in this territory interface is when associated territory is called and receives designated parameter in advance with this territory, is saved in this parameter in the cookie under this territory.
7. server as claimed in claim 6, is characterized in that:
Described calling module calls and this territory HTTP interface in associated territory in advance by the mode of JSONP in this territory;
Described interface module be also used to this territory in advance the open JSONP of use in associated territory mode call the authority of this territory HTTP interface.
8. server as claimed in claim 7, is characterized in that, described calling module call in this territory with this territory in advance the HTTP interface in associated territory refer to:
Described calling module send in this territory cross-domain call request to this territory HTTP interface in associated territory in advance, in described cross-domain call request, carry the designated parameter of carrying in the title of call back function, described HTTP request and should and this territory cookie in associated territory in advance;
Described interface module is saved in parameter in the cookie under this territory and refers to:
Described interface module is received after described cross-domain call request, uses the described designated parameter of carrying in this cross-domain call request, upgrades the corresponding contents in cookie entrained in this cross-domain call request; Cookie after upgrading is carried in described call back function and is returned.
9. server as claimed in claim 8, is characterized in that:
Described calling module sends cross-domain call request to this territory in advance before the HTTP interface in associated territory in this territory, also for first from this territory in advance the server in associated territory obtain a token, in described cross-domain call request, carry this token;
Described server also comprises:
Security module, for according to and this territory token of request generation of the server in associated territory in advance, the validity of this token is for once; Token is returned to the server of this token of request, this token of buffer memory record obtain the server of this token;
Described interface module is when receiving after described cross-domain call request, also consistent for judging the token whether entrained token of this cross-domain call request obtain with server described security module buffer memory, that send this cross-domain call request; If consistent, use the designated parameter of carrying in this cross-domain call request to upgrade the corresponding contents in cookie entrained in this cross-domain call request; If inconsistent, return to the message of malloc failure malloc.
10. the server as described in any one in claim 6 to 9, is characterized in that:
Described HTTP request is for switching the request of webpage version, and the entrained designated parameter of this request is selected webpage version.
11. 1 kinds of servers, is characterized in that, comprising:
Receiving element, asks the designated parameter of carrying for the HTTP request and the described HTTP that receive client;
Call unit, for calling at the current field and the current field HTTP interface in associated territory in advance, and sends to called HTTP interface by entrained designated parameter in described HTTP request; Described the current field is the territory that the page of client current accessed is corresponding;
HTTP interface, for being saved in the cookie under this territory by received parameter when called.
12. servers as claimed in claim 11, is characterized in that:
Described call unit calls and the current field HTTP interface in associated territory in advance by the mode of JSONP at the current field;
With the current field in advance the HTTP interface in associated territory be also used to the open JSONP of use of the current field mode to call the authority of this HTTP interface.
13. servers as claimed in claim 12, is characterized in that, described call unit the current field call with the current field in advance the HTTP interface in associated territory refer to:
Described call unit the current field send cross-domain call request to the current field HTTP interface in associated territory in advance, in described cross-domain call request, carry the designated parameter of carrying in the title of call back function, described HTTP request and should and the current field cookie in associated territory in advance;
Described HTTP interface is saved in received parameter in the cookie under this territory and refers to:
HTTP interface is received after described cross-domain call request, uses the designated parameter of carrying in this cross-domain call request, upgrades the corresponding contents in cookie entrained in this cross-domain call request; Cookie after upgrading is carried in described call back function and is returned.
14. servers as claimed in claim 13, is characterized in that, also comprise:
The safe safety unit corresponding with each territory respectively;
Safe unit corresponding to the current field for from the current field in advance safe unit corresponding to associated territory obtain a token; The validity of this token is for once;
With the current field this token of safe unit buffer memory corresponding to associated territory in advance, and record obtains this token is the current field;
Described call unit carries this token in described cross-domain call request;
Described HTTP interface is being also for receiving after cross-domain call request, first judges that the token that territory safe unit buffer memory, that send this cross-domain call request token that whether token entrained in cross-domain call request is corresponding with this territory obtains is consistent; If consistent, use the designated parameter of carrying in this cross-domain call request to upgrade the corresponding contents in cookie entrained in this cross-domain call request; If inconsistent, return to the message of malloc failure malloc.
15. servers as described in any one in claim 11 to 14, is characterized in that:
Described HTTP request is for switching the request of webpage version, and the entrained designated parameter of this request is selected webpage version.
CN201210572917.XA 2012-12-25 2012-12-25 A kind of method and server for handling HTTP request Active CN103905477B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210572917.XA CN103905477B (en) 2012-12-25 2012-12-25 A kind of method and server for handling HTTP request

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210572917.XA CN103905477B (en) 2012-12-25 2012-12-25 A kind of method and server for handling HTTP request

Publications (2)

Publication Number Publication Date
CN103905477A true CN103905477A (en) 2014-07-02
CN103905477B CN103905477B (en) 2018-04-27

Family

ID=50996631

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210572917.XA Active CN103905477B (en) 2012-12-25 2012-12-25 A kind of method and server for handling HTTP request

Country Status (1)

Country Link
CN (1) CN103905477B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105959197A (en) * 2015-07-30 2016-09-21 杭州迪普科技有限公司 SSL VPN user interface customization method and device
CN107408244A (en) * 2015-03-06 2017-11-28 万事达卡国际股份有限公司 Safety moving remote payment
WO2019227572A1 (en) * 2018-06-01 2019-12-05 平安科技(深圳)有限公司 Association topological graph-based collaborative office processing method and apparatus, device, and medium
CN110971578A (en) * 2018-09-30 2020-04-07 北京国双科技有限公司 User identity confirmation method and device
CN110209959B (en) * 2018-02-11 2024-01-12 北京京东尚科信息技术有限公司 Information processing method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101482882A (en) * 2009-02-17 2009-07-15 阿里巴巴集团控股有限公司 Method and system for cross-domain treatment of COOKIE
US20100049792A1 (en) * 2008-08-25 2010-02-25 International Business Machines Corporation Method and system for providing runtime vulnerability defense for cross domain interactions
CN102043832A (en) * 2010-11-23 2011-05-04 苏州阔地网络科技有限公司 Method for realizing cross-domain request callback on webpage

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100049792A1 (en) * 2008-08-25 2010-02-25 International Business Machines Corporation Method and system for providing runtime vulnerability defense for cross domain interactions
CN101482882A (en) * 2009-02-17 2009-07-15 阿里巴巴集团控股有限公司 Method and system for cross-domain treatment of COOKIE
CN102043832A (en) * 2010-11-23 2011-05-04 苏州阔地网络科技有限公司 Method for realizing cross-domain request callback on webpage

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
51CTO: "淘宝如何跨域获取Cookie分析", 《DEVELOPER.51CTO.COM/ART/201104/255729.HTM》 *
坚持而不浮躁: "js解决cookie跨域访问的问题", 《PERSEVERE.ITEYE.COM/BLOG/664328》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107408244A (en) * 2015-03-06 2017-11-28 万事达卡国际股份有限公司 Safety moving remote payment
CN105959197A (en) * 2015-07-30 2016-09-21 杭州迪普科技有限公司 SSL VPN user interface customization method and device
CN110209959B (en) * 2018-02-11 2024-01-12 北京京东尚科信息技术有限公司 Information processing method and device
WO2019227572A1 (en) * 2018-06-01 2019-12-05 平安科技(深圳)有限公司 Association topological graph-based collaborative office processing method and apparatus, device, and medium
CN110971578A (en) * 2018-09-30 2020-04-07 北京国双科技有限公司 User identity confirmation method and device
CN110971578B (en) * 2018-09-30 2022-07-05 北京国双科技有限公司 User identity confirmation method and device

Also Published As

Publication number Publication date
CN103905477B (en) 2018-04-27

Similar Documents

Publication Publication Date Title
US11621924B2 (en) Incorporating web applications into web pages at the network level
US8396939B2 (en) Content distribution management device, terminal, program, and content distribution system
US8056125B2 (en) Recording medium storing control program and communication system
US10015226B2 (en) Methods for making AJAX web applications bookmarkable and crawlable and devices thereof
US9305174B2 (en) Electronic clipboard protection
CN104111944A (en) Page processing method and device and page generating method and device
CN103973635B (en) Page access control method and relevant apparatus and system
CN112637361B (en) Page proxy method, device, electronic equipment and storage medium
CN103905477A (en) HTTP request processing method and server
CN109600458B (en) Website access method and device
US11516279B2 (en) Systems and methods for accessing multiple resources via one identifier
GB2503070A (en) Dynamic rendering of a Document Object Model (DOM)
CN103685551A (en) Method and device for updating CDN (content delivery network) cache files
EP3535663A1 (en) Contextual keyboard systems and methods of data management
US20160103666A1 (en) Performance improvement method in instance hosting environment and service system therefor
US9191392B2 (en) Security configuration
CN104346228A (en) Application program sharing method and terminal
CN116955861A (en) Page generation method and device and front-end fusion system
KR100924076B1 (en) Internet application embodiment method independent of web browser and operating system
US10044728B1 (en) Endpoint segregation to prevent scripting attacks
CN111190664A (en) Method and system for generating page
CN117290840B (en) Browser auditing method, device, computer equipment and storage medium
CN117056625A (en) Display method and related equipment
Silva et al. A reference architecture for web browsers: part III, a pattern for a web browser kernel.
CN111274519A (en) Page loading speed-up method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 1197572

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant