Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
af7dc8d8
Commit
af7dc8d8
authored
Nov 19, 2003
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #831747: Add skip_accept_encoding parameter to putrequest.
parent
a53f4eba
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
5 deletions
+16
-5
Doc/lib/libhttplib.tex
Doc/lib/libhttplib.tex
+7
-2
Lib/httplib.py
Lib/httplib.py
+7
-3
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Doc/lib/libhttplib.tex
View file @
af7dc8d8
...
@@ -174,11 +174,16 @@ Send data to the server. This should be used directly only after the
...
@@ -174,11 +174,16 @@ Send data to the server. This should be used directly only after the
\method
{
getreply()
}
has been called.
\method
{
getreply()
}
has been called.
\end{methoddesc}
\end{methoddesc}
\begin{methoddesc}
{
putrequest
}{
request, selector
}
\begin{methoddesc}
{
putrequest
}{
request, selector
\optional
{
,
skip
\_
host
\optional
{
, skip
_
accept
_
encoding
}}}
This should be the first call after the connection to the server has
This should be the first call after the connection to the server has
been made. It sends a line to the server consisting of the
been made. It sends a line to the server consisting of the
\var
{
request
}
string, the
\var
{
selector
}
string, and the HTTP version
\var
{
request
}
string, the
\var
{
selector
}
string, and the HTTP version
(
\code
{
HTTP/1.1
}
).
(
\code
{
HTTP/1.1
}
). To disable automatic sending of
\code
{
Host:
}
or
\code
{
Accept-Encoding:
}
headers (for example to accept additional
content encodings), specify
\var
{
skip
_
host
}
or
\var
{
skip
_
accept
_
encoding
}
with non-False values.
\versionchanged
[\var{skip_accept_encoding} argument added]
{
2.4
}
\end{methoddesc}
\end{methoddesc}
\begin{methoddesc}
{
putheader
}{
header, argument
\optional
{
, ...
}}
\begin{methoddesc}
{
putheader
}{
header, argument
\optional
{
, ...
}}
...
...
Lib/httplib.py
View file @
af7dc8d8
...
@@ -596,18 +596,21 @@ class HTTPConnection:
...
@@ -596,18 +596,21 @@ class HTTPConnection:
del
self
.
_buffer
[:]
del
self
.
_buffer
[:]
self
.
send
(
msg
)
self
.
send
(
msg
)
def
putrequest
(
self
,
method
,
url
,
skip_host
=
0
):
def
putrequest
(
self
,
method
,
url
,
skip_host
=
0
,
skip_accept_encoding
=
0
):
"""Send a request to the server.
"""Send a request to the server.
`method' specifies an HTTP request method, e.g. 'GET'.
`method' specifies an HTTP request method, e.g. 'GET'.
`url' specifies the object being requested, e.g. '/index.html'.
`url' specifies the object being requested, e.g. '/index.html'.
`skip_host' if True does not add automatically a 'Host:' header
`skip_accept_encoding' if True does not add automatically an
'Accept-Encoding:' header
"""
"""
# if a prior response has been completed, then forget about it.
# if a prior response has been completed, then forget about it.
if
self
.
__response
and
self
.
__response
.
isclosed
():
if
self
.
__response
and
self
.
__response
.
isclosed
():
self
.
__response
=
None
self
.
__response
=
None
#
# in certain cases, we cannot issue another request on this connection.
# in certain cases, we cannot issue another request on this connection.
# this occurs when:
# this occurs when:
# 1) we are in the process of sending a request. (_CS_REQ_STARTED)
# 1) we are in the process of sending a request. (_CS_REQ_STARTED)
...
@@ -676,6 +679,7 @@ class HTTPConnection:
...
@@ -676,6 +679,7 @@ class HTTPConnection:
# we only want a Content-Encoding of "identity" since we don't
# we only want a Content-Encoding of "identity" since we don't
# support encodings such as x-gzip or x-deflate.
# support encodings such as x-gzip or x-deflate.
if
not
skip_accept_encoding
:
self
.
putheader
(
'Accept-Encoding'
,
'identity'
)
self
.
putheader
(
'Accept-Encoding'
,
'identity'
)
# we can accept "chunked" Transfer-Encodings, but no others
# we can accept "chunked" Transfer-Encodings, but no others
...
...
Misc/NEWS
View file @
af7dc8d8
...
@@ -116,6 +116,8 @@ Extension modules
...
@@ -116,6 +116,8 @@ Extension modules
Library
Library
-------
-------
-
httplib
.
HTTP
.
putrequest
now
offers
to
omit
the
implicit
Accept
-
Encoding
.
-
Patch
#
841977
:
modulefinder
didn
't find extension modules in packages
-
Patch
#
841977
:
modulefinder
didn
't find extension modules in packages
- imaplib.IMAP4.thread was added.
- imaplib.IMAP4.thread was added.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment