Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[httplib] httplib.BadStatusLine on any HTTPS connection in certain unknown cases. #59287

Closed
jtr51 mannequin opened this issue Jun 16, 2012 · 5 comments
Closed

[httplib] httplib.BadStatusLine on any HTTPS connection in certain unknown cases. #59287

jtr51 mannequin opened this issue Jun 16, 2012 · 5 comments
Labels
OS-windows type-bug An unexpected behavior, bug, or error

Comments

@jtr51
Copy link
Mannequin

jtr51 mannequin commented Jun 16, 2012

BPO 15082
Nosy @loewis, @jcea, @demianbrecht
Files
  • ssltest.py: Script + Traceback + Curl command
  • _ssl.zip
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-12-09.09:48:06.805>
    created_at = <Date 2012-06-16.01:52:08.138>
    labels = ['type-bug', 'OS-windows']
    title = '[httplib] httplib.BadStatusLine on any HTTPS connection in certain unknown cases.'
    updated_at = <Date 2021-12-09.09:48:06.804>
    user = 'https://bugs.python.org/jtr51'

    bugs.python.org fields:

    activity = <Date 2021-12-09.09:48:06.804>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-12-09.09:48:06.805>
    closer = 'iritkatriel'
    components = ['Windows']
    creation = <Date 2012-06-16.01:52:08.138>
    creator = 'jtr51'
    dependencies = []
    files = ['26024', '26029']
    hgrepos = []
    issue_num = 15082
    keywords = []
    message_count = 5.0
    messages = ['162947', '162955', '162978', '165785', '224262']
    nosy_count = 6.0
    nosy_names = ['loewis', 'jcea', 'BreamoreBoy', 'jtr51', 'Michal.Zimen', 'demian.brecht']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue15082'
    versions = ['Python 2.7']

    @jtr51
    Copy link
    Mannequin Author

    jtr51 mannequin commented Jun 16, 2012

    When trying to POST /anything/ @ https://grooveshark.com/, I get an httplib.BadStatusLine exception (server returns nothing at all. It's a timeout since it waits a while).

    The many Grooveshark webclients however works perfectly, along with a curl command (run through cygwin, commented out in the script) that does the exact same. Meaning this weird behavior is exclusive to Python.

    This issue was found to be present on many Windows systems. However, not all (all the systems have Python 2.7.2). I'm not sure what the difference is, and I'm not sure if this is a Python bug, but this is the only place I could think of to discuss the behavior. The only Linux system I've tested this on worked (again, Python 2.7.2).
    Note: If it fails on one system, it never succeeds no matter how much you try.

    The code *used* to work yesterday and it's been working for many months. Grooveshark might have changed something but this doesn't make any sense since curl works.

    Please try to reproduce this. I can provide any testing details needed.
    A script containing the code to test with is attached, along with the curl line and a BadStatusLine traceback.

    Excuse my complete ignorance on the inner workings of SSL and my weak English skills (second language).

    @jtr51 jtr51 mannequin added OS-windows type-bug An unexpected behavior, bug, or error labels Jun 16, 2012
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Jun 16, 2012

    I can reproduce this, and it seems to stem from the openssl version used (0.9.8l). Running openssl s_client -connect grooveshark.com:443 with 0.9.8l gives

    CONNECTED(00000003)
    depth=3 /L=ValiCert Validation Network/O=ValiCert, Inc./OU=ValiCert Class 2 Policy Validation Authority/CN=http://www.valicert.com//emailAddress=info@valicert.com
    verify error:num=19:self signed certificate in certificate chain
    verify return:0
    22456:error:0407006A:rsa routines:RSA_padding_check_PKCS1_type_1:block type is not 01:rsa_pk1.c:100:
    22456:error:04067072:rsa routines:RSA_EAY_PUBLIC_DECRYPT:padding check failed:rsa_eay.c:697:
    22456:error:1408D07B:SSL routines:SSL3_GET_KEY_EXCHANGE:bad signature:s3_clnt.c:1448:

    With 1.0.1c, it gives

    CONNECTED(00000003)
    depth=3 L = ValiCert Validation Network, O = "ValiCert, Inc.", OU = ValiCert Class 2 Policy Validation Authority, CN = http://www.valicert.com/, emailAddress = info@valicert.com
    verify error:num=19:self signed certificate in certificate chain
    verify return:0

    Certificate chain
    0 s:/C=US/ST=FL/L=Gainesville/O=Grooveshark/CN=*.grooveshark.com
    i:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certificates.godaddy.com/repository/CN=Go Daddy Secure Certification Authority/serialNumber=07969287
    1 s:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certificates.godaddy.com/repository/CN=Go Daddy Secure Certification Authority/serialNumber=07969287
    i:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
    2 s:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
    i:/L=ValiCert Validation Network/O=ValiCert, Inc./OU=ValiCert Class 2 Policy Validation Authority/CN=http://www.valicert.com//emailAddress=info@valicert.com
    3 s:/L=ValiCert Validation Network/O=ValiCert, Inc./OU=ValiCert Class 2 Policy Validation Authority/CN=http://www.valicert.com//emailAddress=info@valicert.com
    i:/L=ValiCert Validation Network/O=ValiCert, Inc./OU=ValiCert Class 2 Policy Validation Authority/CN=http://www.valicert.com//emailAddress=info@valicert.com
    ---
    Server certificate
    ...

    i.e. the connection gets established.

    The next bug fix release of Python 2.7 will include OpenSSL 0.9.8x, which is the latest OpenSSL 0.9.8 bug fix. It still shows the error in connecting, so I wonder whether this is a bug that just doesn't get fixed for 0.9.8, or whether it's a bug in the server (that 1.0.1 somehow avoids).

    @jtr51
    Copy link
    Mannequin Author

    jtr51 mannequin commented Jun 16, 2012

    I can confirm that. I built a 1.0.1c version of both _ssl.pyd and _ssl.lib and now the problem's solved (they're attached if ever needed). Thanks!
    Can't the next Python 2.7 release include 1.0.1c instead ?

    @MichalZimen
    Copy link
    Mannequin

    MichalZimen mannequin commented Jul 18, 2012

    I can confirm similar behaviour in RHEL 6.3 with python 2.6.6.
    This exception with the same https request has random behaviour.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jul 29, 2014

    Can you please retest with Python 2.7.8 as this has an updated version of openssl.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    OS-windows type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants