LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-29-2011, 02:23 PM   #1
fyndr
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Rep: Reputation: 0
cURL POST data command from shell returns HTTP Error Code 408


Hey all,

I am trying to connect to the web interface found at http://lcl.uniroma1.it/sso/jsp/welcome.faces using curl. This first requires login information to be entered at http://lcl.uniroma1.it/sso/index.jsp, but I am having an issue with the login process. I am trying to submit the following form via POST:

Code:
<form action="j_security_check" method="post" id="login_form" name="login_form">
<center>
<table style="background: #cac1cf;FONT-SIZE: 12px;">
<tr>
<td align="center" colspan="2">Please enter your username and password:</td>
</tr>
<tr>
<td align="right">Username</td>
<td><input name="j_username" style="width: 250px" id="j_username" type="text"/></td>
</tr>
<tr>
<td align="right">Password</td>
<td><input style="width: 250px" name="j_password" id="j_password" type="password"/></td>
</tr>
<tr>
<td colspan="2" align="center">
<input value="Enter" name="enter" type="submit"/>
<input value="Clear" name="Clear" type="reset"/>
</td>
</tr>
</table>
</center>
</form>
The command that I am using for this is the following:

Code:
curl -c cookies -b cookies -L -d "j_username=user%40domain.com&j_password=pass" http://lcl.uniroma1.it/sso/j_security_check
The command is properly formatted as far as I can tell. I tested it with another website using a similar authentication scheme using different POST variables specific to the form and it worked fine.

When I run the above command with the -v tag, it reveals this:

Code:
* Connected to lcl.uniroma1.it (151.100.4.74) port 80 (#0)
> POST /sso/j_security_check HTTP/1.1
> User-Agent: curl/7.21.0 (i686-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
> Host: lcl.uniroma1.it
> Accept: */*
> Content-Length: 44
> Content-Type: application/x-www-form-urlencoded
>
} [data not shown]
< HTTP/1.1 408 The time allowed for the login process has been exceeded. If you wish to continue you must either click back twice and re-click the link you requested or close and re-open your browser
< Date: Sat, 29 Jan 2011 15:26:41 GMT
< Server: Apache-Coyote/1.1
< Content-Type: text/html;charset=utf-8
< Content-Length: 1554
< Connection: close
<
{ [data not shown]
103  1554  100  1554    0    52   5081    170 --:--:-- --:--:-- --:--:-- 10223*
Closing connection #0
I cannot tell why the login timeout is expired when I try to do this, and my investigation toward this end has been fruitless. I saw a brief snippet on Google that vaguely suggested that the underscores in the domain name were at fault, but replacing these with their encoded counterparts did nothing to resolve the issue (that, and underscores should be fine when sent unencoded according to the standards).

I have extensively perused the man pages and have come up with nothing to adequately explain this behavior. I also talked to a friend who has worked with curl in his line of work, but he mostly has experience in the context of PHP and has not dealt with this issue before.

I am running GNU/Linux 2.6.35-22-generic-pae. If additional system details are required, please let me know. Help is very much appreciated.

Thanks,

fyndr
 
Old 01-30-2011, 04:14 PM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Quote:
< HTTP/1.1 408 The time allowed for the login process has been exceeded. If you wish to continue you must either click back twice and re-click the link you requested or close and re-open your browser
This is not a standard message. I think that webmaster of this login page applied some additional security check. Are you send "real" cookies, from just downloaded page or some stored ealier? Try also sending "enter=Enter" in POST data, some webmasters check this. And a "Referer" header.
 
Old 01-31-2011, 09:16 PM   #3
fyndr
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for the help eSelix! I was able to snag some cookies from the login page and added a referer header to the curl command to get everything working properly.
 
Old 03-04-2011, 09:17 AM   #4
bigwisu
LQ Newbie
 
Registered: Mar 2011
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by fyndr View Post
I was able to snag some cookies from the login page and added a referer header to the curl command to get everything working properly.
Hi fyndr, could you share details on how you did that? I'm having problems trying to post login details via curl to j_security_check, which like your original post returns 400 Bad Request

TIA
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
curl and wget http post williebens Linux - Newbie 4 10-11-2010 11:03 PM
FreeSWITCH Not Responding to Registration Request; SFLphone Returns a 408. GraysonPeddie Linux - Server 2 07-09-2010 06:45 PM
Curl command with POST method and Authentication pedropolian Linux - Networking 0 03-16-2009 10:44 AM
PHP: cUrl - post data doesn't go through proxy elvijs Programming 0 12-17-2007 08:26 AM
Yast and Curl error - HTTP 407 ? beta-tester SUSE / openSUSE 1 10-08-2007 05:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration