I tried doing it (in Trac 0.11) like this:

wget --save-cookies cookies.txt --keep-session-cookies -O /dev/null
http://.../newticket
wget --load-cookies cookies.txt --postdata
'field_summary=Test&field_description=Test&field_type=defect&__FORM_TOKEN='`awk
'$6 ~ /trac_form_token/ { print $7 }' cookies.txt` -O /dev/null
http://.../newticket

Now, I get an error 500 when I try that.  But then again, I also have
some custom extensions installed that might be screwing things up.
But I think that should work on most installations.

On 8/31/07, Matthew Gillen <[EMAIL PROTECTED]> wrote:
>
> Matthew Gillen wrote:
> > Alec Thomas wrote:
> >> I think you'll find this is due to the CSRF token included in Trac
> >> forms. I'm not sure there's a way around it.
> >>
> >> On 9/1/07, �kos Mar�y <[EMAIL PROTECTED]> wrote:
> >>> Matthew Gillen wrote:
> >>>> Try removing the "#preview" part from the URL.  The url should end with
> >>>> "newticket".
> >>> same result :(
> >
> > Ok, I tested it, and it's doable, but to automate it there's an exercise for
> > the reader involved:
> >  $ wget --save-cookies cookies.txt --keep-session-cookies 
> > http://.../newticket
> >
> > ( exercise for the reader: extract the __FORM_TOKEN value from the resulting
> > saved page )
>
> Alternatively, you could grab that token value from the cookies.txt file,
> since it's the same value used for the trac_form_token cookie.
>
> >  $ wget --load-cookies cookies.txt --post-data \
> > "summary=Test2&type=defect&__FORM_TOKEN=29204edf325eca3781f6482f" \
> > http://../newticket
> >
> > where you replace the 29204ed... with what you extract from the downloaded 
> > page.
> >
> > You'll then want to remove the locally-saved 'newticket' file for the next
> > iteration.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to