Hi.
Am 08-12-2015 11:23, schrieb Thierry FOURNIER:
Hi,
I agree with you, but in HAProxy, the ';' is considered as parameter
delimiter. Its hardcoded, and I don't known the reason.
There are several reasons for the ';' to be a separator similar like
'&'.
http://www.skorks.com/2010/05/what-every-developer-should-know-about-urls/
http://www.w3.org/TR/html401/appendix/notes.html#h-B.2.2
As far as I remember almost every Appserver add a ';....session=....' to
the URL when the server detects that the client does not accept cookies.
http://javarevisited.blogspot.co.at/2012/08/what-is-jsessionid-in-j2ee-web.html
http://www.php.net/manual/en/session.configuration.php#ini.session.use-trans-sid
http://www.programmerinterview.com/index.php/php-questions/can-sessions-work-without-cookies/
BR
Aleks
So the behaviour that you observe is the normal HAProxy behaviour.
Thierry
On Tue, 8 Dec 2015 09:17:38 +0000
Laurent Penot <[email protected]> wrote:
HI,
I received URL from which i need to extract several parameters, I do
that using urlp in lua. Values of parameters are urlencoded.
And I notice something strange : urlp seems to get only the first part
of the value when the 2 char “;+” or “+;” are in the value of the
parameter.
From the php point of view, using
http://php.net/manual/en/function.urlencode.php , the 2 char “;+” or
“+;” is valid in an urlencoded string.
Here are 2 tests URL and the dumped value from lua:
/dump_headers.php?p1=value1&ua=word1+;word2&otherparam=test
[info] 341/090330 (130491) : ua=word1+
The dumped value should be : word1+;word2
/dump_headers.php?p1=value1&ua=word1;+word2&otherparam=test
[info] 341/090951 (130491) : ua=word1
The dumped value should be : word1;+word2
Here is the haproxy config file (I removed everything not related to
my question) :
global
debug
# lua file
lua-load url.lua
defaults
mode http
frontend fe
bind :80
acl testurl url_beg /dump_headers.php
http-request lua.logValue if testurl
use_backend beok
backend beok
server mysrv 127.0.0.1:8080 check inter 1000ms fall 3 rise 1
weight 100
Here is the lua file :
core.register_action("logValue", {"http-req"}, function(txn)
local var = txn.f:urlp("ua");
core.Info("ua=" .. var);
end)
haproxy -vv
HA-Proxy version 1.6.2 2015/11/03
Copyright 2000-2015 Willy Tarreau <[email protected]>
Build options :
TARGET = linux2628
CPU = generic
CC = gcc
CFLAGS = -O2 -g -fno-strict-aliasing -Wdeclaration-after-statement
OPTIONS = USE_ZLIB=1 USE_OPENSSL=1 USE_LUA=yes USE_DEVICEATLAS=1
USE_PCRE=1
Default settings :
maxconn = 2000, bufsize = 16384, maxrewrite = 1024, maxpollevents =
200
Encrypted password support via crypt(3): yes
Built with zlib version : 1.2.3
Compression algorithms supported : identity("identity"),
deflate("deflate"), raw-deflate("deflate"), gzip("gzip")
Built with OpenSSL version : OpenSSL 1.0.2d 9 Jul 2015
Running on OpenSSL version : OpenSSL 1.0.2d 9 Jul 2015
OpenSSL library supports TLS extensions : yes
OpenSSL library supports SNI : yes
OpenSSL library supports prefer-server-ciphers : yes
Built with PCRE version : 7.8 2008-09-05
PCRE library supports JIT : no (USE_PCRE_JIT not set)
Built with Lua version : Lua 5.3.1
Built with transparent proxy support using: IP_TRANSPARENT
IPV6_TRANSPARENT IP_FREEBIND
Available polling systems :
epoll : pref=300, test result OK
poll : pref=200, test result OK
select : pref=150, test result OK
Total: 3 (3 usable), will use epoll.
Running on centos 6.
I notice the same thing with haproxy 1.6.1 and lua 5.3.1 or 5.3.0
Note : in the frontend, if I use : http-request set-header
X-debugua %[urlp(ua)]
I get the same value as I get from Lua.
Can you tell me if I do something the wrong way or if it is a bug or
if it is intended ?
Best regards
Laurent