<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
My patch for this issue was:<br>
@@ -157,16 +157,13 @@<br>
len = r->headers_in.x_forwarded_for->value.len;<br>
ip = r->headers_in.x_forwarded_for->value.data;<br>
<br>
- for (p = ip + len - 1; p > ip; p--) {<br>
- if (*p == ' ' || *p == ',') {<br>
- p++;<br>
- len -= p - ip;<br>
- ip = p;<br>
- break;<br>
- }<br>
- }<br>
+ p = ip;<br>
<br>
- break;<br>
+ while(*p != ',' && *p != ' ' && p < p +
len){<br>
+ p++;<br>
+ }<br>
+ len = p - ip;<br>
+ break;<br>
<br>
default: /* NGX_HTTP_REALIP_HEADER */<br>
<br>
@@ -414,6 +411,7 @@<br>
<br>
On 08/16/2011 12:46 PM, Anatoli Marinov wrote:
<blockquote cite="mid:4E4A3C63.3070101@webforge.bg" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
Hello mates, <br>
I tried readip_module and I found it does not work as I expect. <br>
For example the header may looks like this:<br>
<span class="Apple-style-span" style="color: rgb(0, 0, 0);
font-family: monospace,'Courier New'; font-size: 13px;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: 19px; orphans: 2;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; background-color: rgb(255, 255,
255);">X-Forwarded-For: client1, proxy1, proxy2<br>
</span><br>
Where client1 should be the real ip address of the client, proxy1
should be the first proxy after the client and proxy2 should be
the last proxy after the client and the first before the nginx.
Nginx has the connection with proxy2.<br>
I think In this case readip_module should return <span
class="Apple-style-span" style="color: rgb(0, 0, 0);
font-family: monospace,'Courier New'; font-size: 13px;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: 19px; orphans: 2;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; background-color: rgb(255, 255,
255);">client1 </span>ip address. It returns the latest address
in the field - proxy2. <br>
What do you think? Is the behaviour wrong or I do not understand
the meaning of this header?<br>
<br>
p.s. <a moz-do-not-send="true"
href="http://en.wikipedia.org/wiki/X-Forwarded-For">http://en.wikipedia.org/wiki/X-Forwarded-For</a><br>
<br>
Thanks in advance.<br>
A. Marinov<br>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
nginx-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a>
<a class="moz-txt-link-freetext" href="http://mailman.nginx.org/mailman/listinfo/nginx-devel">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>