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

Two Host header are being sent when doing chunk transfer with Session #5274

Closed
contactparthshah opened this issue Nov 26, 2019 · 2 comments · Fixed by #5391
Closed

Two Host header are being sent when doing chunk transfer with Session #5274

contactparthshah opened this issue Nov 26, 2019 · 2 comments · Fixed by #5391

Comments

@contactparthshah
Copy link

contactparthshah commented Nov 26, 2019

Two Host header are being sent when doing chunk transfer with Session

import requests
requests.version
'2.22.0'

import requests
import time
from requests.packages import urllib3

#Disable https insecure warnings for verify=False
urllib3.disable_warnings()

with open('1.ts','rb') as fh:
    file_data = fh.read()

def chunk_trans():
    for i in range(0, 3):
        time.sleep(0.1)
        yield file_data

req = requests.Request('POST', 'http://192.168.123.151/1.ts', data=chunk_trans(), headers={'Host':'a.b.c.d'})
prep = req.prepare()
s = requests.Session()
s.send(prep, timeout=2, verify=False, allow_redirects=False)

Actual Output: Two host headers are seen on server side.

Host: 192.168.123.151
Host: a.b.c.d
Transfer-Encoding: chunked

only "a.b.c.d" host header should come.

@contactparthshah
Copy link
Author

can anyone look into this and help?

hodbn added a commit to hodbn/requests that referenced this issue Mar 17, 2020
hodbn added a commit to hodbn/requests that referenced this issue Aug 14, 2020
hodbn added a commit to hodbn/requests that referenced this issue Aug 14, 2020
hodbn added a commit to hodbn/requests that referenced this issue Aug 14, 2020
@mzpqnxow
Copy link

I see that there is a PR for this (and has been for a while) but it is not yet merged.

I am also having this issue. I can apply the patch on my own fork, but is there any reason this hasn't been merged? Just forgotten about maybe?

I guess it is kind of an edge-case..

hodbn added a commit to hodbn/requests that referenced this issue Nov 14, 2020
hodbn added a commit to hodbn/requests that referenced this issue Nov 14, 2020
nateprewitt pushed a commit to hodbn/requests that referenced this issue Sep 2, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants