Hi Bhavna,

>> I need the source code file of apache which accepts requests and through 
>> which I can get the IP at the initial stage.
i think you looking for that <path-to-http-2.2.23>/server/listen.c line 174

   173  #ifdef MPM_ACCEPT_FUNC
   174      server->accept_func = MPM_ACCEPT_FUNC;
   175  #else
   176      server->accept_func = NULL;
   177  #endif

for unix environnment MPM_ACCEPT_FUNC is defined on
<path-to-http-2.2.23>/os/unix/unixd.c

AP_DECLARE(apr_status_t) unixd_accept(void **accepted, ap_listen_rec *lr,
   514                                          apr_pool_t *ptrans)
   515  {
   516      apr_socket_t *csd;
   517      apr_status_t status;
   518  #ifdef _OSD_POSIX
   519      int sockdes;
   520  #endif
   521
   522      *accepted = NULL;
   523      status = apr_socket_accept(&csd, lr->sd, ptrans);
   524      if (status == APR_SUCCESS) {
   525          *accepted = csd;
   526  #ifdef _OSD_POSIX
   527          apr_os_sock_get(&sockdes, csd);
   528          if (sockdes >= FD_SETSIZE) {
   529              ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL,
   530                           "new file descriptor %d is too large;
you probably need "
   531                           "to rebuild Apache with a larger FD_SETSIZE "
   532                           "(currently %d)",
   533                           sockdes, FD_SETSIZE);
   534              apr_socket_close(csd);
   535              return APR_EINTR;
   536          }
   537  #endif

i am newbie on httpd source code but in C language accept is the main
entry of all client so i think is the entry of all client of httpd
and according to  <path-to-apr-1.4.6>/network_io/unix/sockets.c

apr_status_t apr_os_sock_get(apr_os_sock_t *thesock, apr_socket_t *sock)
{
    *thesock = sock->socketdes;
    return APR_SUCCESS;
}

so after this

   527          apr_os_sock_get(&sockdes, csd);
   528          if (sockdes >= FD_SETSIZE) {

you could put your code there. Client socket is sockdes and is correctly set

I hope my help could be useful to you


2012/12/26 Nick Kew <n...@webthing.com>:
>
> On 26 Dec 2012, at 19:31, John Iliffe wrote:
>
>> Maybe I'm missing something following this discussion, but doesn't the
>> following PHP command fetch the information you need?  If so, I'm sure the
>> same results can be obtained in other scripting languages.
>>
>> $_SERVER['REMOTE_ADDR'];
>
> You may want to update that.
>
> Since 2.4, apache makes the distinction between the the two different
> REMOTE_ADDR candidates: the peer making the TCP connection,
> and the client making the HTTP request.  In other words, the nearest
> proxy and the end-user.  The latter is of course very easy to spoof,
> but is nevertheless the one most applications want.
>
> To the OP, if you can't figure it out from what you've already been told,
> hire a techie.  You probably just want a competent sysop.
>
> --
> Nick Kew
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
>



-- 
Jo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to