Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3949610
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:30:50+00:00 2026-05-20T01:30:50+00:00

I’m trying to do a script in WWW::Mechanize that will build a job in

  • 0

I’m trying to do a script in WWW::Mechanize that will build a job in Hudson. The script is this:

$mech->post("$hudson_url/view/All/job/$job_name/build?delay=0sec", \%job_arguments);

The problem is that the Hudson log complains that it expected a form submission. The following was extracted from the Hudson logs:

Caused by: java.lang.Error: This page expects a form submission
    at org.kohsuke.stapler.RequestImpl.getSubmittedForm(RequestImpl.java:769)
    at hudson.model.ParametersDefinitionProperty._doBuild(ParametersDefinitionProperty.java:116)
    at hudson.model.AbstractProject.doBuild(AbstractProject.java:1531)
    ... 69 more

The problem is, the build in Hudson is parameterized, and so Hudson aparently generates the form using JavaScript. Eventually, Hudson will call this URL. How can I make this request so that Hudson thinks I’m posting a form?


UPDATE: I have request data as shown in Chrome. This is what works:

Request URL:<url>/hudson/view/All/job/ReleaseThis/build?delay=0sec
Request Method:POST
Status Code:302 Moved Temporarily
Request Headers
Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:935
Content-Type:application/x-www-form-urlencoded
Cookie:screenResolution=1920x1080; JSESSIONID=B3F99F6C376318AB6331AE6F27917D52; screenResolution=1920x1080; __utmz=250097027.1291302888.1.1.utmcsr=...|utmccn=(referral)|utmcmd=referral|utmcct=/sig/Home.action; __utma=250097027.1666115034.1291302888.1291302888.1291302888.1
Host:<hudson_url>
Origin:<huson_url>
Referer:https://<hudson_url>/hudson/view/All/job/ReleaseThis/build?delay=0sec
User-Agent:Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.84 Safari/534.13
Query String Parameters
delay:0sec
Form Data
name:URL
value:https://<url>
value:1.12-SNAPSHOT
name:RELEASE_VERSION
value:1.12-TEST16
name:UPDATE_MASTER_POM
name:PROPERTY_NAME
value:
name:DEV_VERSION
value:
name:STABLE_VERSION
value:
json:{"parameter": [{"name": "URL", "value": <url>}, {"name": "SNAPSHOT_VERSION", "value": "1.12-SNAPSHOT"}, {"name": "RELEASE_VERSION", "value": "1.12-TEST16"}, {"name": "UPDATE_MASTER_POM", "value": false}, {"name": "PROPERTY_NAME", "value": ""}, {"name": "DEV_VERSION", "value": ""}, {"name": "STABLE_VERSION", "value": ""}]}
Submit:Build
Response Headers
Connection:close
Content-Length:0
Content-Type:text/plain; charset=UTF-8
Date:Fri, 04 Feb 2011 13:33:27 GMT
Location:https://<hudson.url>/hudson/view/All/job/ReleaseThis/
Server:Apache-Coyote/1.1
Via:1.1 <hudson.url>:8890 (Apache/2.2.3)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T01:30:50+00:00Added an answer on May 20, 2026 at 1:30 am

    There are two possibilities, one is that there is a javascript generated random string as one of the fields, in order to protect from CSRF attacks, and bot autosubmission. In this case, you will need to reverse the javascript algo to parse and post the string, or use WWW::Scripter, which however I haven’t tested out.

    Second, and I belive more likely option is that the script checks fore referer, in this case, just set the referer via editing the header, and you might be good to go.

    One more thing to watch is that you have exactly the same headers and cookies in the browser and perl script requests; thus you might first get the page with the form, to get the cookies set, or set them yourself in the script.

    There is not a single measure that can’t be bypassed, for you to use script, you just have to find which one is employed by testing…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.