在accept()调用后是否拾取虚拟主机根目录?

在accept()调用后是否拾取虚拟主机根目录?,c,apache,sockets,C,Apache,Sockets,文件/etc/Apache2/sites available/000 default.conf # Ensure that Apache listens on port 80 Listen 80 <VirtualHost *:80> DocumentRoot "/www/example1" ServerName www.example.com # Other directives here </VirtualHost> <VirtualH

文件
/etc/Apache2/sites available/000 default.conf

# Ensure that Apache listens on port 80
Listen 80
<VirtualHost *:80>
    DocumentRoot "/www/example1"
    ServerName www.example.com

    # Other directives here
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/www/example2"
    ServerName www.example.org

    # Other directives here
</VirtualHost>
#确保Apache侦听端口80
听80
DocumentRoot“/www/example1”
服务器名www.example.com
#这里还有其他指示
DocumentRoot“/www/example2”
服务器名www.example.org
#这里还有其他指示

二进制
apache2
将监听,类似于,
listen(listenFD,5)

listenFD
应该如下所示:

retval=bind(listenFD,(struct sockaddr*)&servaddr,sizeof(servaddr))
其中
servaddr.sin_port=htons(80)

使用给定的
accept()
调用语法

connfd=accept(listenFD,(struct sockaddr*)&cliaddr,&clilen)

问题:


httpd
服务器是否在
accept()
调用之后决定选择相应虚拟主机的
DocumentRoot
?虚拟主机是否选择应用层逻辑?

在服务器解析
主机:
HTTP头字段之前,无法解析虚拟主机,该字段显然位于
接受()之后
并且在连接的套接字上读取了一定量的数据之后。

在服务器解析
主机:
HTTP头字段之前,无法解析虚拟主机,这显然是在
接受()之后
并且在连接的套接字上读取了一定量的数据之后。

Yup
Host
请求头中的字段定义具有虚拟主机信息Yup
Host
请求头中的字段定义具有虚拟主机信息