Welcome! Log In Create A New Profile

Advanced

Re: Split words into caracters

Reinis Rozitis
April 02, 2013 11:40AM
> yeah but it works when you have multiple words.

What do you mean by multiple words?


> In my case, there is only one which is 1234567890...DEF (md5 -> 32 chars)
> m=1234567890...DEF
> m[1] = 1
> m[2] = 2
> ..
> m[32] = F

> A mere rewrite is impossible here..
> It seems indeed,

Why not?


rewrite
"/path/(?<r1>[\w]{1})(?<r2>[\w]{1})(?<r3>[\w]{1})(?<r4>[\w]{1})(?<r5>[\w]{1})(?<r6>[\w]{1})(?<r7>[\w]{1})(?<r8>[\w]{1})(?<r9>[\w]{1})(?<r10>[\w]{1})(?<r11>[\w]{1})(?<r12>[\w]{1})(?<r13>[\w]{1})(?<r14>[\w]{1})(?<r15>[\w]{1})(?<r16>[\w]{1})(?<r17>[\w]{1})(?<r18>[\w]{1})(?<r19>[\w]{1})(?<r20>[\w]{1})(?<r21>[\w]{1})(?<r22>[\w]{1})(?<r23>[\w]{1})(?<r24>[\w]{1})(?<r25>[\w]{1})(?<r26>[\w]{1})(?<r27>[\w]{1})(?<r28>[\w]{1})(?<r29>[\w]{1})(?<r30>[\w]{1})(?<r31>[\w]{1})(?<r32>[\w]{1})"
/realpath/$r1/$r2/$r3/$r4/$r5/$r6/$r7/$r8/$r9/$r10/$r11/$r12/$r13/$r14/$r15/$r16/$r17/$r18/$r19/$r20/$r21/$r22/$r23/$r24/$r25/$r26/$r27/$r28/$r29/$r30/$r31/$r32;

It looks somewhat ugly because of 32 variables (aso because you need to use
named ones (since $10/$11 ... wouldnt work)).
There are probably much better ways to do this, but as a proof of concept it
works:



Request to http://someserver/path/aBcdfghjklqwertyuiopas1234567890 gets
rewritten/translated to:

2013/04/02 18:25:37 [error] 2032#0: *60 open()
"/www/realpath/a/B/c/d/f/g/h/j/k/l/q/w/e/r/t/y/u/i/o/p/a/s/1/2/3/4/5/6/7/8/9/0"
failed (2: No such file or directory), request: "GET
/path/aBcdfghjklqwertyuiopas1234567890

(obviously error since such file doesnt exist for me)

:)


rr

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Split words into caracters

Larry April 02, 2013 05:41AM

Re: Split words into caracters

Reinis Rozitis April 02, 2013 05:48AM

Re: Split words into caracters

Larry April 02, 2013 10:47AM

Re: Split words into caracters

Reinis Rozitis April 02, 2013 11:40AM

Re: Split words into caracters

Larry April 02, 2013 01:11PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 95
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready