Background technology
In informationized society now, network turns into a part indispensable in people's live and work.
People are when browsing webpage, generally by browser (or, the application with browser kernel) and clothes
Business device sets up communication connection, and the request of Webpage is obtained to cause the browser to be sent to the server,
And after the Webpage that the server is returned is obtained, show the Webpage.
Because, webpage is (e.g., being made up of html5 codes) being made up of one group of code, and the webpage
Code point to all kinds of resource files (e.g., pattern file of JavaScript program source file, webpage etc.)
It is also to be made up of respective code, but code is all manual compiling, as long as so code may
Can existing defects or flaw.Then, (that is, by one before server provides a webpage to network
Before webpage is reached the standard grade), first each code in the webpage can typically be tested in offline environment,
That is, off-line test is carried out.
But, in off-line test, the server can only use data on the line of simulation to survey the webpage
Examination, this result for allowing for off-line test might not be accurate, that is to say, that determines do not have by off-line test
The webpage of problem, may also go wrong after reaching the standard grade.Then now, staff needs to adjust in server end
The code of the resource file gone wrong is tried, but is due to that server is typically busier, in the server
The middle business for performing the debugging operations may be needed to wait in line, and debugging behaviour is performed until there is free idle thread
Make business, thus cause to debug each time time required for the code of the resource file gone wrong compared with
It is long.Also, due under normal circumstances only by once debugging it is difficult to solve present in the code of the resource file
Problem is, it is necessary to repeatedly be debugged, so further such that the time increase needed for debugging is solved the problems, such as is (outstanding
It is when the resource file to being stored in other servers is debugged, in addition it is also necessary to waste substantial amounts of transmission
Time).For these reasons, staff is caused to be difficult to carry out the resource file gone wrong in webpage
Fast, easily debug.
Then, in the prior art, for needing the resource file of debugging in webpage, acted on behalf of using http
Method, it would be desirable to which the resource file of debugging is mapped to terminal local, can subsequently to utilize on real line
Data, are debugged to the resource file, wherein, http Proxy Methods are specifically as shown in Figure 1.
Fig. 1 is the method that prior art http is acted on behalf of, and is specifically included:
S101:Determine to need the resource file of debugging in webpage, and download the resource file, as waiting to adjust
Try resource file.
Due to http Proxy Methods, being desirable to staff can complete to the resource file in terminal local
Debugging, so the end is it needs to be determined that need the resource file of debugging, then download this file into first in webpage
The terminal local, as resource file to be debugged, can subsequently to be adjusted to the resource file to be debugged
Examination.
S102:Virtual server is set up, and access path is determined for the resource file to be debugged.
The resource file to be debugged needs to obtain by local browser.Specifically, the browser passes through operation
Code in webpage, first obtains access path (that is, resource file to be debugged of the resource file to be debugged
Domain name), further according to the access path, initiate to call to the server for providing the resource file to be debugged
The request of the resource file, finally obtains the resource file to be debugged of server return.
But, because staff is wished to by locally directly changing the resource file to be debugged, so
Now, the terminal, which also needs to camouflage, turns into server, to cheat the browser, allows the browser to pass through operation
Same web page code, obtains local resource file to be debugged downloaded.To realize, in the terminal sheet
Debug the purpose of the resource file to be debugged in ground.
Specifically, the terminal needs be locally created virtual server, and local this is to be debugged to be stored in
Resource file determines access path (that is, the virtual Domain Name of the resource file to be debugged).
S103:By the virtual server, the access path for accessing former resource file is replaced with into access originally
The access path of ground resource file to be debugged.
In order that the browser in the terminal does not visit again this when accessing the resource file by web page code
The server of resource file, but access local virtual server.Now, in addition it is also necessary to the net of the terminal
Network configuration modify, with cause the terminal receive the browser initiation call the resource file please
When asking, the access path for accessing the resource file is replaced with to the access road for accessing local resource file to be debugged
Footpath.
So that when the browser sends to the server on network and calls the request of the resource file, this is virtual
The server that server is substituted on the network receives the call request, and the resource file to be debugged is returned to
The server, and the browser is determined that what is received is the resource file that corresponding server is returned on network.
By the method described in Fig. 1, after the resource file that can debug the needs is locally downloading, as treating
Resource file is debugged, the resource file to be debugged is debugged through row in the terminal local, and due to the webpage
Middle code is not changed, it is possible to sufficiently debugged using the True Data on line.Further,
Because the terminal can be only used for debugging the resource file to be debugged, so debugging process is without waiting for can each time
To perform at once, debugging efficiency is improved.
But, the process shown in Fig. 1 only can be HTTP (Hyper Text for webpage
Transfer Protocol, http) webpage realize.Assisted for webpage for security socket layer Hyper text transfer
For the webpage for discussing (Hyper Text Transfer Protocol over Secure Socket Layer, https),
The now transmission between browser and server needs to carry out communication encryption, i.e. the browser needs to utilize safety
The safety certificate of socket layer agreement (Secure Socket Layer, ssl) protocol generation carrys out authentication server
Identity, and the reception server return resource file when, it is necessary to verify whether the resource file carries
Corresponding safety certificate.
But, because during shown in Fig. 1, the virtual server does not have safety certificate, it can not also carry
For safety certificate, then the browser can not both verify the identity of the virtual server, can not also determine to receive
The security for the resource file to be debugged that the virtual server is returned, then for https webpages,
The browser even can not call the resource file to be debugged, and also allowing for staff can not subsequently be adjusted
Trial work is made.
It can be seen that, in the prior art, due to no safety certificate, cause the agency for being difficult to https webpages,
The problem of resource file to be debugged can not being called.
Embodiment
In the embodiment of the present application, when receiving the replacement instruction to the Internet resources in https webpages,
The terminal first according to the instruction, first sets up virtual server in the terminal local, then by the virtual server,
The access path that the Internet resources file is accessed in the terminal is replaced with and accesses local resource to be debugged text
The access path of part, finally generates root certificate and corresponding sub- certificate for the virtual server.It can be seen that this Shen
Method that please be described, by for the virtual server generate root certificate (that is, the virtual server issue from
Visa book) method so that the virtual server can cheat the browser, the browser is determined the void
Intend the server that server is to provide Internet resources file in https webpages, also, ought be returned to the browser
When returning local resource file to be debugged, the sub- certificate generated by the root certificate can be returned in the lump so that should
Browser determines that the resource file to be debugged is safe file, finally allows the browser to call and hold
The row resource file to be debugged, is solved because virtual server can not provide safety certificate, cause to be difficult into
The agency of row https webpages, it is impossible to the problem of calling resource file to be debugged.
It is specifically real below in conjunction with the application to make the purpose, technical scheme and advantage of the application clearer
Apply example and technical scheme is clearly and completely described corresponding accompanying drawing.Obviously, it is described
Embodiment is only some embodiments of the present application, rather than whole embodiments.Based on the implementation in the application
Example, the every other implementation that those of ordinary skill in the art are obtained under the premise of creative work is not made
Example, belongs to the scope of the application protection.
Fig. 2 calls file processes for what the embodiment of the present application was provided, specifically includes following steps:
S201:Receive the replacement instruction for being directed to Internet resources file in https webpages.
Due to needing that the Internet resources file in https webpages is debugged in terminal local, so adjusting
, it is necessary to which local resource file to be debugged first is replaced with into the network in the https webpages before the runin beginning
Resource file.But, due to now not yet starting the debugging to the resource file to be debugged, so current
The resource file to be debugged can be any file, and but only possesses file identification and address but do not have
There are the file (that is, being the file of a blank) of corresponding content, and the follow-up resource to be debugged of without prejudice to
File is called.
Then, in the embodiment of the present application, the terminal can be received for the Internet resources in https webpages
The replacement instruction of file.
Specifically, the replacement instruction can be a line order line, for making the terminal determine the net that needs are replaced
Network resource file and it is pre-stored in local resource file to be debugged.Wherein, the replacement instruction is included:
The mark of the Internet resources file, the access path of the Internet resources file, it is pre-stored in local this and treats
Debug the mark of resource file and the address of the resource file to be debugged.
It should be noted that the terminal can be PC (personal computer, PC), mobile phone,
Tablet personal computer etc., the Internet resources file can be the java scripts run on a web browser
(JavaScript, JS) program source file, CSS (Cascading Style Sheets, css) text
Part etc. can be provided by server by URL (Uniform Resource Locator, URL)
File.
For example, it is assumed that the music button in https webpages A, can be returned after being clicked to browser
For calling local player application to play JS program source files (the hereinafter referred to as audio JS of audio file
File), the https webpages A is played the audio file specified by local player application, but work
Personnel have found the music button after click, the https nets after the https webpage A on-line runnings
Page A does not play audio file, then, and the staff is needed on the PC of oneself to the https
The JS program source files gone wrong in webpage A.
It is further assumed that the PC have received for the audio JS files in https webpages A (i.e.,
Internet resources file) replacement instruction, and included in the replacement instruction, the mark of audio JS files:
A.js, the audio JS files access path:https://www.XX.com/XX/a.js, the PC are locally pre-
The mark of the resource file to be debugged first preserved:B.js and the resource file to be debugged address:E:Debugging
Work file to be debugged b.js.
S202:According to the replacement instruction, virtual server is being locally created.
In the embodiment of the present application, the invoked procedure of the Internet resources file is under normal circumstances:In the terminal
Browser determine to need the visit of the Internet resources file called by running the codes of the https webpages, first
Ask the way footpath, then initiate to the server for storing the Internet resources file to call the request of the Internet resources file
(that is, initiating call request according to the access path of the Internet resources file), finally the browser, which is received, is somebody's turn to do
The sub- certificate that Internet resources file and the server that server is returned are provided, is completed to the Internet resources
File is called.
But in this application, due to need the browser can call the local resource file to be debugged (with
Continuing after an action of the bowels can be debugged in the terminal local), so also needing to provide one for the resource file to be debugged
The access path that the individual browser can be accessed.Then deposited in this application, it is necessary to which first the terminal disguises oneself as
Store up the band and debug the virtual server of resource file, and determine the domain name of the virtual server so that this is browsed
Device can be to be debugged subsequently for this to carry out by the domain name access of the virtual server virtual server
Resource file generates access path.
The specific process for setting up virtual server in the terminal local is consistent with prior art, by foundation this
Virtual server and determine the virtual server domain name so that the browser in the terminal can pass through the void
Intend the domain name access foundation of server in the virtual server of the terminal local, call and be stored in for the browser
The local resource file to be debugged establishes basis.
Continue to use the example above, it is assumed that the PC establishes void after the replacement instruction is received on the PC
Intend server α, and determine that its domain name is:https://www.YY.com.
S203:By the virtual server, the access path for accessing the Internet resources file is replaced with
Access the access path of local resource file to be debugged.
In the embodiment of the present application, just can be the resource file to be debugged after virtual server is established
Access path is generated, allows the browser to call this to wait to adjust according to the access path of the resource file to be debugged
Try resource file.But, now the browser still should according to what the web page code of the https webpages was accessed
The path of Internet resources file, so also needing to the access path for accessing the Internet resources file replacing with visit
Ask the access path of the resource file to be debugged.
Specifically, first according to the domain name of the virtual server and the address of the file to be debugged, generation should
The access path (that is, the virtual Domain Name of the resource file to be debugged) of file to be debugged, then can now recognize
The file in the virtual server is stored in for the resource file to be debugged.
Secondly, the network configuration of the terminal is changed, the access path for accessing the Internet resources file is replaced with
Access the access path of the resource file to be debugged.So that when the terminal receive the browser transmission based on
The access of the access path of the Internet resources file, call or during inquiry request, according to above-mentioned access path
Fallback relationship, make the virtual server receive the access, call, inquiry request, and by the access, adjust
The access path of the resource file to be debugged is pointed to the destination of, inquiry request.
In addition, in order to be somebody's turn to do to the full extent using the True Data operation on line in follow-up debugging process
Https webpages, it is ensured that the reliability of debugging result, can only be changed for the Internet resources file in this application
Access path be the resource file to be debugged access path, be directed to it without change that the browser sends
His resource file access path so that when other resource files of the browser on the https webpages are called
When, it is not changed according to the access path that the https webpages are determined, the browser is finally called still
Other resource files on network, and when the browser calls the Internet resources file, the browser is determined
Access path be replaced by the resource file to be debugged for pointing to the terminal local, what the browser was called is
The resource file to be debugged locally preserved.And then cause in follow-up debugging process, the browser can be with
To the full extent using the True Data on line, staff is set only to debug the debugging resource file.
It should be noted that the method for the resource generation access path to be debugged is same as the prior art, can
An access path based on the virtual server domain name arbitrarily is generated for the resource file to be debugged, and is recorded
The corresponding relation of the address of the access path and the resource file to be debugged so that the virtual server can
The resource file to be debugged is determined according to the access path.
Continue to use the example above, it is assumed that the domain name https that the PC passes through virtual server α://www.YY.com
And the address E of the resource file b.js to be debugged:Debugging efforts file to be debugged b.js, generation described in wait to adjust
Try resource file b.js access path:https://www.YY.com/b.js.Also, the PC is also by network
Access path https in configuration://www.XX.com/XX/a.js replaces with https://www.YY.com/b.js.
So that when the PC receives the audio JS files for https webpages A that terminal browser B is sent
During call request, according to the access path changed in network configuration, virtual server α receive this call please
Ask, and according to access path https://www.YY.com/b.js calls the resource file b.js to be debugged.
S204:Root certificate is generated for the virtual server.
In the embodiment of the present application, write exactly in step S101, the application be based on https webpages,
And for https webpages, the transmission between the browser and the virtual server needs to carry out communication encryption,
Communication encryption is carried out then for the transmission enable between the virtual server pair and the browser, in addition it is also necessary to be somebody's turn to do
Virtual server generates root certificate.
Specifically, because the root certificate is only used in the terminal as the safety certificate of the virtual server,
So without authority, safety certificate (e.g., the certificate authority, Certificate that public credibility is higher
Authority, the CA certificate issued), it is only necessary to the browser can be cheated, allows the browser virtual with this
The transmission of service device carries out communication encryption.
It should be noted that the root certificate is various types of safety certificates, and e.g., domain name type SSL (Domain
Validation SSL, DVSSL) certificate, enterprise SSL (Organization Validation SSL,
OVSSL) certificate, enhanced SSL (Extended Validation SSL, EVSSL) certificate, wildcard
SSL (Wildcard SSL) certificate is accorded with, the application is not specific to this to be limited.
Continue to use the example above, it is assumed that generate root certificate β for virtual server α.
S205:According to the root certificate, sub- certificate is generated.
In the embodiment of the present application, it is (that is, virtual for this after root certificate is generated for the virtual server
Server has been issued after self signed certificate), in order that the browser, which can be called, is stored in the terminal local
The resource file to be debugged, the virtual server can also be generated and browsed for being sent to this according to the root certificate
The sub- certificate of device, so that the browser can determine that the resource file to be debugged is safety according to the sub- certificate
's.Generate after root certificate and its sub- certificate, the browser can carry out being based on https with the virtual server
The communication connection of webpage.
Specifically consistent with prior art, the virtual server is generated clear for being sent to this based on the root certificate
Look at the sub- certificate of device so that when the browser in the terminal is initiated to the network according to the https webpages
During the call request of resource file, the call request is received by the virtual server, and according to replacing with visit
The access path of local resource file to be debugged is asked, the resource file to be debugged is returned to the browser and is somebody's turn to do
Sub- certificate, and then the browser is determined that the resource file to be debugged is safe according to the sub- certificate, obtain
And perform the resource file to be debugged.
Continue to use the example above, it is assumed that the virtual server generates sub- certificate γ according to root certificate β, then when
Browser B according to the https webpages A to https://www.XX.com/XX/a.js initiates call request
When, virtual server α is received to https:The call request that //www.YY.com/b.js is initiated, then should
Virtual server α returns to the resource file b.js to be debugged and the sub- certificate γ to the browser so that should
Browser B is after the resource file b.js to be debugged and the sub- certificate γ is received, according to the sub- certificate γ
Determine that the resource file b.js to be debugged is available safely, obtain and perform the resource file b.js to be debugged.
Document method is called by as shown in Figure 2, it is seen then that due to generating root card for the virtual server
Book and sub- certificate, so the tune for the Internet resources file initiated even for browser according to https webpages
With request, the virtual server can also be cheated the browser by the root certificate, the browser is determined the void
Intend the server for the Internet resources file that server is to provide in the https webpages, also, the Virtual Service
By returning to the resource file to be debugged and the sub- certificate to the browser so that the resource file to be debugged
The browser can be cheated by the sub- certificate, allow the browser to determine that the identity of the resource file to be debugged is
Safety.So as to realize the replacement of the Internet resources file in https webpages, and obtain the browser
Take, perform local resource file to be debugged.So that staff subsequently can be in terminal local to asking
Internet resources file in the https webpages of topic is debugged.
In addition, as described in step s 201, the resource file to be debugged can be any file, in
It is, in order to can subsequently be debugged to the resource file to be debugged, the net can also to be downloaded in this application
Network resource file is to the address of the resource file to be debugged.
Specifically, the terminal can determine the access path of the Internet resources file according to the replacement instruction, and
The Internet resources file is downloaded to the resource file to be debugged according to the access path of the Internet resources file
Address, then now the resource file to be debugged is no longer any file, and have been replaced by having downloaded should
Internet resources file, then follow-up work personnel locally the resource file to be debugged can debugged.
It should be noted that the download of the Internet resources file and the replacement of the resource file to be debugged can be with
Carried out in this application in either step, it is only necessary to ensure the resource to be debugged generated in step S203
The access path of file be the access path for the resource file to be debugged for having been replaced with Internet resources file i.e.
Can.
Based on the file processes that call shown in Fig. 2, the embodiment of the present application also provides one kind and calls file device,
As shown in Figure 3.
Fig. 3 is that the embodiment of the present application provides a kind of structural representation for calling file device, is specifically included:
Receiving module 301, the replacement instruction for receiving Internet resources file in https webpages;
Performing module 302, for according to the replacement instruction, virtual server to be locally created;
Replacement module 303, for by the virtual server, the visit of the Internet resources file will to be accessed
Footpath of asking the way replaces with the access path for accessing local resource file to be debugged;
Root certificate module 304, for generating root certificate for the virtual server;
Sub- certificate module 305, for according to the root certificate, generating sub- certificate so that when local browser
When initiating the call request to the Internet resources file according to the https webpages, by the Virtual Service
Device receives the call request, and the access path for accessing local resource file to be debugged according to replacing with,
The resource file to be debugged and the sub- certificate are returned to the browser, makes the browser according to institute
Sub- certificate is stated, obtains and performs the resource file to be debugged.
The replacement instruction is included:The identifying of the Internet resources file, the access of the Internet resources file
Path, the mark and the resource file to be debugged for being pre-stored in the local resource file to be debugged
Location.
Performing module 302 specifically for, according to the replacement request, virtual server is being locally created, and
Determine the domain name of the virtual server.
Replacement module 303 is specifically for according to the domain name of the virtual server and the resource to be debugged
File address, generates the access path of the resource to be debugged, will access the access of the Internet resources file
Path replacement is the access path for accessing local resource file to be debugged.
Described device also includes:
Download module 306, for downloading the Internet resources file to the address of the resource file to be debugged.
Specifically, above-mentioned database statement compilation device as shown in Figure 3 can be located in terminal, the terminal
Can be mobile phone, tablet personal computer or PC.
In a typical configuration, computing device includes one or more processors (CPU), input/defeated
Outgoing interface, network interface and internal memory.
Internal memory potentially includes the volatile memory in computer-readable medium, random access memory
And/or the form, such as read-only storage (ROM) or flash memory (flash RAM) such as Nonvolatile memory (RAM).
Internal memory is the example of computer-readable medium.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by appointing
What method or technique realizes that information is stored.Information can be computer-readable instruction, data structure, program
Module or other data.The example of the storage medium of computer includes, but are not limited to phase transition internal memory
(PRAM), static RAM (SRAM), dynamic random access memory (DRAM), its
Random access memory (RAM), read-only storage (ROM), the electrically erasable of his type are read-only
Memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage
(CD-ROM), digital versatile disc (DVD) or other optical storages, magnetic cassette tape, tape magnetic
Disk storage or other magnetic storage apparatus or any other non-transmission medium, can be calculated available for storage
The information that equipment is accessed.Defined according to herein, computer-readable medium does not include temporary computer-readable matchmaker
The data-signal and carrier wave of body (transitory media), such as modulation.
It should also be noted that, term " comprising ", "comprising" or its any other variant are intended to non-row
His property is included, so that process, method, commodity or equipment including a series of key elements not only include
Those key elements, but also other key elements including being not expressly set out, or also include for this process,
Method, commodity or the intrinsic key element of equipment.In the absence of more restrictions, by sentence " including
One ... " key element that limits, it is not excluded that in the process including the key element, method, commodity or set
Also there is other identical element in standby.
It will be understood by those skilled in the art that embodiments herein can be provided as method, system or computer journey
Sequence product.Therefore, the application can using complete hardware embodiment, complete software embodiment or combine software and
The form of the embodiment of hardware aspect.Moreover, the application can be used wherein includes calculating one or more
Machine usable program code computer-usable storage medium (include but is not limited to magnetic disk storage, CD-ROM,
Optical memory etc.) on the form of computer program product implemented.
Embodiments herein is the foregoing is only, the application is not limited to.For this area skill
For art personnel, the application can have various modifications and variations.All institutes within spirit herein and principle
Any modification, equivalent substitution and improvements of work etc., should be included within the scope of claims hereof.