Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
H
httprl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
drupal.org
httprl
Commits
97acb7bf
Commit
97acb7bf
authored
Jan 17, 2013
by
mikeytown2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #1889006 by mikeytown2: Fix some of the readme examples.
parent
7f921776
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
README.txt
README.txt
+12
-10
No files found.
README.txt
View file @
97acb7bf
...
...
@@ -216,6 +216,8 @@ connections that couldn't be made will be dropped.
$options = array(
'method' => 'HEAD',
'blocking' => FALSE,
'domain_connections' => 1000,
'global_connections' => 1000,
);
// Queue up the requests.
$max = 1000;
...
...
@@ -235,9 +237,9 @@ connections that couldn't be made will be dropped.
Request 1000 URLs in a non blocking manner with one httprl_request() call. These
URLs will all have the same options. This will saturate the server.
All 1000
requests will eventually hit the server due to it waiting for the connection to
be established; `async_connect` is FALSE.
URLs will all have the same options. This will saturate the server.
Usually all
1000 requests will eventually hit the server due to it waiting for the
connection to
be established; `async_connect` is FALSE.
<?php
// Set the blocking mode.
...
...
@@ -245,6 +247,10 @@ be established; `async_connect` is FALSE.
'method' => 'HEAD',
'blocking' => FALSE,
'async_connect' => FALSE,
// domain_connections must be smaller than the servers max number of
// clients.
'domain_connections' => 32,
'global_connections' => 1000,
);
// Queue up the requests.
$max = 1000;
...
...
@@ -360,7 +366,8 @@ instead of returning a value.
**More Advanced HTTP Operations**
Hit 4 different URLs, Using at least 2 that has a status code of 200 and
erroring out the others that didn't return fast. Data is truncated as well.
erroring out the others that didn't return fast. Using the Range header so only
the first and last 128 bytes are returned.
<?php
// Array of URLs to get.
...
...
@@ -375,7 +382,7 @@ erroring out the others that didn't return fast. Data is truncated as well.
// Process list of URLs.
$options = array(
'alter_all_streams_function' => 'need_two_good_results',
'
callback' => array(array('function' => 'limit_data_size')
),
'
headers' => array('Range' => 'bytes=0-127,-128'
),
);
// Queue up the requests.
httprl_request($urls, $options);
...
...
@@ -412,11 +419,6 @@ erroring out the others that didn't return fast. Data is truncated as well.
}
}
}
function limit_data_size(&$result) {
// Only use the first and last 256 characters in the data array.
$result->data = substr($result->data, 0, 256) . "\n\n ... \n\n" . substr($result->data, strlen($result->data)-256);
}
?>
...
...
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