首页 > 其他分享 >什么是Apache Access Log中的OPTIONS *的含义

什么是Apache Access Log中的OPTIONS *的含义

时间:2023-10-11 10:11:19浏览次数:30  
标签:HTTP Log apr Access 进程 Apache pod OPTIONS

访问日志

在Apache的Access Log中会看到很多如下的访问日志:

127.0.0.1 - - [05/May/2011:10:54:07 +0800] "OPTIONS * HTTP/1.0" 200 -
127.0.0.1 - - [05/May/2011:10:54:08 +0800] "OPTIONS * HTTP/1.0" 200 -
127.0.0.1 - - [05/May/2011:10:54:09 +0800] "OPTIONS * HTTP/1.0" 200 -
127.0.0.1 - - [05/May/2011:10:54:10 +0800] "OPTIONS * HTTP/1.0" 200 - 

这是什么意思呢?

Apache的文档的说明

Apache的文档中, 有如下的说明:

When the Apache HTTP Server manages its child processes, it needs a way to wake up processes that are listening for new connections. To do this, it sends a simple HTTP request back to itself. This request will appear in the access_log file with the remote address set to the loop-back interface (typically 127.0.0.1 or ::1 if IPv6 is configured). If you log the User-Agent string (as in the combined log format), you will see the server signature followed by “(internal dummy connection)” on non-SSL servers. During certain periods you may see up to one such request for each httpd child process.

可是,为什么要唤醒呢? 唤醒是为了做什么呢?

什么是Apache Access Log中的OPTIONS *的含义什么是Apache Access Log中的OPTIONS *的含义

在Apache Prefork模式下, 启动的时候,Apache就会fork出一些worker进程, 来准备接受请求, 这些worker进程,在完成准备工作以后, 就会进入block模式的监听沉睡中, 等待请求到来而被唤醒。

另外一方面, 在Prefork模式下, 当请求很多, 目前的worker进程数不够处理的时候, 就会额外再fork一些worker进程出来, 以满足当前的请求。

而在这些请求高峰过后, 如果额外fork出来的进程数大于了MaxSpareServers, Apache就会告诉这些worker进程退出, 那么问题就来了。

这些进程都在沉睡中啊, 怎么告诉他们, 并且让他们自我退出呢?

自我退出

Apache会首先发送一个退出状态字(GRACEFUL_CHAR !)给这些Work进程:

static apr_status_t pod_signal_internal(ap_pod_t *pod)
{
    apr_status_t rv;
    char char_of_death = '!';
    apr_size_t one = 1;
 
    rv = apr_file_write(pod->pod_out, &char_of_death, &one);
    if (rv != APR_SUCCESS) {
        ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf,
                     "write pipe_of_death");
    }
 
.    return rv;
}

但此时, Worker进程不会去读这些状态字, 因为他们还在沉睡。

这个时候Apache就会发送一个OPTIONS请求给自己, 唤醒这些沉睡的进程:

static apr_status_t dummy_connection(ap_pod_t *pod)
{
//...有省略
    /* Create the request string. We include a User-Agent so that
     * adminstrators can track down the cause of the odd-looking
     * requests in their logs.
     */
    srequest = apr_pstrcat(p, "OPTIONS * HTTP/1.0\r\nUser-Agent: ",
                           ap_get_server_banner(),
                           " (internal dummy connection)\r\n\r\n", NULL);
//...有省略
}

这些进程在处理完当前请求以后(OPTIONS请求), 就会发现, oh, 主进程让我退出。

static void child_main(int child_num_arg)
{
//...有省略
 
    while (!die_now && !shutdown_pending) {
//...有省略
        //1. listen
        //2. accept
       //3. process request
 
        /* Check the pod and the generation number after processing a
         * connection so that we'll go away if a graceful restart occurred
         * while we were processing the connection or we are the lucky
         * idle server process that gets to die.
         */
        if (ap_mpm_pod_check(pod) == APR_SUCCESS) { /* selected as idle? */
            die_now = 1;
        }
//...有省略
   }
//...有省略
}

于是, 它就做完清理工作, 然后自我消亡了~~~

标签:HTTP,Log,apr,Access,进程,Apache,pod,OPTIONS
From: https://www.cnblogs.com/roccn/p/17756400.html

相关文章

  • CTFer blogs--Web-fileinclude
    本题来源攻防世界解题思路:首先分析代码,将cookie中‘language’的值传入lan在后续又使用include调用了lan这个变量,因此可以从此处写入读取flag.php的payload可以使用burpsuite进行抓包后添加cookie值name:languagevalue:php://filter/read=convert.base64-encode/resource=/var......
  • QT常用控件之QTimer,QDialog,QLabel,QLineEdit,QProgressBar,QComboBox,QPushButton,QGridLay
    QT常用控件的组合#ifndefPROGRESSBARWIDGET_H#definePROGRESSBARWIDGET_H#include<QWidget>#include<QTimer>#include<QDialog>#include<QLabel>#include<QLineEdit>#include<QProgressBar>//显示进度条的控件#include<QComboBo......
  • logger.add() 方法的所有参数及其用法说明:
    Loguru是一个强大而易于使用的日志记录库,logger.add()方法用于向Logurulogger添加处理程序。下面是logger.add()方法的所有参数及其用法说明:logger.add(sink,*,level=None,format=None,filter=None,colorize=None,backtrace=None,diagnose=None,serialize=False,......
  • Direct Component/SEDA Component/VM Component/Timer Component/Log Component/Cache
    http://camel.apache.org/direct.htmlDirectComponentThedirect:componentprovidesdirect,synchronousinvocationofanyconsumerswhenaproducersendsamessageexchange.Thisendpointcanbeusedtoconnectexistingroutesinthesamecamelcontext.Asy......
  • R语言基于Bagging分类的逻辑回归(Logistic Regression)、决策树、森林分析心脏病患者
    原文链接:http://tecdat.cn/?p=22448原文出处:拓端数据部落公众号最近我们被客户要求撰写关于分析心脏病患者的研究报告,包括一些图形和统计输出。今天,我们将看下bagging技术里面的启发式算法。通常,bagging与树有关,用于生成森林。但实际上,任何类型的模型都有可能使用bagging。......
  • allure 报告页面logo和名称定制
    1)找到本地allure安装路径,找到static文件夹(我的是:/Users/may/Downloads/allure-2.7.0/plugins/custom-logo-plugin/static), 将要更换的图片放入这个文件夹中,命名为allure_log.jpeg 2)修改取值文件,在同一个文件夹(static)下,找到styles.css,打开该文件(不建议用记事本)原来代码如......
  • README-cnblog
    Classification-CNN1.basemodel1.AlexNet卷积核:11,5,3上下两块单独训练所有卷积层都使用ReLU作为非线性映射函数,使模型收敛速度更快在多个GPU上进行模型的训练,不但可以提高模型的训练速度,还能提升数据的使用规模使用LRN对局部的特征进行归一化,结果作为ReLU激活函数的输......
  • facial-cnblog-cnblog
    FacialKeypoint人脸关键点检测的技术原理人脸关键点是人脸相关的项目中需要使用的,是在人脸检测获取到人脸在图像中具体位置的基础上,进一步定位人脸器官的位置。获取到人脸上的关键点,可以极大地提升人脸识别、人脸属性分析、表情分类等算法的性能和稳定性。人脸关键点可以......
  • 虚拟环境搭建、luffy后台项目创建,目录调整、封装logger、封装全局异常、封装Response
    虚拟环境搭建#1虚拟环境作用多个项目,自己有自己的环境,装的模块属于自己的#2使用pycharm创建-一般放在项目路径下:venv文件夹-lib文件夹---》site-package--》虚拟环境装的模块,都会放在这里-scripts--》python,pip命令#3本地创建......
  • 【Azure Logic App】在Logic App中使用 Transfer XML组件遇见错误 undefined
    问题描述在AzureLogicApp中,使用TransformXML组件进行XML内容的转换,但是最近这个组件运行始终失败。 问题解答点击TransformXML组件上的错误案例,并不能查看到详细的错误消息。最后在AzureLogicApp的产品团队确认下,发现这是LogicApp自身升级后,当前LogicApp 依旧是旧版所引......