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

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

 

嵌入式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

 

 

EmbeddedWebServerWorking Principle
1, the server software (BOA)is always waiting forclient in theHTTP port for connection requests, when aclient  initiates aconnection requestto the server, the client and server establish connection via"three-stephandshake".
2, after receiving the client's HTTPmessage requests, the serverparses the messages, including:reading therequestURL,mapping tothe correspondingphysical file, the differentiatingthe client requestsresources between
a staticpage and CGIapplications, etc.
3, if the client requests is a staticfile, then the server reads thecorrespondingdisk file,and asan entityin the HTTPresponse messageback to the client, if the clientrequestis the CGIapplication,then theserver will create the appropriateCGIapplication process, and all the necessaryinformation (client requestsinformation, the serverinformation, etc)according to CGI specification will bepassed to theCGIapplication process, thentake over controlto the CGIapplication.

 

CGI Application Working Principle
1, CGI application reads varieties of information from the Web server, interprets and processesclient requests, 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 small running inpan-UNIX system Web server open source software. Its basic functions include: establish a connectionwith the client,receive HTTP request message,return the HTTP requests messageto the client, and close the connection.

02

CGI

Web Application

CGI(Common Gateway Interface) Specificationgives astandard of the Webserver andCGItheapplicationpassing information, is a primary means ofdynamic interactionbetween client andserver in embedded Web server,gateway applications, also known as CGI applications, follow the CGI specification and Interact withWeb server, and through CGI applicationsSQL statements implement database access operations.

03

SQLite

Database

SQLite is an embedded database management system, with CGI application on the same server platform.

 

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值