From: Vlad S. <vs...@73...> - 2009-01-13 23:46:48
|
Hi! My appmod needs to know (for each request): * what port number has the client connection been accepted on; * whether the connection is SSL'd or not. It looks like there is no way to get this information through Arg record. Is that correct? -- Vlad Skvortsov, vs...@73..., http://vss.73rus.com |
From: Claes W. <kl...@ta...> - 2009-01-14 10:19:27
|
Vlad Skvortsov wrote: > Hi! > > My appmod needs to know (for each request): > * what port number has the client connection been accepted on; > * whether the connection is SSL'd or not. > > It looks like there is no way to get this information through Arg > record. Is that correct? > No, Step 1, determine scheme. Several ways do to this. One is: Url = yaws_api:request_url(Arg), The Url#url.scheme is either of "http" or "https" Once you know that you can do either of ssl:peername(Arg#arg.clisock) or inet:peername(Arg#arg.clisock) /klacke |
From: Vlad S. <vs...@73...> - 2009-01-14 23:39:31
|
Claes Wikström wrote: > Vlad Skvortsov wrote: >> Hi! >> >> My appmod needs to know (for each request): >> * what port number has the client connection been accepted on; >> * whether the connection is SSL'd or not. >> >> It looks like there is no way to get this information through Arg >> record. Is that correct? >> > > No, > > Step 1, determine scheme. Several ways do to this. > One is: > > Url = yaws_api:request_url(Arg), > > The Url#url.scheme is either of "http" or "https" > > Once you know that you can do either of > > ssl:peername(Arg#arg.clisock) > > or > > inet:peername(Arg#arg.clisock) Great, thanks! Though I need a local port, not the peer's one, so inet:port(Arg#arg.clisock) will work (not tested with SSL though). -- Vlad Skvortsov, vs...@73..., http://vss.73rus.com |
From: Claes W. <kl...@ta...> - 2009-01-15 20:57:53
|
Vlad Skvortsov wrote: > Great, thanks! Though I need a local port, not the peer's one, so > inet:port(Arg#arg.clisock) will work (not tested with SSL though). > From # man inets .... sockname(Socket) -> {ok, {Address, Port}} | {error, posix()} Types Socket = socket() Address = ip_address() Port = int() Returns the local address and port number for a socket. ... And same function is available in ssl module /klacke |