"Les Mikesell" <[EMAIL PROTECTED]> wrote:
>
> I have a feeling it is going to end up being possible only
> with LWP...
>
> > I don't exactly understand your problem, but from what I can see you
> > should be able to do what you want with mod_rewrite if you just use a
> > regexp which contains a question mark. Have I missed something?
>
> One of us is missing something. I hope it is me, but when I turn on
> rewrite logging, the input side contains only the location portion. The
> argument string has already been stripped.
the query string is stripped from what the rewrite rule is matching, yes. but
you can use a RewriteCond above the rule to test %{QUERY_STRING} against a
regexp pattern, and store backreferences from it as %1, %2...etc.
> > Does this extract from the docs help?
> > ----------------------------------------------------------------------
> > One more note: You can even create URLs in the substitution string
containing
> > a query string part. Just use a question mark inside the substitution
string
> > to indicate that the following stuff should be re-injected into the
> > QUERY_STRING. When you want to erase an existing query string, end the
> > substitution string with just the question mark.
> This allows adding additional arguments, or deleting them all. I want to
> change an existing one and add some more. Something like:
> /cgi-bin/prog?arg1=22&arg2=24 should become:
> http://otherhost.domain/prog?newarg1=22&arg2=24&uname=me&pwd=password
Also from the RTFM dept:
'qsappend|QSA' (query string append)
This flag forces the rewriting engine to append a query string part in the
substitution string to the existing one instead of replacing it. Use this when
you want to add more data to the query string via a rewrite rule.
a possibly relevant example would be:
# match and store the interesting arg values as backrefs
RewriteCond %{QUERY_STRING} arg1=([0-9]+)&arg2=([0-9]+)
# build a new QS for the proxy url
RewriteRule ^/cgi-bin/prog
http://otherhost/prog?newarg1=%1&arg2=%2&uname=me&pwd=password [R,L]
(but without the linewrap, of course)
in this example you dont need the qsappend flag because we reconstructed the
entire query string. if you werent renaming agr1 to newarg1 (or if ther may
have been other args you want to pass on) you could have just done:
# just test for the presence of our args in the QS
# and make the whole thing conditional on that
RewriteCond %{QUERY_STRING} arg1=[0-9]+&arg2=[0-9]+
#and rewite, injecting just the new args
RewriteRule ^/cgi-bin/prog
http://otherhost/prog?uname=me&pwd=password [QSA,R,L]
and the rw engine will add uname & pwd to any existing querystring that was
present
hope this helps,
-dave