嵌入式Web服务器软件构成与工作原理

Linux大全评论2.4K views阅读模式

嵌入式Web 服务器的工作原理

1、服务器软件(BOA)始终在HTTP 端口守候客户端的连接请求,当客户端向服务器发起一个连接请求后,客户端和服务器之间经过“三步握手”建立起连接。

2、在接收到客户端的HTTP 请求消息后,服务器对消息进行解析,包括:读取请求URL、映射到对应的物理文件、区分客户端请求的资源是静态页面还是CGI 应用程序等。

3、如果客户请求的是静态文件,那么服务器读取相应的磁盘文件,并将其作为HTTP 响应消息中的实体返回给客户端,如果客户端请求的是CGI 应用程序,那么服务器将创建相应的CGI 应用程序进程,并将各种所需信息(客户端请求信息、服务器端相关信息等)按CGI 规范传递给CGI 应用程序进程,此后由CGI 应用程序接管控制。

 

CGI 应用程序的工作原理

1、CGI 应用程序读取从Web 服务器传递来的各种信息,并对客户端的请求进行解释和处理,如:使用SQL 语句来检索或者更新数据库。

2、CGI 应用程序将处理结果按照CGI 规范返回给Web 服务器,Web 服务器会对CGI 应用程序的处理结果进行解析,并在此基础上生成HTTP 响应信息返回给客户端。

 

嵌入式Web服务器软件构成与工作原理图

 

 

嵌入式Web服务器软件构成

编号

软件名称

类型

说明

01

BOA

Web服务

它是一个运行在类UNIX系统中的小型Web服务器开源软件。它的基本功能包括:和客户端建立连接,接收客户提交的HTTP请求消息,将HTTP响应消息返回给客户,关闭连接等。

02

CGI

Web应用程序

CGI(Common Gateway Interface公共网关接口)规范给出了Web服务器和CGI应用程序进程之间传递信息的标准,是嵌入式Web服务器中实现客户与服务器动态交互的主要手段;网关应用程序也叫CGI应用程序,遵循CGI规范和Web服务器进行交互,并能通过在网关应用程序中内嵌的SQL语句实施对数据库的访问操作。

03

SQLite

嵌入式数据库

SQLite是一个嵌入式数据库管理系统,与CGI应用程序处于同一个服务器平台。

 

 

Embedded Web Server Software Composition And Working Principle, Part One

 

 

Embedded Web Server Working Principle
1, the server software (BOA) is always waiting for client in the HTTP port for connection requests, when a client   initiates a connection request to the server, the client and the server through the "three-step handshake/three-way handshaking " to establish connection.
2, after receiving the client's HTTP message requests, the server parses the message, including: reading the request URL, mapping to the corresponding physical file, the differentiating the client requests resources between a static page or CGI applications and so on.
3, if the client requests a static file, then the server reads the corresponding disk file, and as an entity in the HTTP response message back to the client, if the client requests is the CGI application, then the server will create the appropriate CGI application process, and all the necessary information (client requests information, the server information, etc) according to CGI specification passed to the CGI application process, then take over control to the CGI application.

 

CGI Application Working Principle
1, CGI application to read varieties of information from the Web server, and to interpret client requests and processing, for example: using SQL statements to retrieve or update the database.
2, CGI application will return the results in accordance with the CGI specification back to the Web server, Web server CGI application will parse the results and generate HTTP responses based on this information back to the client.

 

Schematic Diagram

 

 

Embedded Web Server Software Composition

Num

Softeware Name

Type

Explanation

01

BOA

Web Sever

It is a a small running in pan-UNIX system Web server open source software. Its basic functions include: establish a connection with the client, receive HTTP request message, return the HTTP requests message to the client, and close the connection.

02

CGI

Web Application

CGI(Common Gateway Interface) Specification gives a standard of the Web server and CGI the application passing information, is a primary means of dynamic interaction between client and server in embedded Web server, gateway applications, also known as CGI applications, follow the CGI specification and Interact with Web server, and through CGI applications SQL statements implement database access operations.

03

SQLite

Database

企鹅博客
  • 本文由 发表于 2020年9月28日 10:51:19
  • 转载请务必保留本文链接:https://www.qieseo.com/141247.html

发表评论