Skip to content

urllib2 always sends header connection: close #60147

Closed

Description

@sanxiago
mannequin
BPO 15943
Nosy @bitdancer
Superseder
  • bpo-12849: Cannot override 'connection: close' in urllib2 headers
  • 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 2012-09-14.13:26:21.069>
    created_at = <Date 2012-09-14.10:47:08.376>
    labels = ['type-bug', 'library']
    title = 'urllib2 always sends header connection: close'
    updated_at = <Date 2012-09-14.13:26:21.049>
    user = 'https://bugs.python.org/sanxiago'

    bugs.python.org fields:

    activity = <Date 2012-09-14.13:26:21.049>
    actor = 'r.david.murray'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-09-14.13:26:21.069>
    closer = 'r.david.murray'
    components = ['Library (Lib)']
    creation = <Date 2012-09-14.10:47:08.376>
    creator = 'sanxiago'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 15943
    keywords = []
    message_count = 2.0
    messages = ['170473', '170475']
    nosy_count = 2.0
    nosy_names = ['r.david.murray', 'sanxiago']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '12849'
    type = 'behavior'
    url = 'https://bugs.python.org/issue15943'
    versions = ['Python 2.6', 'Python 2.7']

    Activity

    1. sanxiago commented on Sep 14, 2012

      sanxiagomannequin
      MannequinAuthor

      I have noticed that urllib2 will always send the 'connection: close' in the headers, looking at the code there is no way to override this from outside of the open method.

      I am currently working with a server that kills connection upon reading the header, and content will not get served, or only a partial bit of the content gets served, I have tried with several other agents, all are able to download the full content served by the server.

      I created a modified version without the 'connection: close' header and that solved the problem for me. I do not always have problems with that header, but I would like the ability to define my own headers, and since the connection: close header gets slapped inside an objects internal method, there is currently no other way I can bypass it.

    2. added
      stdlib
      type-bug
      on Sep 14, 2012
    3. bitdancer commented on Sep 14, 2012

      @bitdancer
      Member

      This is a duplicate of bpo-12849. I'm not sure that we support keep-alive using urllib. We do using httplib, if I understand correctly.

    4. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      stdlibtype-bug

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions