CN112751917A - Resource file loading method, network device, electronic device and storage medium - Google Patents

Resource file loading method, network device, electronic device and storage medium Download PDF

Info

Publication number
CN112751917A
CN112751917A CN202011582808.7A CN202011582808A CN112751917A CN 112751917 A CN112751917 A CN 112751917A CN 202011582808 A CN202011582808 A CN 202011582808A CN 112751917 A CN112751917 A CN 112751917A
Authority
CN
China
Prior art keywords
resource file
resource
network
server
request message
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.)
Withdrawn
Application number
CN202011582808.7A
Other languages
Chinese (zh)
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.)
Ruijie Networks Co Ltd
Original Assignee
Ruijie Networks Co 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 Ruijie Networks Co Ltd filed Critical Ruijie Networks Co Ltd
Priority to CN202011582808.7A priority Critical patent/CN112751917A/en
Publication of CN112751917A publication Critical patent/CN112751917A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention provides a resource file loading method, network equipment, electronic equipment and a storage medium. The method comprises the following steps: if the preset caching condition is met, downloading and storing a resource file corresponding to the network equipment from the server; after intercepting a network request message sent to the server by a terminal, judging whether a resource file corresponding to the network request message is stored locally; and if the resource file is locally stored, sending the resource file to a terminal so that the terminal can load the resource file. According to the resource file loading method provided by the embodiment of the invention, the resource file is downloaded in an idle period in advance through the network equipment, so that the problem of slow page loading caused by insufficient bandwidth in a peak period when the terminal requests resources in a centralized manner is solved, idle broadband is reasonably utilized, and bandwidth expenditure is saved.

Description

Resource file loading method, network device, electronic device and storage medium
Technical Field
The embodiment of the invention relates to the technical field of communication, in particular to a resource file loading method, network equipment, electronic equipment and a storage medium.
Background
With the development of the current network communication technology and the popularization of smart phones, public wireless WIFI internet access demands are strong, so businesses or institutions of various industries such as commerce, finance, government and the like provide free WIFI internet access services for the public. The mechanism for providing WIFI internet service facing public needs a real-name system, and mechanisms providing WIFI service in various industries all deploy Portal authentication systems, so that when a user accesses a WIFI network, the user can access the internet after acquiring real-name information of the user through short messages, WeChat, fixed account numbers and the like.
The Portal authentication network-surfing scene comprises nodes such as a mobile phone terminal, authentication equipment, a Portal authentication server and the like, wherein a plurality of mobile phone terminals can be jointly accessed into one authentication equipment, and a plurality of authentication equipment are connected with one set of Portal authentication server in a butt joint mode. And the authentication equipment provides WIFI signals for the access of the mobile phone terminal, communicates with a Portal authentication server, performs Portal redirection and authentication release, and finally provides internet access service for the mobile phone terminal. The Portal authentication server provides a Portal authentication page and Portal static resources (pictures and videos) for the mobile phone terminal to display; and providing an authentication and verification service, allowing the authentication equipment to release the mobile phone terminal if the verification is passed, and forbidding the authentication equipment to release the mobile phone terminal if the verification is not passed, so that the mobile phone is limited to be on the public network.
The whole authentication internet surfing process is as follows:
1) a user manually associates a Service Set Identifier (SSID) with the Service Set Identifier (SSID) or automatically associates the SSID with the SSID by the mobile phone terminal;
2) after the mobile phone terminal associates the SSID, the mobile phone terminal receives HTTP 302 redirection of the authentication equipment and pops up a Portal authentication page;
3) after seeing the Portal authentication page, the user conducts authentication real-name verification (such as short messages, WeChat, fixed account numbers and the like) according to content guidance;
4) the real name verification is successful, the Portal authentication server and the authentication equipment interact, and the mobile phone terminal with the successful real name authentication is released;
5) the mobile phone terminal displays the successful authentication and prompts the user to go to the external network.
When a mobile phone terminal browser displays a Portal authentication page, static resources such as pictures and videos need to be downloaded from a Portal authentication server. During the authentication peak period, each mobile phone terminal downloads Portal authentication page resources from a Portal authentication server, so that the external network bandwidth requirement of the Portal authentication server is large, the external network bandwidth is occupied, the presentation of partial mobile phone terminal Portal authentication pages is slow, the waiting time of the whole authentication process is long, and even the phenomenon of overtime interruption occurs.
At present, in order to solve the problems that a public network Portal authentication page is slow to present and public network bandwidth is occupied in a peak period, a construction party purchases more Portal authentication server public network bandwidth, however, public network bandwidth cost of an operator is high, and the bandwidth utilization rate is high and low along with the concurrent number of user authentication, so that the Portal authentication page is unstable to present. If the number of authenticated users is large, the bandwidth is not enough, and the display is slow; if the number of authenticated users is small, the bandwidth utilization rate is not high, and resource waste is caused.
Disclosure of Invention
Aiming at the defects in the prior art, the embodiment of the invention provides a resource file loading method, network equipment, electronic equipment and a storage medium.
In a first aspect, an embodiment of the present invention provides a resource file loading method, applied to a network device, including:
if the preset caching condition is met, downloading the resource file corresponding to the network equipment from the server and storing the resource file;
after intercepting a network request message sent to the server by a terminal, judging whether a resource file corresponding to the network request message is stored locally;
and if the resource file is locally stored, sending the resource file to a terminal so that the terminal can load the resource file.
As in the foregoing method, optionally, the downloading and saving the resource file corresponding to the network device from the server includes:
determining a device number corresponding to the network device;
determining a resource file list corresponding to the network equipment according to the equipment number;
sending a resource request message to a server, wherein the resource request message carries the resource file list;
receiving a resource response message returned by the server, wherein the resource response message comprises resource file information corresponding to the resource list;
and downloading all resource files corresponding to the resource file list according to the resource file information, and storing all the resource files.
As in the foregoing method, optionally, the resource file information includes: a resource file name and a resource file download address;
correspondingly, the downloading all resource files corresponding to the resource file list according to the resource file information includes:
downloading the resource files according to the resource downloading addresses corresponding to the resource file names in the resource file list;
accordingly, the saving of all resource files includes:
and storing all the resource files, the resource file names and the corresponding resource file downloading addresses.
According to the method, optionally, the network request message includes a resource file name and/or a resource file download address to be requested;
correspondingly, the determining whether to locally store the resource file corresponding to the network request packet includes:
and judging whether the resource file corresponding to the network request message is stored locally or not according to the resource file name to be requested and/or the resource file downloading address.
As above method, optionally, the resource file information further includes: a modification time point of the resource file;
correspondingly, the saving the all resource files further includes: and saving the modification time point of each resource file.
The method as described above, optionally, further includes:
and if the judgment result shows that the preset updating condition is met, updating the locally stored resource file.
Optionally, in the foregoing method, if it is determined that the preset update condition is satisfied, updating the locally stored resource file includes:
if the modification time point of the first resource file in the resource response message returned by the server is different from the modification time point of the locally stored first resource file, deleting the locally stored first resource file, and re-acquiring the first resource file;
or the like, or, alternatively,
if the resource response message returned by the server does not include the locally stored second resource file information, deleting the locally stored second resource file;
or the like, or, alternatively,
and if the resource response message returned by the server comprises third resource file information and the third resource file does not exist in the resource file locally stored in the network equipment, acquiring the third resource file from the server.
As in the foregoing method, optionally, the preset caching condition includes: the network bandwidth of the server is idle or reaches a preset idle period.
Optionally, in the method as described above, the network device is an authentication device, and the network request packet is an authentication request packet.
Optionally, in the foregoing method, the network device is an access device, and the network request packet is a network access request packet.
In a second aspect, an embodiment of the present invention provides a network device, including:
the cache module is used for downloading and storing the resource file corresponding to the network equipment from the server if the preset cache condition is judged to be met;
the interception judgment module is used for judging whether a resource file corresponding to the network request message is stored locally or not after the network request message sent to the server by the terminal is intercepted;
and the sending module is used for sending the resource file to a terminal if the resource file is stored locally so as to load the resource file by the terminal.
As for the network device, optionally, the cache module is specifically configured to:
determining a device number corresponding to the network device;
determining a resource file list corresponding to the network equipment according to the equipment number;
sending a resource request message to a server, wherein the resource request message carries the resource file list;
receiving a resource response message returned by the server, wherein the resource response message comprises resource file information corresponding to the resource list;
and downloading all resource files corresponding to the resource file list according to the resource file information, and storing all the resource files.
As for the above network device, optionally, the resource file information includes: a resource file name and a resource file download address;
correspondingly, the cache module is specifically configured to:
downloading the resource files according to the resource downloading addresses corresponding to the resource file names in the resource file list;
and storing all the resource files, the resource file names and the corresponding resource file downloading addresses.
Optionally, the network request message includes a resource file name and/or a resource file download address to be requested, as described above;
correspondingly, the interception judgment module is specifically configured to:
and judging whether the resource file corresponding to the network request message is stored locally or not according to the resource file name to be requested and/or the resource file downloading address.
As for the above network device, optionally, the resource file information further includes: a modification time point of the resource file;
correspondingly, the cache module is further configured to: and saving the modification time point of each resource file.
The above network device, optionally, further includes: an update module;
and the updating module is used for updating the locally stored resource file if the preset updating condition is met.
Optionally, the update module is specifically configured to:
if the modification time point of the first resource file in the resource response message returned by the server is different from the modification time point of the locally stored first resource file, deleting the locally stored first resource file, and re-acquiring the first resource file;
or the like, or, alternatively,
if the resource response message returned by the server does not include the locally stored second resource file information, deleting the locally stored second resource file;
or the like, or, alternatively,
and if the resource response message returned by the server comprises third resource file information and the third resource file does not exist in the resource file locally stored in the network equipment, acquiring the third resource file from the server.
As for the above network device, optionally, the preset caching condition includes: the network bandwidth of the server is idle or reaches a preset idle period.
As for the above network device, optionally, the network device is an authentication device, and the network request packet is an authentication request packet.
Optionally, the network device is an access device, and the network request packet is a network access request packet.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
the processor and the memory are communicated with each other through a bus; the memory stores program instructions executable by the processor, the processor invoking the program instructions to perform a method comprising: if the preset caching condition is met, downloading the resource file corresponding to the network equipment from the server and storing the resource file; after intercepting a network request message sent to the server by a terminal, judging whether a resource file corresponding to the network request message is stored locally; and if the resource file is locally stored, sending the resource file to a terminal so that the terminal can load the resource file.
In a fourth aspect, an embodiment of the present invention provides a storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the following method: if the preset caching condition is met, downloading the resource file corresponding to the network equipment from the server and storing the resource file; after intercepting a network request message sent to the server by a terminal, judging whether a resource file corresponding to the network request message is stored locally; and if the resource file is locally stored, sending the resource file to a terminal so that the terminal can load the resource file.
According to the resource file loading method provided by the embodiment of the invention, if the network equipment judges that the preset caching condition is met, the resource file corresponding to the network equipment is downloaded from the server and stored; after intercepting a network request message sent to the server by a terminal, judging whether a resource file corresponding to the network request message is stored locally; and if the resource file is locally stored, sending the resource file to a terminal so that the terminal can load the resource file. The resource files are downloaded in advance in idle time periods through the network equipment, the problem that the bandwidth of a terminal in a centralized request resource peak period is insufficient, page loading is slow is solved, idle time broadband is reasonably utilized, and bandwidth expenditure is saved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a flowchart of terminal authentication in the prior art;
fig. 2 is a schematic flowchart of a resource file loading method according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a method for updating a resource file by an authentication device according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of Portal authentication flow provided by an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a network device according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a flowchart of a terminal authentication process in the prior art, and as shown in fig. 1, the terminal authentication process includes:
step S01, the user associates the SSID;
step S02, the user opens the browser or the terminal background launches the probe, and the terminal is triggered to launch the HTTP request;
step S03, the terminal accesses the Internet (such as www.163.com);
step S04, the authentication device intercepts the access request and returns a re-URL address (Portal authentication server URL);
step S05, the terminal accesses the redirection URL, the URL includes the terminal IP + MAC, the authentication device information (IP + MAC + SN) and other information;
step S06, Portal authentication server records the relevant parameter information and returns Portal authentication page, the page contains the authentication mode configured by the background;
step S07, the user selects an authentication mode (such as short message authentication, fixed account authentication, WeChat authentication and the like);
step S08, the terminal initiates authentication real-name check;
step S09, Portal authentication server checks and authenticates, saves the check result (used for subsequent authentication release confirmation), and returns the check result;
step S10, the terminal judges the service according to the check result;
step S11, if the verification fails, the Portal authentication page on the terminal prompts that the verification fails and prompts the user to resubmit the authentication verification;
step S12, if the verification is successful, the Portal authentication page on the terminal sends a release request to the authentication equipment;
step S13, the authentication device receives the release request and confirms whether the terminal is released (through the mobile phone terminal MAC matching) to the Portal authentication server;
step S14, the Portal authentication server judges whether to return the result of 'permission' or 'non-permission' according to the check result of step S09; if the terminal passes the verification, attaching an internet strategy identifier aiming at the terminal on the authentication equipment;
step S15, the authentication device processes according to the release result returned by the Portal authentication server, if the terminal is released, the terminal is released according to the returned release mark;
s16, successfully releasing, and returning a successful releasing result to the terminal;
and step S17, if the release fails, returning a release failure result to the terminal.
The steps S05 and S06 are mainly that the terminal browser obtains a Portal authentication page and page elements such as pictures and videos in the page from the Portal authentication server, and performs rendering on the Portal authentication page. The Portal authentication page rendering process comprises the following steps:
1) the terminal browser sends a Portal request to a Portal authentication server, and the Portal authentication server returns the content of Hypertext Markup Language (HTML) of a Portal authentication page;
2) the terminal browser receives the HTML content, and page rendering is carried out on the browser;
3) when the URL such as pictures, videos and the like is analyzed in the rendering process, the terminal downloads the resources to the Portal authentication server. Meanwhile, after the user sees the interesting content on the terminal, the user can continue to check other Portal authentication pages according to the prompt of the Portal authentication pages. The contents of other Portal authentication pages are also processed according to the Portal authentication page rendering flow.
Pictures, videos and the like on the Portal authentication page do not change frequently, the content size of the pictures, the videos and the like is larger than that of HTML (hypertext markup language), 1Mb of bandwidth is required for downloading one Portal authentication page averagely, and static resources of the pictures, the videos and the like occupy 800Kb, so that the bandwidth occupied by the Portal authentication page is reduced, and the downloading frequency of the static resources of the pictures, the videos and the like on the Portal authentication page from the public network is mainly reduced.
In practical application, not only the authentication terminal needs to download static resources from a Portal server in the Portal authentication process based on the public network, but also the static resources need to be downloaded from the server in the access process of any terminal accessing the intranet, and in order to solve the repeated downloading of the static resources such as pictures, videos and the like, the static resources need to be cached in a website, and the static resources can be cached on a terminal browser or authentication equipment or access equipment in the website. If the cache is performed on the terminal browser, the problem of repeated downloading of a single user can be solved. If the user terminal does not access the Portal authentication page, still downloading static resources such as pictures, videos and the like to the Portal authentication server.
In order to solve the above problem, an embodiment of the present invention provides a resource file loading method, where static resources such as pictures and videos are cached in advance on a network device, such as an authentication device or an access device, so that a terminal accessing the network device can directly obtain the resources such as the pictures and the videos from the authentication device, and thus, it is avoided that a server bandwidth is insufficient due to directly downloading the resources from the server.
Fig. 2 is a schematic flowchart of a resource file loading method according to an embodiment of the present invention, where the method is applied to a network device, and as shown in fig. 2, the method includes:
step S21, if the judgment result shows that the preset caching condition is met, downloading the resource file corresponding to the network equipment from the server and storing the resource file;
in particular, it is considered that static resources still need to be downloaded from the server between different sites. In the embodiment of the invention, each network device adopts a peak-off downloading mode to avoid the problem of high bandwidth demand caused by centralized downloading, and after judging that preset caching conditions are met, the network device downloads and stores resource files corresponding to the network device from a server, wherein the network device can be authentication equipment or access equipment deployed at each site aiming at different scenes, the site refers to a network device storage point and provides a place (store) for WIFI authentication to surf the internet, and the resource files generally refer to static resource files, such as picture videos and the like, which occupy resources with large bandwidth relative to dynamic resources.
The preset caching condition may include: for example, if it is known from experience that the idle period of the server is 3 a.m. to 4 a.m., the period may be divided into a plurality of sub-periods, different sub-periods may be allocated to each network device, and when the network device determines that the current period reaches its corresponding sub-period, the resource file corresponding to the network device may be downloaded from the server and stored. Or when the server judges that the bandwidth of the current server is idle through heartbeat messages between the server and each communication device, the server notifies the network device to download the resource file, and after receiving the notification of the server, the network device downloads the static resource from the server.
In the embodiment of the invention, the network equipment caches the corresponding resource file in advance in the idle period instead of triggering the operation of caching the resource file according to the request of the terminal, thereby avoiding the problem of higher bandwidth requirement caused by concentrated request of the terminal for resources.
Step S22, after intercepting the network request message sent to the server by the terminal, judging whether the resource file corresponding to the network request message is stored locally;
and step S23, if the resource file is stored locally, sending the resource file to a terminal so that the terminal can load the resource file.
Specifically, a network request message sent by a terminal to a server passes through network equipment, and according to different communication scenarios, the network request message may be an authentication request message, the network equipment at this time is the authentication equipment, and if the network request message is a network access request message, the network equipment at this time is the access equipment, and further, the network request message refers to the authentication request message or a message requesting static resources in the network access request message.
After intercepting a network request message sent to a server by a terminal, the network equipment judges that a resource file corresponding to the network request message is stored locally, if the resource file exists, the resource file is directly sent to the terminal so that the terminal can load the resource file, and if the resource file does not exist locally, the network request message is released so that the terminal can obtain the resource file from the server.
According to the resource file loading method provided by the embodiment of the invention, if the network equipment judges that the preset caching condition is met, the resource file corresponding to the network equipment is downloaded from the server and stored; after intercepting a network request message sent to the server by a terminal, judging whether a resource file corresponding to the network request message is stored locally; and if the resource file is locally stored, sending the resource file to a terminal so that the terminal can load the resource file. The resource files are downloaded in advance in idle time periods through the network equipment, the problem that the bandwidth of a terminal in a centralized request resource peak period is insufficient, page loading is slow is solved, idle time broadband is reasonably utilized, and bandwidth expenditure is saved.
On the basis of the foregoing embodiment, further, the downloading and saving the resource file corresponding to the network device from the server includes:
determining a device number corresponding to the network device;
determining a resource file list corresponding to the network equipment according to the equipment number;
sending a resource request message to a server, wherein the resource request message carries the resource file list;
receiving a resource response message returned by the server, wherein the resource response message comprises resource file information corresponding to the resource list;
and downloading all resource files corresponding to the resource file list according to the resource file information, and storing all the resource files.
Specifically, the network device determines a corresponding device number at first, where the device number can show a site where the network device is located, and then the network device determines a resource file list corresponding to the network device according to the device number, where the resource file list may be configured on the network device by an administrator in advance according to site information, or may be a resource file list returned by the server to the network device after the network device sends the device number to the server, which is not limited in the embodiment of the present invention. After obtaining the resource file list, the network equipment sends a resource request message to the server, wherein the resource request message carries the resource file list corresponding to the network equipment; after receiving the resource request message, the server sends a resource response message to the network device, where the resource response message includes resource file information corresponding to the resource list, such as a resource file download address.
And the network equipment downloads all resource files corresponding to the resource file list according to the resource file information in the resource response message and stores all the resource files. Taking Portal authentication as an example, the authentication device needs to cache static resources of the authentication page, and mainly caches the static resources of the Portal authentication page to be presented by the site to which the authentication device belongs. When an administrator configures a page on a Portal authentication server, the Portal authentication server can automatically record static resource information on the authentication page into hot. Html of the site is obtained from the server at regular time by the authentication device. When a user terminal initiates an authentication request, all authentication requests need to pass through authentication equipment, the authentication equipment judges whether local cache static resources exist or not, and if the local cache static resources are hit, the local resources are directly returned to the terminal; otherwise, downloading Portal static resources directly through the public network (the probability is very small); and the terminal browser receives the Portal static resource to render and present.
On the basis of the foregoing embodiments, further, the resource file information includes: a resource file name and a resource file download address;
correspondingly, the downloading all resource files corresponding to the resource file list according to the resource file information includes:
downloading the resource files according to the resource downloading addresses corresponding to the resource file names in the resource file list;
accordingly, the saving of all resource files includes:
and storing all the resource files, the resource file names and the corresponding resource file downloading addresses.
The network request message comprises a resource file name and/or a resource file downloading address to be requested;
correspondingly, the determining whether to locally store the resource file corresponding to the network request packet includes:
and judging whether the resource file corresponding to the network request message is stored locally or not according to the resource file name to be requested and/or the resource file downloading address.
Specifically, the resource file information may include a resource file name and a resource file download address (i.e., a Uniform Resource Locator (URL) of a resource file). Html returned by the server includes all resource file names and resource URLs corresponding to the site, and the network device can download corresponding resource files according to the resource URLs and store the resource files, the resource file names and the resource URLs.
Correspondingly, the network request message sent by the terminal may include a resource file name and/or a resource URL to be requested, if the network request message only includes the resource file name, the network device may match the locally stored resource file name list according to the resource file name, and if the matching is successful, the corresponding resource file is fed back to the terminal; if the network request message only comprises the resource URL, the network equipment can match a locally stored resource URL list according to the resource URL, and if the matching is successful, the corresponding resource file is fed back to the terminal; if the network request message comprises the resource file name and the resource URL, the network equipment can preferentially match a locally stored resource URL list according to the resource URL, if the matching is successful, the resource file name is used for verification, and if the verification is successful, the corresponding resource file is fed back to the terminal, so that the resource downloading accuracy and the downloading efficiency are improved.
On the basis of the foregoing embodiments, further, the resource file information further includes: a modification time point of the resource file;
correspondingly, the saving the all resource files further includes: and saving the modification time point of each resource file.
And if the judgment result shows that the preset updating condition is met, updating the locally stored resource file.
If the judgment result shows that the preset updating condition is met, updating the locally stored resource file, including:
if the modification time point of the first resource file in the resource response message returned by the server is different from the modification time point of the locally stored first resource file, deleting the locally stored first resource file, and re-acquiring the first resource file;
or the like, or, alternatively,
if the resource response message returned by the server does not include the locally stored second resource file information, deleting the locally stored second resource file;
or the like, or, alternatively,
and if the resource response message returned by the server comprises third resource file information and the third resource file does not exist in the resource file locally stored in the network equipment, acquiring the third resource file from the server.
Specifically, hot.html not only includes all resource file names and resource URLs corresponding to the site, but also includes modification time points of each resource file, and table 1 is an example of a resource file information table in hot.html:
html resource file information table in table 1 hot
Resource file name Resource URL Modifying a point in time
123456789.png http://png.com/2020/123456789.png 2020-10-01 15:01
abcd.jpg http://jpg.com/2020/abcd.jpg 2020-10-12 19:08
efg.gif http://gif.com/2020/efg.gif 2020-10-12 19:07
As shown in table 1, a certain site corresponds to three resource files, modification times of the three resource files are different, and after obtaining hot. After the network equipment acquires the hot.html returned by the server each time, the content is analyzed, if the modification time point of the hot.html resource file is different from the modification time point of the local cache resource of the network equipment, the resource on the server is updated, the network equipment needs to take the resource URL from the hot.html page, initiate resource downloading to the server, acquire the resource again and cache the resource to the local of the network equipment, and the timeliness of the file resource can be ensured by setting the modification time point.
In addition, the resource files are continuously stored in the network equipment for storage, if the resource files are not deleted, the network equipment storage is occupied by the resource files sooner or later, in order to avoid the problem, after the network equipment obtains hot.html, the locally cached resource files are compared with a hot.html file list, if the first resource file exists, and both the local resource file and the hot.html file exist, the time point is compared and modified, and if the first resource file exists, no processing is performed; and if the modification time points are different, deleting the local first resource, and downloading the first resource file again and saving the first resource file to the local. If the second resource file exists locally but does not exist in hot.html, deleting the second resource file locally; html, downloading the third resource file from the server to the local and storing if the third resource file does not exist locally but exists on hot, and updating the resource file stored locally in the network when the preset updating condition is judged to be met, so that the timeliness of the resource file is guaranteed, and the storage space of the network equipment is saved. Fig. 3 is a schematic flow chart of a method for updating a resource file by using an authentication device according to an embodiment of the present invention, as shown in fig. 3, a resource file that is not stored locally in hot.
Fig. 4 is a schematic diagram of a Portal authentication process according to an embodiment of the present invention, as shown in fig. 4, after an administrator configures a Portal page, a Portal authentication server generates a hot.html corresponding to each site, an authentication device acquires the hot.html corresponding to the site in an idle period, then the authentication device determines whether resource file updating is needed, if not, the hot.html is periodically acquired, the acquisition frequency is configurable, if the acquisition is set once a day, and the like, and if updating is needed, the authentication device updates a locally stored resource file.
And then, the user uses the mobile phone to connect with a WIFI signal provided by the authentication equipment, the mobile phone browser initiates a Portal request, the authentication equipment intercepts the request, matches a Portal resource URL, judges whether a Portal resource exists locally, if so, the authentication equipment directly returns the Portal resource, the mobile phone browser displays the Portal resource, if not, the Portal resource is downloaded from the server, and the mobile phone browser displays the Portal resource.
According to the resource file loading method provided by the embodiment of the invention, if the network equipment judges that the preset caching condition is met, the resource file corresponding to the network equipment is downloaded from the server and stored; after intercepting a network request message sent to the server by a terminal, judging whether a resource file corresponding to the network request message is stored locally; and if the resource file is locally stored, sending the resource file to a terminal so that the terminal can load the resource file. The resource files are downloaded in advance in idle time periods through the network equipment, the problem that the bandwidth of a terminal in a centralized request resource peak period is insufficient, page loading is slow is solved, idle time broadband is reasonably utilized, and bandwidth expenditure is saved. And the network equipment updates the stored resource files regularly, so that the storage space of the network equipment is saved, the consistency of the resource files is ensured, and the loading efficiency of the resource files is improved.
Based on the same inventive concept, an embodiment of the present invention further provides a network device, as shown in fig. 5, including: a buffer module 51, an interception judgment module 52 and a sending module 53, wherein:
the cache module 51 is configured to download and store a resource file corresponding to the network device from a server if it is determined that a preset cache condition is met; the interception judging module 52 is configured to judge whether a resource file corresponding to the network request packet is stored locally after intercepting the network request packet sent by the terminal to the server; the sending module 53 is configured to send the resource file to a terminal if the resource file is stored locally, so that the terminal can load the resource file.
As for the above network device, optionally, the cache module 51 is specifically configured to:
determining a device number corresponding to the network device;
determining a resource file list corresponding to the network equipment according to the equipment number;
sending a resource request message to a server, wherein the resource request message carries the resource file list;
receiving a resource response message returned by the server, wherein the resource response message comprises resource file information corresponding to the resource list;
and downloading all resource files corresponding to the resource file list according to the resource file information, and storing all the resource files.
As for the above network device, optionally, the resource file information includes: a resource file name and a resource file download address;
correspondingly, the cache module 51 is specifically configured to:
downloading the resource files according to the resource downloading addresses corresponding to the resource file names in the resource file list;
and storing all the resource files, the resource file names and the corresponding resource file downloading addresses.
Optionally, the network request message includes a resource file name and/or a resource file download address to be requested, as described above;
accordingly, the interception judgment module 52 is specifically configured to:
and judging whether the resource file corresponding to the network request message is stored locally or not according to the resource file name to be requested and/or the resource file downloading address.
As for the above network device, optionally, the resource file information further includes: a modification time point of the resource file;
correspondingly, the cache module 51 is further configured to: and saving the modification time point of each resource file.
The above network device, optionally, further includes: an update module;
and the updating module is used for updating the locally stored resource file if the preset updating condition is met.
Optionally, the update module is specifically configured to:
if the modification time point of the first resource file in the resource response message returned by the server is different from the modification time point of the locally stored first resource file, deleting the locally stored first resource file, and re-acquiring the first resource file;
or the like, or, alternatively,
if the resource response message returned by the server does not include the locally stored second resource file information, deleting the locally stored second resource file;
or the like, or, alternatively,
and if the resource response message returned by the server comprises third resource file information and the third resource file does not exist in the resource file locally stored in the network equipment, acquiring the third resource file from the server.
As for the above network device, optionally, the preset caching condition includes: the network bandwidth of the server is idle or reaches a preset idle period.
As for the above network device, optionally, the network device is an authentication device, and the network request packet is an authentication request packet.
Optionally, the network device is an access device, and the network request packet is a network access request packet.
The network device provided in the embodiment of the present invention is configured to implement the method, and its functions specifically refer to the method embodiment, which is not described herein again.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 6, the electronic device includes: a processor (processor)61, a memory (memory)62, and a bus 63;
wherein, the processor 61 and the memory 62 complete the communication with each other through the bus 63;
the processor 61 is configured to call program instructions in the memory 62 to perform the methods provided by the above-described method embodiments, including, for example: if the preset caching condition is met, downloading the resource file corresponding to the network equipment from the server and storing the resource file; after intercepting a network request message sent to the server by a terminal, judging whether a resource file corresponding to the network request message is stored locally; and if the resource file is locally stored, sending the resource file to a terminal so that the terminal can load the resource file.
An embodiment of the present invention discloses a computer program product, which includes a computer program stored on a non-transitory computer readable storage medium, the computer program including program instructions, when the program instructions are executed by a computer, the computer can execute the methods provided by the above method embodiments, for example, the method includes: if the preset caching condition is met, downloading the resource file corresponding to the network equipment from the server and storing the resource file; after intercepting a network request message sent to the server by a terminal, judging whether a resource file corresponding to the network request message is stored locally; and if the resource file is locally stored, sending the resource file to a terminal so that the terminal can load the resource file.
Embodiments of the present invention provide a non-transitory computer-readable storage medium, which stores computer instructions, where the computer instructions cause the computer to perform the methods provided by the above method embodiments, for example, the methods include: if the preset caching condition is met, downloading the resource file corresponding to the network equipment from the server and storing the resource file; after intercepting a network request message sent to the server by a terminal, judging whether a resource file corresponding to the network request message is stored locally; and if the resource file is locally stored, sending the resource file to a terminal so that the terminal can load the resource file.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
The above-described embodiments of the apparatuses and the like are merely illustrative, wherein the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the embodiments of the present invention, and are not limited thereto; although embodiments of the present invention have been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (22)

1. A resource file loading method is applied to network equipment and is characterized by comprising the following steps:
if the preset caching condition is met, downloading the resource file corresponding to the network equipment from the server and storing the resource file;
after intercepting a network request message sent to the server by a terminal, judging whether a resource file corresponding to the network request message is stored locally;
and if the resource file is locally stored, sending the resource file to a terminal so that the terminal can load the resource file.
2. The method of claim 1, wherein downloading and saving the resource file corresponding to the network device from the server comprises:
determining a device number corresponding to the network device;
determining a resource file list corresponding to the network equipment according to the equipment number;
sending a resource request message to a server, wherein the resource request message carries the resource file list;
receiving a resource response message returned by the server, wherein the resource response message comprises resource file information corresponding to the resource list;
and downloading all resource files corresponding to the resource file list according to the resource file information, and storing all the resource files.
3. The method of claim 2, wherein the resource file information comprises: a resource file name and a resource file download address;
correspondingly, the downloading all resource files corresponding to the resource file list according to the resource file information includes:
downloading the resource files according to the resource downloading addresses corresponding to the resource file names in the resource file list;
accordingly, the saving of all resource files includes:
and storing all the resource files, the resource file names and the corresponding resource file downloading addresses.
4. The method according to claim 3, wherein the network request message includes a resource file name and/or a resource file download address to be requested;
correspondingly, the determining whether to locally store the resource file corresponding to the network request packet includes:
and judging whether the resource file corresponding to the network request message is stored locally or not according to the resource file name to be requested and/or the resource file downloading address.
5. The method of claim 4, wherein the resource file information further comprises: a modification time point of the resource file;
correspondingly, the saving the all resource files further includes: and saving the modification time point of each resource file.
6. The method of claim 5, further comprising:
and if the judgment result shows that the preset updating condition is met, updating the locally stored resource file.
7. The method according to claim 6, wherein if it is determined that the predetermined update condition is satisfied, updating the locally stored resource file comprises:
if the modification time point of the first resource file in the resource response message returned by the server is different from the modification time point of the locally stored first resource file, deleting the locally stored first resource file, and re-acquiring the first resource file;
or the like, or, alternatively,
if the resource response message returned by the server does not include the locally stored second resource file information, deleting the locally stored second resource file;
or the like, or, alternatively,
and if the resource response message returned by the server comprises third resource file information and the third resource file does not exist in the resource file locally stored in the network equipment, acquiring the third resource file from the server.
8. The method according to any of claims 1-7, wherein the predetermined buffer condition comprises: the network bandwidth of the server is idle or reaches a preset idle period.
9. The method according to any of claims 1-7, wherein the network device is an authentication device and the network request message is an authentication request message.
10. The method according to any of claims 1-7, wherein the network device is an access device and the network request message is a network entry request message.
11. A network device, comprising:
the cache module is used for downloading and storing the resource file corresponding to the network equipment from the server if the preset cache condition is judged to be met;
the interception judgment module is used for judging whether a resource file corresponding to the network request message is stored locally or not after the network request message sent to the server by the terminal is intercepted;
and the sending module is used for sending the resource file to a terminal if the resource file is stored locally so as to load the resource file by the terminal.
12. The network device of claim 11, wherein the cache module is specifically configured to:
determining a device number corresponding to the network device;
determining a resource file list corresponding to the network equipment according to the equipment number;
sending a resource request message to a server, wherein the resource request message carries the resource file list;
receiving a resource response message returned by the server, wherein the resource response message comprises resource file information corresponding to the resource list;
and downloading all resource files corresponding to the resource file list according to the resource file information, and storing all the resource files.
13. The network device of claim 12, wherein the resource file information comprises: a resource file name and a resource file download address;
correspondingly, the cache module is specifically configured to:
downloading the resource files according to the resource downloading addresses corresponding to the resource file names in the resource file list;
and storing all the resource files, the resource file names and the corresponding resource file downloading addresses.
14. The network device according to claim 13, wherein the network request message includes a resource file name and/or a resource file download address to be requested;
correspondingly, the interception judgment module is specifically configured to:
and judging whether the resource file corresponding to the network request message is stored locally or not according to the resource file name to be requested and/or the resource file downloading address.
15. The network device of claim 14, wherein the resource file information further comprises: a modification time point of the resource file;
correspondingly, the cache module is further configured to: and saving the modification time point of each resource file.
16. The network device of claim 15, further comprising: an update module;
and the updating module is used for updating the locally stored resource file if the preset updating condition is met.
17. The network device of claim 16, wherein the update module is specifically configured to:
if the modification time point of the first resource file in the resource response message returned by the server is different from the modification time point of the locally stored first resource file, deleting the locally stored first resource file, and re-acquiring the first resource file;
or the like, or, alternatively,
if the resource response message returned by the server does not include the locally stored second resource file information, deleting the locally stored second resource file;
or the like, or, alternatively,
and if the resource response message returned by the server comprises third resource file information and the third resource file does not exist in the resource file locally stored in the network equipment, acquiring the third resource file from the server.
18. The network device of any of claims 11-17, wherein the predetermined buffer condition comprises: the network bandwidth of the server is idle or reaches a preset idle period.
19. The network device according to any of claims 11-17, wherein the network device is an authentication device and the network request message is an authentication request message.
20. The network device according to any of claims 11-17, wherein the network device is an access device, and the network request packet is a network entry request packet.
21. An electronic device, comprising:
the processor and the memory are communicated with each other through a bus; the memory stores program instructions executable by the processor, the processor invoking the program instructions to perform the method of any of claims 1 to 10.
22. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1 to 10.
CN202011582808.7A 2020-12-28 2020-12-28 Resource file loading method, network device, electronic device and storage medium Withdrawn CN112751917A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011582808.7A CN112751917A (en) 2020-12-28 2020-12-28 Resource file loading method, network device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011582808.7A CN112751917A (en) 2020-12-28 2020-12-28 Resource file loading method, network device, electronic device and storage medium

Publications (1)

Publication Number Publication Date
CN112751917A true CN112751917A (en) 2021-05-04

Family

ID=75646283

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011582808.7A Withdrawn CN112751917A (en) 2020-12-28 2020-12-28 Resource file loading method, network device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN112751917A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113342424A (en) * 2021-08-04 2021-09-03 北京拓课网络科技有限公司 Method and device for loading H5 resource and electronic equipment
CN116132534A (en) * 2022-07-01 2023-05-16 马上消费金融股份有限公司 Method, device, equipment and storage medium for storing service request

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005011148A (en) * 2003-06-20 2005-01-13 Casio Comput Co Ltd Downloading method, information receiving system, program, and portable telephone
US20090327455A1 (en) * 2008-06-28 2009-12-31 Huawei Technologies Co., Ltd. Resource configuration method, server, network equipment and network system
CN101931615A (en) * 2009-06-23 2010-12-29 四零四科技股份有限公司 Network equipment downloading files by equipment identification codes and method thereof
US20110078282A1 (en) * 2009-09-25 2011-03-31 Moxa Inc. Network device that downloads files using its ID code and method thereof
CN102724231A (en) * 2011-03-31 2012-10-10 腾讯科技(深圳)有限公司 Resource downloading method, server and user terminals
CN105589705A (en) * 2014-10-24 2016-05-18 小米科技有限责任公司 File updating method and device, and equipment
CN106657039A (en) * 2016-12-09 2017-05-10 上海斐讯数据通信技术有限公司 Portal page obtaining method, wireless AP, and Portal server
CN106714164A (en) * 2016-12-09 2017-05-24 上海斐讯数据通信技术有限公司 Acquisition method of resource file in Portal page, wireless AP and Portal server
WO2017133491A1 (en) * 2016-02-04 2017-08-10 Boe Technology Group Co., Ltd. Update file download method, device, and system
CN107729352A (en) * 2017-08-30 2018-02-23 上海壹账通金融科技有限公司 page resource loading method and terminal device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005011148A (en) * 2003-06-20 2005-01-13 Casio Comput Co Ltd Downloading method, information receiving system, program, and portable telephone
US20090327455A1 (en) * 2008-06-28 2009-12-31 Huawei Technologies Co., Ltd. Resource configuration method, server, network equipment and network system
CN101931615A (en) * 2009-06-23 2010-12-29 四零四科技股份有限公司 Network equipment downloading files by equipment identification codes and method thereof
US20110078282A1 (en) * 2009-09-25 2011-03-31 Moxa Inc. Network device that downloads files using its ID code and method thereof
CN102724231A (en) * 2011-03-31 2012-10-10 腾讯科技(深圳)有限公司 Resource downloading method, server and user terminals
CN105589705A (en) * 2014-10-24 2016-05-18 小米科技有限责任公司 File updating method and device, and equipment
WO2017133491A1 (en) * 2016-02-04 2017-08-10 Boe Technology Group Co., Ltd. Update file download method, device, and system
CN106657039A (en) * 2016-12-09 2017-05-10 上海斐讯数据通信技术有限公司 Portal page obtaining method, wireless AP, and Portal server
CN106714164A (en) * 2016-12-09 2017-05-24 上海斐讯数据通信技术有限公司 Acquisition method of resource file in Portal page, wireless AP and Portal server
CN107729352A (en) * 2017-08-30 2018-02-23 上海壹账通金融科技有限公司 page resource loading method and terminal device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113342424A (en) * 2021-08-04 2021-09-03 北京拓课网络科技有限公司 Method and device for loading H5 resource and electronic equipment
CN116132534A (en) * 2022-07-01 2023-05-16 马上消费金融股份有限公司 Method, device, equipment and storage medium for storing service request
CN116132534B (en) * 2022-07-01 2024-03-08 马上消费金融股份有限公司 Method, device, equipment and storage medium for storing service request

Similar Documents

Publication Publication Date Title
RU2673403C2 (en) Website access method, device and website system
EP1362491B1 (en) Internet session initiation on personal cellular telecommunications devices, and customization protocol therefor
EP2985705A2 (en) Webpage access method and apparatus, and router
US6868453B1 (en) Internet home page data acquisition method
CN112559927B (en) Webpage loading method and device
CN107181779B (en) Method, device and system for processing access request
CN109302437B (en) Method and device for redirecting website
US20120054295A1 (en) Method and apparatus for providing or acquiring the contents of a network resource for a mobile device
CN110213331B (en) Service request processing method, terminal device, electronic device and storage medium
CN112513830A (en) Back-source method and related device in content distribution network
CN112751917A (en) Resource file loading method, network device, electronic device and storage medium
US11463753B2 (en) Method and apparatus for downloading resources
WO2019000722A1 (en) Hypertext markup language webpage loading method and device
CN107786502B (en) Authentication proxy method, device and equipment
CN110753315A (en) Video short message issuing processing method and device
CN108810092B (en) Network access method and device, electronic equipment and computer readable storage medium
CN106411978B (en) Resource caching method and device
KR100681873B1 (en) Radio terminal
CN112926002A (en) Service request processing method and device
CN112181532A (en) Page resource loading method and device, electronic equipment and readable storage medium
US20190132408A1 (en) Webpage Loading Method and Apparatus
CN110582090A (en) CDN scheduling method, scheduling system and MEC network element
CN106657039B (en) Portal page acquisition method, wireless AP and Portal server
CN106790176B (en) Method and system for accessing network
CN113779458B (en) Method and device for accelerating application loading, electronic equipment and storage medium

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
WW01 Invention patent application withdrawn after publication

Application publication date: 20210504

WW01 Invention patent application withdrawn after publication