summaryrefslogtreecommitdiffstats
path: root/server/connection.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *) core: adding a new hook and method to the API:Stefan Eissing2022-03-181-0/+11
| | | | | | | | | | | | | | | | | create_secondary_connection and ap_create_secondary_connection() to setup connections related to a "master" one, as used in the HTTP/2 protocol implementation. *) mod_http2: using the new API calls to get rid of knowledge about how the core handles conn_rec specifics. Improvements in pollset stream handling to use less sets. Using atomic read/writes instead of volatiles now. Keeping a reserve of "transit" pools and bucket_allocs for use on secondary connections to avoid repeated setup/teardowns. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899032 13f79535-47bb-0310-9956-ffa450edef68
* *) core: Be safe with ap_lingering_close() called with a socket NULL-ed.Yann Ylavic2021-10-121-3/+10
| | | | | | | | | | | | | | | | | | | | | PR 65627. mod_itk seems to: ap_set_core_module_config(c->conn_config, NULL) before calling ap_lingering_close(), causing a crash after r1891721. Until we have an API to no-op ap_lingering_close(), let's be safe. * server/connection.c(ap_start_lingering_close): The socket should not be NULL here, add an assertion. * server/connection.c(ap_lingering_close): Set c->aborted if the socket is NULL, and give up. Submitted by: acmondor <bz.apache.org acmondor.ca>, ylavic git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894171 13f79535-47bb-0310-9956-ffa450edef68
* In case one of the pre_connection hooks causes the hook run to stop by an errorRuediger Pluem2021-09-211-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | the pre_connection hook of the core module maybe did not run (it is APR_HOOK_REALLY_LAST) and hence we missed to - Put the socket in c->conn_config - Setup core output and input filters - Set socket options and timeouts For calls of ap_run_pre_connection where this matters create a wrapper named ap_pre_connection that ensures that this happens. * include/ap_mmn.h: Bump minor version as we added new ap_pre_connection function. * include/http_connection.h: Declare ap_pre_connection prototype. * server/connection.c: Make use of ap_pre_connection in ap_process_connection. * server/core.c: Implement ap_pre_connection. * server/mpm/event/event.c: Make use of ap_pre_connection. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893497 13f79535-47bb-0310-9956-ffa450edef68
* core: Add ap_create_connection() to create a server or client/proxy connection.Yann Ylavic2021-09-091-0/+23
| | | | | | | | | | | | | | | | | | | | | | c->outgoing shouldn't be set by mod_ssl, ap_create_connection() allows that and this commit also replaces all the calls to ap_run_create_connection() in mod_proxy modules (not in the MPMs which create incoming connections only). * include/http_connection.h, server/connection.c: Declare and implement ap_create_connection(). * modules/proxy/proxy_util.c, modules/proxy/mod_proxy_connect.c, modules/proxy/mod_proxy_ftp.c: Use ap_create_connection() instead of ap_run_create_connection(), and don't provide a connection_id a scoreboard handle for outgoing connection. * server/log.c(do_errorlog_default): Use c->outgoing instead of c->sbh to determine if it's a "client" or "remote" connection. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893184 13f79535-47bb-0310-9956-ffa450edef68
* core: don't close the socket when failing in ap_start_lingering_close().Yann Ylavic2021-07-221-7/+2
| | | | | | | | | | | | | | | | | | | * server/connection.c (ap_start_lingering_close): Don't apr_socket_close(). * server/connection.c (ap_lingering_close): Do apr_socket_close() on ap_start_lingering_close() failure. On failure ap_start_lingering_close() did not consistently close the socket, so the caller had to call apr_socket_close() too with possible/unreliable EBADF. The only upstream callers of ap_start_lingering_close() are MPM event and ap_start_lingering_close(), but any third-party user has this issue so the change should't break anyone. Follow up to r1891716. Github: #208 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891721 13f79535-47bb-0310-9956-ffa450edef68
* fix for wrong return check on ap_prep_lingering_close(), causing regressionsStefan Eissing2016-01-291-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1727573 13f79535-47bb-0310-9956-ffa450edef68
* new hook pre_close_connectionStefan Eissing2016-01-271-3/+17
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1727071 13f79535-47bb-0310-9956-ffa450edef68
* Remove some useless 'return' statements.Christophe Jaillet2015-11-211-1/+0
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715584 13f79535-47bb-0310-9956-ffa450edef68
* core: Avoid a compiler warning when NO_LINGCLOSE is used (-Wunreachable-code).Yann Ylavic2015-09-151-14/+7
| | | | | | | | Also, check c->aborted before apr_socket_shutdown() because it is set earlier, and there is no point in calling shutdown() before close(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1703248 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event[opt]: Send the SSL close notify alert when the KeepAliveTimeoutYann Ylavic2014-06-081-5/+15
| | | | | | | expires. PR54998. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1601185 13f79535-47bb-0310-9956-ffa450edef68
* Fix URL in doxygen comment.Christophe Jaillet2014-06-041-2/+2
| | | | | | Previous link was broken. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1599852 13f79535-47bb-0310-9956-ffa450edef68
* core: avoid a double apr_time_now() call on the first succeeding read.Yann Ylavic2014-02-281-4/+5
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1572905 13f79535-47bb-0310-9956-ffa450edef68
* Add in the concept of "slave" connections...Jim Jagielski2014-02-071-1/+0
| | | | | | | | Allows for several "connections" all resulting in a single real connection that talks to the network. Right now, nothing uses this though. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1565657 13f79535-47bb-0310-9956-ffa450edef68
* garbage C's in server-status and extra child processes with async lingeringGreg Ames2011-11-181-1/+3
| | | | | | | | | | | | | | | | | close support in Event. these are set by the listener due to a residual c->sbh for a worker thread no longer associated with the connection. the associated worker threads are really idle and blocked in ap_queue_pop_something and will serve new work normally. but since they are marked as SERVER_CLOSING rather than SERVER_READY in the scoreboard, the parent process thinks they are busy and forks extra children. reproduction recipe: start Event with server-status enabled. hit localhost/server-status?refresh=5 and watch the C's trail behind the lone W. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1203708 13f79535-47bb-0310-9956-ffa450edef68
* Some improvements for handling of many connections for MPM event:Stefan Fritsch2011-06-191-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Process lingering close asynchronously instead of tying up worker threads (based on patch by Jeff Trawick). - If the number of connections of a process is above threads_per_child + WORKER_OVERCOMMIT * (idle_workers - 1) (WORKER_OVERCOMMIT is fixed at 2, at the moment), or if all workers are busy, don't accept new connections in that process. Such a dynamic connection limit is necessary because we may have both async and non-async (ssl) connections. WORKER_OVERCOMMIT should be a config option. - Don't count idle workers of not-accepting processes against MinSpareThreads, so that the parent will spawn new processes when necessary. - If we receive a keep-alive request while all workers are busy, don't block but close the connection immediately so that the client will re-connect to a different process. Related changes: - Log what is going on at trace loglevels. - Remove the bypass_push poll type flag, this code cannot be hit anymore (if it ever could?). - Add some macro helpers for dealing with timeout queues. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1137358 13f79535-47bb-0310-9956-ffa450edef68
* Introduce new function ap_get_conn_socket() to access the socket ofStefan Fritsch2011-06-131-1/+1
| | | | | | | a connection git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1135153 13f79535-47bb-0310-9956-ffa450edef68
* Introduce ap_(get|set)_core_module_config() functions/macros and use themStefan Fritsch2011-06-061-1/+1
| | | | | | | | | | | | everywhere. We know that the core module has module_index 0. Therefore we can save some pointer operations in ap_get_module_config(cv, &core_module) and ap_set_module_config(cv, &core_module, val). As these are called rather often, this may actually have some (small) measurable effect. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1132781 13f79535-47bb-0310-9956-ffa450edef68
* core: shorten the wait time in ap_lingering_close() if theStefan Fritsch2010-03-151-2/+14
| | | | | | | | | | | "short-lingering-close" connection note is set. mod_reqtimeout: Instead of setting c->aborted, use the "short-lingering-close" connection note to shut down the connection quickly while still giving the client a chance to receive the error message. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@923418 13f79535-47bb-0310-9956-ffa450edef68
* Introduce a new set of APIs to allow MPMs to be proper modules insteadJeff Trawick2009-03-241-1/+0
| | | | | | | | | | | | | | of integral parts which share global variables, functions, and macros with the rest of httpd. Converted now: prefork, worker, event, simple, WinNT* *WinNT hasn't been built or tested, and relies on a hack to include the WinNT mpm.h to disable Unixy MPM support routines in mpm_common.c git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@757853 13f79535-47bb-0310-9956-ffa450edef68
* Remove all references to CORE_PRIVATE.Paul Querna2008-04-071-1/+0
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@645455 13f79535-47bb-0310-9956-ffa450edef68
* update license header textRoy T. Fielding2006-07-111-6/+6
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@420983 13f79535-47bb-0310-9956-ffa450edef68
* Update the copyright year in all .c, .h and .xml filesColm MacCarthaigh2006-04-191-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@395228 13f79535-47bb-0310-9956-ffa450edef68
* No functional Change: Removing trailing whitespace. This alsoJim Jagielski2005-11-101-1/+1
| | | | | | | | means that "blank" lines consisting of just spaces or tabs are now really blank lines git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@332306 13f79535-47bb-0310-9956-ffa450edef68
* No functional change: simple detabbing of indented code.Jim Jagielski2005-11-101-2/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@332305 13f79535-47bb-0310-9956-ffa450edef68
* * server/connection.c (ap_lingering_close): Cleanup; no functional change.Joe Orton2005-09-251-7/+3
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@291454 13f79535-47bb-0310-9956-ffa450edef68
* * server/connection.c (ap_lingering_close): Fix lingering close toJoe Orton2005-09-251-10/+16
| | | | | | | | | | | really match the 1.3 behaviour: read from the client for up to ~30 seconds in total. Current behaviour will attempt only 15 read() calls then give up. PR: 35292 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@291452 13f79535-47bb-0310-9956-ffa450edef68
* Update copyright year to 2005 and standardize on current copyright owner line.Justin Erenkrantz2005-02-041-1/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@151408 13f79535-47bb-0310-9956-ffa450edef68
* * server/connection.c (ap_flush_conn): Fix typo.Joe Orton2004-02-281-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102800 13f79535-47bb-0310-9956-ffa450edef68
* Send the 'Close Alert' message to the peer upon closing a SSL session. ThisMadhusudan Mathihalli2004-02-281-0/+7
| | | | | | | | | | | required creating a new EOC (End-Of-Connection) bucket type to notify mod_ssl that the connection is about to be closed. Reviewed by: Joe Orton, Justin Erenkrantz git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102793 13f79535-47bb-0310-9956-ffa450edef68
* fix name of The Apache Software FoundationAndré Malo2004-02-091-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102619 13f79535-47bb-0310-9956-ffa450edef68
* fix copyright dates according to the first check inAndré Malo2004-02-081-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102589 13f79535-47bb-0310-9956-ffa450edef68
* apply Apache License, Version 2.0André Malo2004-02-061-53/+10
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102525 13f79535-47bb-0310-9956-ffa450edef68
* update license to 2004.André Malo2004-01-011-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102135 13f79535-47bb-0310-9956-ffa450edef68
* switch to APR 1.0 API (which is still in flux)Jeff Trawick2003-09-031-2/+2
| | | | | | | | because of the changes to the argument lists of apr_mmap_dup and apr_socket_create, 2.1-dev won't build with apr and apr-util's 0.9 branch anymore git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101154 13f79535-47bb-0310-9956-ffa450edef68
* Apache hooks return int: so s/apr_status_t/int/Stas Bekman2003-03-011-1/+1
| | | | | | | | | | PR: Obtained from: Submitted by: Reviewed by: trawick git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98860 13f79535-47bb-0310-9956-ffa450edef68
* check the return value of ap_run_pre_connection(). So if theStas Bekman2003-02-261-2/+6
| | | | | | | | | | | | pre_connection phase fails (without setting c->aborted) ap_run_process_connection is not executed. PR: Obtained from: Submitted by: Reviewed by: trawick, jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98798 13f79535-47bb-0310-9956-ffa450edef68
* finished that boring job:André Malo2003-02-031-1/+1
| | | | | | | | | update license to 2003. Happy New Year! ;-)) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98573 13f79535-47bb-0310-9956-ffa450edef68
* http occurances to update for apr_socket_opt_get/setWilliam A. Rowe Jr2002-07-151-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96057 13f79535-47bb-0310-9956-ffa450edef68
* Timeout/time fixesWilliam A. Rowe Jr2002-07-151-2/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96055 13f79535-47bb-0310-9956-ffa450edef68
* BUCKET FREELISTSCliff Woolley2002-03-291-4/+4
| | | | | | | | | | | | | Add an allocator-passing mechanism throughout the bucket brigades API. From Apache's standpoint, the apr_bucket_alloc_t* used throughout a given connection is stored in the conn_rec by the create_connection hook. That means it's the MPM's job to optimize recycling of apr_bucket_alloc_t's -- the MPM must ensure that no two threads can ever use the same one at the same time, for instance. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94304 13f79535-47bb-0310-9956-ffa450edef68
* forgot the actual changeIan Holsman2002-03-191-22/+0
| | | | | | | | | | PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94020 13f79535-47bb-0310-9956-ffa450edef68
* Update our copyright for this year.Roy T. Fielding2002-03-131-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93918 13f79535-47bb-0310-9956-ffa450edef68
* Sander's Stylistic SubmissionIan Holsman2002-03-051-15/+16
| | | | | | | | | | | (de-tab) PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93717 13f79535-47bb-0310-9956-ffa450edef68
* Remove the install_transport_filters hook. The same function can beRyan Bloom2002-02-051-8/+3
| | | | | | | | | acheived with the pre_connection hook. I have added the socket to the pre_connection phase to make this possible. Reviewed by: Bill Stoddard git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93259 13f79535-47bb-0310-9956-ffa450edef68
* Reintroduce the create_connection hook. This hook is required to enableBill Stoddard2002-02-011-40/+6
| | | | | | | modules to completely take over all network i/o from the core. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93171 13f79535-47bb-0310-9956-ffa450edef68
* This patch restores most of Ryan's patch (11/12/2001) to remove theBill Stoddard2002-01-291-13/+7
| | | | | | | | | | | | client_socket from the conn_rec. Diffs from Ryan's patch include: - rename the create_connection hook to install_transport_filters - move the point of invocation of the hook till after the call to after ap_update_vhost_given_ip to enable the hook to use vhost config info in its decision making. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93087 13f79535-47bb-0310-9956-ffa450edef68
* Remove the create_connection hook and put the client_socket back into theBill Stoddard2002-01-271-5/+49
| | | | | | | | conn_rec. The create_connection_hook has a design flaw that prevents it from making decisions based on vhost information. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93050 13f79535-47bb-0310-9956-ffa450edef68
* The connection can be aborted in the preconnection hook. If that happens,Bill Stoddard2001-12-231-2/+3
| | | | | | | there is no need to run the process_connection hook. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92580 13f79535-47bb-0310-9956-ffa450edef68
* Change core code to allow an MPM to set hard thread/serverJeff Trawick2001-12-181-3/+3
| | | | | | | limits at startup. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92512 13f79535-47bb-0310-9956-ffa450edef68
* Pull lingering close out of the pool cleanup phase. This was causing tooRyan Bloom2001-11-151-18/+23
| | | | | | | | | | | many bugs. Instead, it is called where it used to be called. I have abstracted some of the logic out of the lingering close so that it gets the socket from the connection using the core's conn_config vector. This is in anticipation of a change to use a hook for the lingering close, which I hope to do soon. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91968 13f79535-47bb-0310-9956-ffa450edef68