Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As topic says. Additional I get Error opening socket ssl://www.fh-muenster.de:443
and core gives Not Found
function httprl_admin_settings_form() {
$headers = array();
$headers['User-Agent'] = 'User-Agent: Drupal (+http://drupal.org/)';
// Add in the headers and enable blocking mode.
$options = array(
'blocking' => TRUE,
'headers' => $headers,
'method' => 'HEAD',
'max_redirects' => 1,
);
$urls = array(
'http://www.fh-muenster.de/FB10/weiterbildung.htm',
);
foreach ($urls as $url) {
// Queue up the requests.
httprl_request($url, $options);
// Compare to core:
krumo(drupal_http_request($url, $options));
}
// Execute requests.
$responses = httprl_send_request();
foreach ($responses as $response) {
krumo($response);
}
Comment | File | Size | Author |
---|---|---|---|
#16 | httprl-1428474-16-redirect_code-redirect_url-arrays.patch | 944 bytes | mikeytown2 |
#14 | httprl-1428474-14-redirect_code-redirect_url-arrays.patch | 968 bytes | mikeytown2 |
#11 | 2012-02-12_043825.png | 31.99 KB | hass |
#10 | httprl-1428474-10-connect-fallback.patch | 1.51 KB | mikeytown2 |
#6 | 2012-02-12_030654.png | 144.19 KB | hass |
Comments
Comment #1
hass CreditAttribution: hass commentedComment #2
mikeytown2 CreditAttribution: mikeytown2 commentedBecause multiple requests are going on, I need the redirect arrays to keep track of who requested what. This additional information could be removed at the end, but I figured it might be useful so I kept it. If having the redirect being an array is a major issue (I'll need more then it doesn't exactly do what core does) I'll look at some options. You can use array_pop to get the same info currently.
As for
Error opening socket ssl://www.fh-muenster.de:443
I can not repo that on my home computer (Win XP running XAMPP) using the latest checked in HTTPRL code.Comment #3
mikeytown2 CreditAttribution: mikeytown2 commentedComment #4
hass CreditAttribution: hass commentedI'm still able to repro with XAMPP on Win7.
The reason seems to be an invalid certificate on the remote site. WGET also complains that it's not able to validate the certificate. Not sure why core does not show this error...
https://www.fh-muenster.de/FB10/weiterbildung.htm
in the 302 redirect show the error - directly. WGET complains and say it's a self-signed certificate and I could skip the errors with--no-check-certificate
.wget -d https://www.fh-muenster.de/FB10/weiterbildung.htm
About array of redirect codes. The httprl homepage says it's API compatible to core. This also means the result array. I have no problem with the extra stuff you added as I do not need this, but if the content of the result has other structure, I need many conditional stuff to workaround the inconsistencies. I was happy that the module is named "API compatible" and expected that is really is... my code checks for and compares the value of
$response->redirect_code
and this fails if there is a subarray. I also see some benefits for the array, but it shouldn't be the default.I'm also running the max_redirects with 1 only to get the first redirect code. I have seen so many buggy sites that do a 302, 302 and than a 301... If I would just use the last I may end up in very heavy troubles. This redirects may be invalid, but they could also be correct and the user must review manually as a temp redirect (302) may not need any link update in the content, where a 301 really requires an update. Some sites have really strange logics e.g. you look for http://example.com/ and they redirect with 302 to http://example.com/index.html.
Comment #5
hass CreditAttribution: hass commentedMaybe a bug of core...
Comment #6
hass CreditAttribution: hass commentedComment #7
hass CreditAttribution: hass commentedAh, no CORE IS correct. I compared it with Google Chrome and the page output. They show a 404 page on their site...
I know the certificate tree university's, the DFN and this tree should be fairly "new" in browsers... and I guess my wget/xampp do not have the latest certificate authories in their store like Google Chrome and Your xampp has. I guess you can repro this with any self-signed certificate that your computer do not trust... I really wonder why core has other results like stream wrappers in the *same* PHP install...
I'm using xampp Lite 1.7.3
Comment #8
mikeytown2 CreditAttribution: mikeytown2 commentedWhat version of PHP are you using?
http://drupalcode.org/project/httprl.git/blob/40f0fc0302f8435ff2a3b46f2d...
https://bugs.php.net/bug.php?id=48182
I'm running php 5.2.9 (xampp 1.7.1)
This error is below what I can control. Both HTTPRL and drupal_http_request() use stream_socket_client(); main issue being the STREAM_CLIENT_ASYNC_CONNECT flag (what HTTPRL sets).
Comment #9
hass CreditAttribution: hass commentedPHP 5.3.1
Comment #10
mikeytown2 CreditAttribution: mikeytown2 commentedSo what I can do is if we tried to connect with the STREAM_CLIENT_ASYNC_CONNECT and it failed; we can use the normal way. Make this an option? Please review the attached patch and see if it works for you.
Comment #11
hass CreditAttribution: hass commentedLooks good to me now.
Note: I'm using 5.3.1... Your documentation about the versions it's fixed in - is wrong, but I also have no idea what PHP 5.3.x version contains a fix for this PHP bug.
Aside it may be a good idea to do one test with a self-signed cert... just to be save. It's one of these cases I have not really tested.
Comment #12
mikeytown2 CreditAttribution: mikeytown2 commentedpatch in #10 has been committed. If you want to find the 5.3.x version where this is fixed that would be helpful; otherwise I'll let this go as I do reference the bug in the code.
Comment #13
hass CreditAttribution: hass commentedHow about the redirect arrays? Can we make that optional?
Comment #14
mikeytown2 CreditAttribution: mikeytown2 commentedI'll have both in the response object. Here's a patch that does this.
Comment #15
hass CreditAttribution: hass commentedCode wise this looks like a good solution. I need to test it later.
Comment #16
mikeytown2 CreditAttribution: mikeytown2 commentedThis patch has been committed. It's an object not an array.
Comment #17
hass CreditAttribution: hass commentedWhy are you not using the redirect_url_array for the working job and just set the redirect_url on the end... Just an idea for code refactoring/logic cleanup.
Comment #18
mikeytown2 CreditAttribution: mikeytown2 commentedI'll do the refactoring work when I get around to implementing #1427958: Run callback after stream has been fetched. This will require a non trivial change to the event loop and will require a fair bit of refactoring to accomplish non blocking callbacks. While in here I'll clean up the redirect code.
Comment #19.0
(not verified) CreditAttribution: commentedd