views:

135

answers:

1

I want to create a log file for my webserver written in C under UNIX.

The logfile should be formatted according to Common Log Format, but I don't know how to get the ident and authuser from the connecting socket.

Is there a simple way to get these from the socket?

+4  A: 

User name is not an attribute of socket - you need to get it from HTTP request, so sockets API can't help you on this.

qrdl
Thanks, but I can't find it in the HTTP request. Where can I find it?
petsson
See HTTP RFC for HTTP header - http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.3Authorization is what you need.Also see here: http://en.wikipedia.org/wiki/Basic_access_authentication
qrdl
Thanks for the information!
petsson