⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eapi.patch

📁 mod_ssl-2.8.31-1.3.41.tar.gz 好用的ssl工具
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
     ap_unblock_alarms();@@ -552,6 +712,30 @@     return bytes_in_block_list(block_freelist); } +#if defined(EAPI)+API_EXPORT(int) ap_acquire_pool(pool *p, ap_pool_lock_mode mode)+{+#if defined(EAPI_MM)+    if (!p->is_shm)+        return 1;+    return ap_mm_lock(mm, mode == AP_POOL_RD ? AP_MM_LOCK_RD : AP_MM_LOCK_RW);+#else+	return 1;+#endif+}++API_EXPORT(int) ap_release_pool(pool *p)+{+#if defined(EAPI_MM)+    if (!p->is_shm)+        return 1;+    return ap_mm_unlock(mm);+#else+	return 1;+#endif+}+#endif /* EAPI */+ /*****************************************************************  * POOL_DEBUG support  */@@ -717,16 +901,31 @@      ap_block_alarms(); +#if defined(EAPI) && defined(EAPI_MM)+    if (a->is_shm)+	(void)ap_mm_lock(mm, AP_MM_LOCK_RW);+#endif     (void) ap_acquire_mutex(alloc_mutex); +#if defined(EAPI) && defined(EAPI_MM)+    blok = new_block(size, a->is_shm);+#else     blok = new_block(size);+#endif     a->last->h.next = blok;     a->last = blok; #ifdef POOL_DEBUG     blok->h.owning_pool = a; #endif+#if defined(EAPI) && defined(EAPI_MM)+    blok->h.is_shm = a->is_shm;+#endif      (void) ap_release_mutex(alloc_mutex);+#if defined(EAPI) && defined(EAPI_MM)+    if (a->is_shm)+	(void)ap_mm_unlock(mm);+#endif      ap_unblock_alarms(); @@ -843,6 +1042,11 @@     size = cur_len << 1;     if (size < AP_PSPRINTF_MIN_SIZE)         size = AP_PSPRINTF_MIN_SIZE;+#if defined(EAPI) && defined(EAPI_MM)+    if (ps->block->h.is_shm)+        ptr = ap_mm_realloc(ps->base, size);+    else+#endif     ptr = realloc(ps->base, size);     if (ptr == NULL) { 	fputs("Ouch!  Out of memory!\n", stderr);@@ -866,9 +1070,21 @@         size = AP_PSPRINTF_MIN_SIZE;      /* must try another blok */+#if defined(EAPI) && defined(EAPI_MM)+    if (blok->h.is_shm)+	(void)ap_mm_lock(mm, AP_MM_LOCK_RW);+#endif     (void) ap_acquire_mutex(alloc_mutex);+#if defined(EAPI) && defined(EAPI_MM)+    nblok = new_block(size, blok->h.is_shm);+#else     nblok = new_block(size);+#endif     (void) ap_release_mutex(alloc_mutex);+#if defined(EAPI) && defined(EAPI_MM)+    if (blok->h.is_shm)+	(void)ap_mm_unlock(mm);+#endif     memcpy(nblok->h.first_avail, blok->h.first_avail, cur_len);     ps->vbuff.curpos = nblok->h.first_avail + cur_len;     /* save a byte for the NUL terminator */@@ -877,10 +1093,18 @@     /* did we allocate the current blok? if so free it up */     if (ps->got_a_new_block) { 	debug_fill(blok->h.first_avail, blok->h.endp - blok->h.first_avail);+#if defined(EAPI) && defined(EAPI_MM)+    if (blok->h.is_shm)+	(void)ap_mm_lock(mm, AP_MM_LOCK_RW);+#endif 	(void) ap_acquire_mutex(alloc_mutex); 	blok->h.next = block_freelist; 	block_freelist = blok; 	(void) ap_release_mutex(alloc_mutex);+#if defined(EAPI) && defined(EAPI_MM)+    if (blok->h.is_shm)+	(void)ap_mm_unlock(mm);+#endif     }     ps->blok = nblok;     ps->got_a_new_block = 1;@@ -899,6 +1123,11 @@     void *ptr;      ap_block_alarms();+#if defined(EAPI) && defined(EAPI_MM)+    if (p->is_shm)+        ps.base = ap_mm_malloc(mm, 512);+    else+#endif     ps.base = malloc(512);     if (ps.base == NULL) { 	fputs("Ouch!  Out of memory!\n", stderr);@@ -911,6 +1140,11 @@     *ps.vbuff.curpos++ = '\0';     ptr = ps.base;     /* shrink */+#if defined(EAPI) && defined(EAPI_MM)+    if (p->is_shm)+        ptr = ap_mm_realloc(ptr, (char *)ps.vbuff.curpos - (char *)ptr);+    else+#endif     ptr = realloc(ptr, (char *)ps.vbuff.curpos - (char *)ptr);     if (ptr == NULL) { 	fputs("Ouch!  Out of memory!\n", stderr);+---------------------------------------------------------------------------| Patch the low-level buffer routines to additionally allow| modules to intercept the I/O processing via hooks.+---------------------------------------------------------------------------Index: src/main/buff.c--- src/main/buff.c	28 Jul 2006 13:55:34 -0000	1.1.1.17+++ src/main/buff.c	28 Jul 2006 13:56:29 -0000	1.25@@ -251,6 +251,9 @@     }     else #endif+#ifdef EAPI+	if (!ap_hook_call("ap::buff::read", &rv, fb, buf, nbyte))+#endif /* EAPI */ 	rv = read(fb->fd_in, buf, nbyte);          return rv;@@ -262,6 +265,9 @@  #if defined (WIN32) || defined(NETWARE) || defined(CYGWIN_WINSOCK)      if (fb->flags & B_SOCKET) {+#ifdef EAPI+	if (!ap_hook_call("ap::buff::recvwithtimeout", &rv, fb, buf, nbyte))+#endif /* EAPI */ 	rv = ap_recvwithtimeout(fb->fd_in, buf, nbyte, 0); 	if (rv == SOCKET_ERROR) 	    errno = WSAGetLastError();@@ -312,6 +318,9 @@     }     else #endif+#ifdef EAPI+	if (!ap_hook_call("ap::buff::write", &rv, fb, buf, nbyte))+#endif /* EAPI */ #if defined (B_SFIO) 	rv = sfwrite(fb->sf_out, buf, nbyte); #else@@ -342,6 +351,9 @@     #if defined(WIN32) || defined(NETWARE)     if (fb->flags & B_SOCKET) {+#ifdef EAPI+	if (!ap_hook_call("ap::buff::sendwithtimeout", &rv, fb, buf, nbyte))+#endif /* EAPI */ 	rv = ap_sendwithtimeout(fb->fd, buf, nbyte, 0); 	if (rv == SOCKET_ERROR) 	    errno = WSAGetLastError();@@ -425,6 +437,10 @@     fb->callback_data = NULL;     fb->filter_callback = NULL; +#ifdef EAPI+    fb->ctx = ap_ctx_new(p);+#endif /* EAPI */+     return fb; } @@ -1077,6 +1093,9 @@     i = 0;     while (i < nvec) { 	do+#ifdef EAPI+	    if (!ap_hook_call("ap::buff::writev", &rv, fb, &vec[i], nvec -i))+#endif /* EAPI */ 	    rv = writev(fb->fd, &vec[i], nvec - i); 	while (rv == -1 && (errno == EINTR || errno == EAGAIN) 	       && !(fb->flags & B_EOUT));+---------------------------------------------------------------------------| Add the implementation of the additional `add_module' and| `rewrite_command' module hooks. Additionally the `ctx'| variables are initialized.+---------------------------------------------------------------------------Index: src/main/http_config.c--- src/main/http_config.c	28 Jul 2006 13:55:33 -0000	1.1.1.21+++ src/main/http_config.c	28 Jul 2006 13:56:29 -0000	1.24@@ -558,6 +558,20 @@ 	m->name = tmp;     } #endif /*_OSD_POSIX*/++#ifdef EAPI+    /*+     * Invoke the `add_module' hook inside the now existing set+     * of modules to let them all now that this module was added.+     */+    {+        module *m2;+        for (m2 = top_module; m2 != NULL; m2 = m2->next)+            if (m2->magic == MODULE_MAGIC_COOKIE_EAPI)+                if (m2->add_module != NULL)+                    (*m2->add_module)(m);+    }+#endif /* EAPI */ }  /* @@ -572,6 +586,21 @@ {     module *modp; +#ifdef EAPI+    /*+     * Invoke the `remove_module' hook inside the now existing+     * set of modules to let them all now that this module is+     * beeing removed.+     */+    {+        module *m2;+        for (m2 = top_module; m2 != NULL; m2 = m2->next)+            if (m2->magic == MODULE_MAGIC_COOKIE_EAPI)+                if (m2->remove_module != NULL)+                    (*m2->remove_module)(m);+    }+#endif /* EAPI */+     modp = top_module;     if (modp == m) { 	/* We are the top module, special case */@@ -965,6 +994,27 @@     const command_rec *cmd;     module *mod = top_module; +#ifdef EAPI+    /*+     * Invoke the `rewrite_command' of modules to allow+     * they to rewrite the directive line before we+     * process it.+     */+    {+        module *m;+        char *cp;+        for (m = top_module; m != NULL; m = m->next) {+            if (m->magic == MODULE_MAGIC_COOKIE_EAPI) {+                if (m->rewrite_command != NULL) {+                    cp = (m->rewrite_command)(parms, config, l);+                    if (cp != NULL)+                        l = cp;+                }+            }+        }+    }+#endif /* EAPI */+     if ((l[0] == '#') || (!l[0])) 	return NULL; @@ -1429,6 +1479,10 @@     s->limit_req_fieldsize = main_server->limit_req_fieldsize;     s->limit_req_fields = main_server->limit_req_fields; +#ifdef EAPI+    s->ctx = ap_ctx_new(p);+#endif /* EAPI */+     *ps = s;      return ap_parse_vhost_addrs(p, hostname, s);@@ -1540,6 +1594,10 @@     s->module_config = create_server_config(p, s);     s->lookup_defaults = create_default_per_dir_config(p); +#ifdef EAPI+    s->ctx = ap_ctx_new(p);+#endif /* EAPI */+     return s; } +---------------------------------------------------------------------------| Add the ap_global_ctx variable and the new| ap_add_config_define() function. Additionally the| implementation of the additional `new_connection' module hook| is added plus the initialization of one more `ctx' variable.+---------------------------------------------------------------------------Index: src/main/http_main.c--- src/main/http_main.c	8 Feb 2008 11:15:39 -0000	1.1.1.28+++ src/main/http_main.c	8 Feb 2008 11:17:39 -0000	1.51@@ -243,6 +243,9 @@  int ap_dump_settings = 0; API_VAR_EXPORT int ap_extended_status = 0;+#ifdef EAPI+API_VAR_EXPORT ap_ctx *ap_global_ctx;+#endif /* EAPI */  /*  * The max child slot ever assigned, preserved across restarts.  Necessary@@ -479,6 +482,30 @@     } } +#ifdef EAPI+API_EXPORT(void) ap_add_config_define(const char *define)+{+    char **var;+    var = (char **)ap_push_array(ap_server_config_defines);+    *var = ap_pstrdup(pcommands, define);+    return;+}++/*+ * Invoke the `close_connection' hook of modules to let them do+ * some connection dependent actions before we close it.+ */+static void ap_call_close_connection_hook(conn_rec *c)+{+    module *m;+    for (m = top_module; m != NULL; m = m->next)+        if (m->magic == MODULE_MAGIC_COOKIE_EAPI)+            if (m->close_connection != NULL)+                (*m->close_connection)(c);+    return;+}+#endif /* EAPI */+ #ifndef NETWARE static APACHE_TLS int volatile exit_after_unblock = 0; #endif@@ -1594,6 +1621,9 @@ 	}  	ap_bsetflag(save_req->connection->client, B_EOUT, 1);+#ifdef EAPI+	ap_call_close_connection_hook(save_req->connection);+#endif /* EAPI */ 	ap_bclose(save_req->connection->client); 	 	if (!ap_standalone)@@ -1602,6 +1632,9 @@     }     else {			/* abort the connection */ 	ap_bsetflag(current_conn->client, B_EOUT, 1);+#ifdef EAPI+	ap_call_close_connection_hook(current_conn);+#endif /* EAPI */ 	ap_bclose(current_conn->client); 	current_conn->aborted = 1;     }@@ -1923,10 +1956,16 @@     /* Send any leftover data to the client, but never try to again */      if (ap_bflush(r->connection->client) == -1) {+#ifdef EAPI+	ap_call_close_connection_hook(r->connection);+#endif /* EAPI */ 	ap_kill_timeout(r); 	ap_bclose(r->connection->client); 	return;     }+#ifdef EAPI+    ap_call_close_connection_hook(r->connection);+#endif /* EAPI */     ap_bsetflag(r->connection->client, B_EOUT, 1);      /* Close our half of the connection --- send the client a FIN */@@ -2625,6 +2664,9 @@

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -