474,048 Members | 10,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4779
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***@holdenwe b.com>
wrote:
>sw***@yahoo.co m 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.pi pelining 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***@holdenwe b.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
2039
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 BaseHTTPServer from "HTTP/1.0" to "HTTP/1.1", the SimpleHTTPServer program can still serve directory listings and even graphics files, but it hangs when I try to browse to an HTML file. I have a directory of web pages that I use to test servers (such as...
3
2408
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 ---------- GET(ur1_l) GET(url_2) GET(url_3)
7
9315
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. # No warranty express or implied for the accuracy, fitness to purpose
8
10682
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 Request" was the original error msg now that I reinstalled iislockdown and urscan I get "The parameter is incorrect." If I use the get method with this form it works just fine on everything. I can't say for certain but I think this problem started...
3
5420
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 examples and snippets, but none work nor make sense to me. Below is an example of what it is I need to send as a request and the typical example I should receive. I just don't know how to send the request!!! A Request
5
10414
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 they need to consume this web service using HTTP. The developer's IDE is Notepad. Yeah, weird I know. How is this done? I guess if I can get it to run ASP, IDE independant, that should make them happy. Any references you can point me to?
4
2495
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? Thanks in advance Steffan
2
2013
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 a connection using a loop on the web server. I know those of you familiar with how IIS/asp.net (aspnet_isapi.dll) handles HttpApplication threads (a pool) are probably very offended by this
2
5276
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, the code for the second button updates a text field on the same page. The way I understand it the aspnet_wp process has a thread pool and each request is assigned to a thread, so what I would expect to happen is that I could click the button on...
0
10554
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
12156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
12046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
11146
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10328
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6667
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
5430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4951
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.