Opened 8 years ago

Last modified 3 years ago

#52 accepted enhancement

urlencode/urldecode needed in rewrite and other places

Reported by: joni-jones.ya.ru Owned by: somebody
Priority: minor Milestone:
Component: nginx-module Version: 1.0.x
Keywords: Cc:
uname -a: Linux mapika 2.6.18-128.2.1.el5.028stab064.7 #1 SMP Wed Aug 26 15:47:17 MSD 2009 i686 GNU/Linux
nginx -V: configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/usr/src/nginx/source/nginx-1.0.8/debian/modules/nginx-echo --add-module=/usr/src/nginx/source/nginx-1.0.8/debian/modules/nginx-upstream-fair --add-module=/usr/src/nginx/source/nginx-1.0.8/debian/modules/nginx-syslog

Description

Если в $http_accept есть пробелы, то они передаются без кодирования

rewrite /cgi-bin/index.pl?_requri=$uri&_accept=$http_accept break;
...
proxy_pass http://127.0.0.1:82; # mini-httpd listening

Change History (1)

comment:1 Changed 8 years ago by mdounin

  • Status changed from new to accepted
  • Summary changed from Некорректно кодирует url в rewrite to urlencode/urldecode needed in rewrite and other places
  • Type changed from defect to enhancement

This is expected behaviour. Variables (e.g. $request_uri, as commonly used in rewrites) may contain already urlencoded data, and urlencoding everything will just break things. Hence rewrite only urlencodes captures from rewrite's own regular expression, which aren't escaped for sure, nothing more.

Some easy way to urlencode/urldecode is needed though, and in other places as well.

Note: See TracTickets for help on using tickets.