So nc -l localhost 8080 in one terminal tab and running my client in another tab. My client does several POST, PUT and some GETs. I did a Ctrl-C but didnot hit the Bad StatusLine on my OSX10.7.x. I never hit the Bad StatusLine on my OSX10.7.x. It occurs only on CentOS. Maybe I am missing something?<br>
<br>Thanks for your help,<br>Shubhra<br><br><div class="gmail_quote">On Sun, Oct 28, 2012 at 7:09 PM, AM <span dir="ltr"><<a href="mailto:ams.fwd@gmail.com" target="_blank">ams.fwd@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I think what Guido meant was that the server was alive but did not respond with anything, instead closing the connection.<br>
<br>
Assuming you are running on linux or OSX a quick way to check it is to use the netcat tool in a terminal:<br>
<br>
nc -l -p 8080<br>
<br>
Then have your client connect to localhost:8080/...<br>
<br>
In the terminal you should see the request. Ctrl-C netcat and you should (afaik) see the BadStatusLine error.<br>
<br>
What that would mean is that somewhere tomcat decided to simply close the connection before any response was sent out.<br>
<br>
HTH<br>
AM<div class="im"><br>
<br>
On 10/28/2012 06:37 PM, Shubhra Sharma wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Hi Guido,<br>
<br>
Thanks for responding.I will check the catalina logs to see what happened.<br>
<br>
When tomcat is not running on my setup I see the following error:<br>
<br>
File "/opt/local/Library/<u></u>Frameworks/Python.framework/<u></u>Versions/3.2/lib/python3.2/<u></u>site-packages/httplib2/__init_<u></u>_.py", line 1207, in request<br>
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)<br>
File "/opt/local/Library/<u></u>Frameworks/Python.framework/<u></u>Versions/3.2/lib/python3.2/<u></u>site-packages/httplib2/__init_<u></u>_.py", line 961, in _request<br>
(response, content) = self._conn_request(conn, request_uri, method, body, headers)<br>
File "/opt/local/Library/<u></u>Frameworks/Python.framework/<u></u>Versions/3.2/lib/python3.2/<u></u>site-packages/httplib2/__init_<u></u>_.py", line 898, in _conn_request<br>
conn.connect()<br>
File "/opt/local/Library/<u></u>Frameworks/Python.framework/<u></u>Versions/3.2/lib/python3.2/<u></u>http/client.py", line 724, in connect<br>
self.timeout, self.source_address)<br>
File "/opt/local/Library/<u></u>Frameworks/Python.framework/<u></u>Versions/3.2/lib/python3.2/<u></u>socket.py", line 404, in create_connection<br>
raise err<br>
File "/opt/local/Library/<u></u>Frameworks/Python.framework/<u></u>Versions/3.2/lib/python3.2/<u></u>socket.py", line 395, in create_connection<br>
sock.connect(sa)<br>
socket.error: [Errno 61] Connection refused<br>
<br>
I did not see the BadStatusLine exception in my unittesting. Is there anything I can do to catch this exception, the try catch around the http request did not catch it? I am using httplib2 if that helps<br>
Thanks,<br>
Shubhra<br>
<br></div><div class="im">
On Sun, Oct 28, 2012 at 5:28 PM, Guido van Rossum <<a href="mailto:guido@python.org" target="_blank">guido@python.org</a> <mailto:<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>>> wrote:<br>
<br>
That particular line where this is raised means the server closed the<br>
connection without sending any response at all. Check your server<br>
logs?<br>
<br>
On Sun, Oct 28, 2012 at 4:00 PM, Shubhra Sharma<br></div>
<<a href="mailto:sharma.shubhra07@gmail.com" target="_blank">sharma.shubhra07@gmail.com</a> <mailto:<a href="mailto:sharma.shubhra07@gmail.com" target="_blank">sharma.shubhra07@<u></u>gmail.com</a>>><div class="im">
<br>
wrote:<br>
> Hi Aahz,<br>
><br>
> Thanks for responding. I'm not sending an Expect Header and I'm<br>
using<br>
> Apache-Coyote/1.1<br>
><br>
> Thanks,<br>
> Shubhra<br>
><br>
><br>
> On Sun, Oct 28, 2012 at 2:06 PM, Aahz <<a href="mailto:aahz@pythoncraft.com" target="_blank">aahz@pythoncraft.com</a><br></div><div><div class="h5">
<mailto:<a href="mailto:aahz@pythoncraft.com" target="_blank">aahz@pythoncraft.com</a>>> wrote:<br>
>><br>
>> On Sun, Oct 28, 2012, Shubhra Sharma wrote:<br>
>> ><br>
>> > I am encountering http.client.BadStatusLine exception when I<br>
run my<br>
>> > python<br>
>> > scripts on CentOS6.32 but things seem to work fine on MAC<br>
OSX10.7.5 and<br>
>> > 10.8. I'm on Python3.2.3.<br>
>> ><br>
>> > I searched for answers on the internet and looked at the python<br>
>> > documentation as well without much luck. As per the<br>
documentation if a<br>
>> > server responds with a HTTP status code that we don?t<br>
understand this<br>
>> > error<br>
>> > is raised. The server is a Tomcat server. Any ideas on how to<br>
debug this<br>
>> > will be greatly appreciated.<br>
>> ><br>
>> > Here's a snippet of the error:<br>
>> > response = conn.getresponse()<br>
>> > python3.2/http/client.py", line 1049, in getresponse<br>
>> > response.begin()<br>
>> > python3.2/http/client.py", line 346, in begin<br>
>> > version, status, reason = self._read_status()<br>
>> > python3.2/http/client.py", line 328, in _read_status<br>
>> > raise BadStatusLine(line)<br>
>> > http.client.BadStatusLine:<br>
>><br>
>> I've seen various causes for this, but I'd start by making sure<br>
that<br>
>> you're not sending an Expect: header and doing HTTP/1.0 connection.<br>
>> --<br></div></div>
>> Aahz (<a href="mailto:aahz@pythoncraft.com" target="_blank">aahz@pythoncraft.com</a> <mailto:<a href="mailto:aahz@pythoncraft.com" target="_blank">aahz@pythoncraft.com</a>>) <*><div class="im">
<br>
>> <a href="http://www.pythoncraft.com/" target="_blank">http://www.pythoncraft.com/</a><br>
>><br>
>> "We've just found a line in a perl script that invokes a shell<br>
script to<br>
>> call<br>
>> a lisp program which invokes the very-same perl script."<br>
--anonymous<br>
>> ______________________________<u></u>_________________<br>
>> Baypiggies mailing list<br></div>
>> <a href="mailto:Baypiggies@python.org" target="_blank">Baypiggies@python.org</a> <mailto:<a href="mailto:Baypiggies@python.org" target="_blank">Baypiggies@python.org</a>><div class="im"><br>
>> To change your subscription options or unsubscribe:<br>
>> <a href="http://mail.python.org/mailman/listinfo/baypiggies" target="_blank">http://mail.python.org/<u></u>mailman/listinfo/baypiggies</a><br>
><br>
><br>
><br>
> ______________________________<u></u>_________________<br>
> Baypiggies mailing list<br></div>
> <a href="mailto:Baypiggies@python.org" target="_blank">Baypiggies@python.org</a> <mailto:<a href="mailto:Baypiggies@python.org" target="_blank">Baypiggies@python.org</a>><div class="im"><br>
> To change your subscription options or unsubscribe:<br>
> <a href="http://mail.python.org/mailman/listinfo/baypiggies" target="_blank">http://mail.python.org/<u></u>mailman/listinfo/baypiggies</a><br>
<br>
<br>
<br>
--<br></div>
--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a> <<a href="http://python.org/%7Eguido" target="_blank">http://python.org/%7Eguido</a>>)<div class="im"><br>
<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
Baypiggies mailing list<br>
<a href="mailto:Baypiggies@python.org" target="_blank">Baypiggies@python.org</a><br>
To change your subscription options or unsubscribe:<br>
<a href="http://mail.python.org/mailman/listinfo/baypiggies" target="_blank">http://mail.python.org/<u></u>mailman/listinfo/baypiggies</a><br>
</div></blockquote>
<br>
</blockquote></div><br>