ufairiya / mongoose

Automatically exported from code.google.com/p/mongoose
MIT License
0 stars 0 forks source link

mg_request_info remote_ip always 0 #161

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I can't seem to get the visitors IP address from mg_request_info -> remote_ip 
with the latest source from "hg" repository. The long always is "0" on my 
Debian Linux 32bit compiled with gcc.

What steps will reproduce the problem?
1. Open the chat.c example and modify the "process_request" function.
2. Add this line: 
    printf("%ld\n", request_info->remote_ip);
3. Execute "make" in example/ to build the chat application. 

When you request a page from the application (Call http://blabla:8081/ in your 
browser) you get a line "0" on StdOut running the chat server. Instead of "0" 
you should be seeing the integer representation of the caller's ip address. 

Original issue reported on code.google.com by Bla...@gmail.com on 3 Aug 2010 at 5:44

GoogleCodeExporter commented 9 years ago
Getting closer...

In process_new_connection() there is a call to reset_connection_attributes().

This function resets all values in conn->request_info to zero. Not sure why 
this it done, but it kills the remote_ip.

Original comment by Bla...@gmail.com on 3 Aug 2010 at 6:09

GoogleCodeExporter commented 9 years ago
Ooops :-)

Original comment by valenok on 3 Aug 2010 at 6:59

GoogleCodeExporter commented 9 years ago
Issue 163 has been merged into this issue.

Original comment by valenok on 23 Aug 2010 at 7:33

GoogleCodeExporter commented 9 years ago
Fixed in the head branch.

Original comment by valenok on 23 Aug 2010 at 7:34

GoogleCodeExporter commented 9 years ago
Fixed in the head branch.

Original comment by valenok on 23 Aug 2010 at 7:34