473,396 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

http pipelining

Which python module is capable of pipelining http requests?

(I know httplib can send mulitple requests per tcp connection, but in
a strictly serial way. )
Apr 26 '07 #1
4 4728
sw***@yahoo.com wrote:
Which python module is capable of pipelining http requests?

(I know httplib can send mulitple requests per tcp connection, but in
a strictly serial way. )
Oops, sorry, you meant sending requests in parallel, right?

You'll need to use either urllib or urllib2 for the web, and the
threading module is one way to run parallel requests. It's fairly easy
to use as long as you keep your tasks properly isolated form each other.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings http://holdenweb.blogspot.com

Apr 27 '07 #2
sw***@yahoo.com wrote:
Which python module is capable of pipelining http requests?

(I know httplib can send mulitple requests per tcp connection, but in
a strictly serial way. )

There's nothing in the standard library, I believe, that includes both
client and server functionality in the same module. So you would need to
glue them together.

If you want a simple net proxy server I seem to remember the chameleon
system allows you to write one in about twelve lines. If it has to be
HTTP-specific, with header parsing and the like, you might want to think
about Twisted, which supports both client and server functionality and
tries to make it easy to plumb things together in pipelines.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings http://holdenweb.blogspot.com

Apr 27 '07 #3
On Fri, 27 Apr 2007 13:50:21 -0400, Steve Holden <st***@holdenweb.com>
wrote:
>sw***@yahoo.com wrote:
>Which python module is capable of pipelining http requests?

(I know httplib can send mulitple requests per tcp connection, but in
a strictly serial way. )

There's nothing in the standard library, I believe, that includes both
client and server functionality in the same module. So you would need to
glue them together.

If you want a simple net proxy server I seem to remember the chameleon
system allows you to write one in about twelve lines. If it has to be
HTTP-specific, with header parsing and the like, you might want to think
about Twisted, which supports both client and server functionality and
tries to make it easy to plumb things together in pipelines.
Sorry for my confused question.

What I'm looking for is to emulate what a modern HTTP 1.1 browser like
Firefox does(when network.http.pipelining is enabled)

1.Open TCP connetion.

send multiple requests without waiting for a reply:

2.GET /url1
3.GET /url2
4.GET /url3
5.read 1st reply
6.read 2st reply
7.read 3st reply

8.Close TCP connection.

I'll be using Apache or IIS as my web server.
Apr 27 '07 #4
Steve Holden <st***@holdenweb.comwrites:
sw***@yahoo.com wrote:
Which python module is capable of pipelining http requests?
(I know httplib can send mulitple requests per tcp connection, but in
a strictly serial way. )
Oops, sorry, you meant sending requests in parallel, right?

You'll need to use either urllib or urllib2 for the web, and the
threading module is one way to run parallel requests. It's fairly easy
to use as long as you keep your tasks properly isolated form each
other.
No, he means "HTTP pipelining", which means sending multiple requests
down a single TCP connection, without waiting for the first response.

httplib's module-level docstring says (reformatted here):

"""
.... The HTTPResponse class does not enforce this state machine, which
implies sophisticated clients may accelerate the request/response
pipeline. Caution should be taken, though: accelerating the states
beyond the above pattern may imply knowledge of the server's
connection-close behavior for certain requests. For example, it is
impossible to tell whether the server will close the connection UNTIL
the response headers have been read; this means that further requests
cannot be placed into the pipeline until it is known that the server
will NOT be closing the connection.
"""

So, sort-of-yes, if you know what you're doing and you're lucky.

Certainly urllib and urllib2 don't support pipelining. There were
plans for a new HTTP client in Twisted with pipelining support, but I
don't know if that ever came about. AFAIK not many libraries (in any
language) support it -- e.g. none of "Jakarta commons HTTPClient",
libwww-perl, and libcurl currently support it. libwww (without the
"-perl") does claim to support it (I say "claim" merely because I
haven't used it or read the source -- no FUD intended).
Side note: As the OP mentions in a followup, by default firefox does
NOT do pipelining (to the disbelief of the people I told about this
when it came up in a previous job -- but I just tried running tcpdump
and indeed about:config seems to be telling the truth; fortunately, in
response to the limitations imposed by RFC 2616, somebody has
thoughtfully arranged for the speed of light to be fast enough for
this not to be a major problem when using websites on the other side
of the planet). The firefox people say:

http://www.mozilla.org/support/firef...oth_pipelining

"""
Pipelining is an experimental feature, designed to improve page-load
performance, that is unfortunately not well supported by some web
servers and proxies.
"""

Instead of pipelining, it uses multiple connections (2 when I tried
it, which is the maximum RFC 2616 says SHOULD be used by a
"single-user client"). I didn't try IE, but apparently it has the
same behaviour (2 connections, no pipelining):

http://blogs.msdn.com/ie/archive/2005/04/11/407189.aspx
I wonder if the right economic pressures are there for SCTP ever to
get used for everyday web HTTP stuff...
John
Apr 29 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Joshua W. Biagio | last post by:
Hello all, I am having difficulty getting the HTTP/1.1 support (i.e. pipelining and persistent connections) for the BaseHTTPServer library to work. When I change the line for the protocol in...
3
by: noviceUser | last post by:
can some one guide me how to use HTTP 1.1 pipelining in Python. Client will generate 3 get requests continuously as shown below and then read the response for each GET request. Algorithm...
7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
8
by: turnit \(removethis\) | last post by:
I have a login form that uses the post method to carry the information to the next page. The form works just fine in ie6.0, but fails in mozilla and fails in ie5.2 on a mac. "HTTP/1.1 400 Bad...
3
by: ashesdesign | last post by:
Hi All, I am very new to php and even newer to XML. Can anyone please shed some light on how to post XML requests via HTTP. I have been searching high and low and have come across many...
5
by: David Lozzi | last post by:
Howdy, I wrote a web service in .Net for my customer. My customer has another vendor who now has to consume it but they are not using Visual Studio. Most of their pages are jsp, and they said...
4
by: Bob Badger | last post by:
Hi, Simple question (although I guess with a complicated answer). Is HTTP an async protocol? For instance, if I send a message to a c# webservice via http what is the protocol actually doing? ...
2
by: Rein Petersen | last post by:
Hi All, I've recently been intrigued with this notion of "Service Streaming": http://ajaxpatterns.org/HTTP_Streaming in which you make use of the webserver and browsers ability to maintain...
2
by: Rod | last post by:
Hi, I have a frameset with two frames. The .aspx page for each frame contains a button with a server click event handler assigned. The server code for one button runs a time consuming process,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.