php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50587 The missing trailing slash on the url make an request error.
Submitted: 2009-12-28 03:41 UTC Modified: 2009-12-28 16:24 UTC
From: thundix at web dot de Assigned:
Status: Not a bug Package: URL related
PHP Version: 5.2.12 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: thundix at web dot de
New email:
PHP Version: OS:

 

 [2009-12-28 03:41 UTC] thundix at web dot de
Description:
------------
Request URL: http://google.de
Response Body:
"The site ? www.google.de/test.php ? doesn?t exists."

Request URL: http://google.de/
=> It works!

Same problem have andychr17 at hotmail dot com
See note here: http://de.php.net/manual/de/function.httprequest-construct.php

Reproduce code:
---------------
<?php
//=> Try it with http://www.google.de and someone with http://www.google.de/

$r = new HttpRequest("http://www.google.de",
                        HTTP_METH_GET,
                        array('timeout' => 5,
                            'useragent' => 'Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6',
                            'redirect' => 3) 
                    );

//Send request
$r->send();
//Only for showing you the result
echo $r->getResponseBody();
?>

Expected result:
----------------
=> See Description for more information

Actual result:
--------------
=> See Description for more information

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-28 03:47 UTC] rasmus@php.net
If you look at this more carefully, you will see that the server issues 
a redirect and as documented httprequest has the redirect option which 
sets how many redirects to follow set to 0.  So, this is behaving 
exactly as it was intended and exactly as documented.
 [2009-12-28 04:04 UTC] thundix at web dot de
Hello, i am not so good at english. But i think you don?t understand me correct. I know the redirect option. In my code sample the rederict element of the option array have the value 3. But not the redirect is the problem, i think. The problem ist, when i make the request with the url http://google.de php make the request with the url www.google.de/test.php . So php add the trailing slash + (and here comes the error?) the php filename.

Did you understand me now?
 [2009-12-28 04:17 UTC] rasmus@php.net
Ah, woops, didn't notice you had the redirect in there.

However, the bug is still bogus because:

1. The extension you are reporting a bug against is not part of PHP.  
It is a pecl extension which has its own bug reporting system at 
http://pecl.php.net/bugs

2. Running your exact code gives me the expected output with no mention 
of any sort of test.php script, so I suspect some user error here.  
There would be absolutely no reason for the extension to add /test.php 
to the request and there is no code in the extension that would do 
this.  You must be doing this in your code. 
 [2009-12-28 04:39 UTC] thundix at web dot de
Hello,
i run the following code:
<?php
$r = new HttpRequest("http://www.google.de", 
                        HTTP_METH_GET,
                        array('timeout' => 5,
                            'useragent' => 'Mozilla/5.0 (Windows; U;
Windows NT 6.0; de; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6',
                            'redirect' => 3) 
                    );

//Send request
$r->send();
//Only for showing you the result
echo $r->getResponseBody();
?>

And get a html code back, where i can find:
<title>404 ? Seite nicht gefunden</title>
If i run the code in my browser, i see the google search page with the text "Die Seite ? www.google.de/<theNameOfMyPHPFileScript>.php ? existiert nicht."

Isn?t it the same on your server? When you also have this i report the bug also here http://pecl.php.net/bugs .

Thanks - good night :()
 [2009-12-28 04:46 UTC] rasmus@php.net
Nope, it works perfectly on my server with that exact code.  You can 
try it for yourself here:

http://progphp.com/thundix.php
And the source code:
http://progphp.com/thundix.phps

 [2009-12-28 09:25 UTC] mike@php.net
This problem is fixed since (I guess) v1.5 of pecl/http.
 [2009-12-28 16:24 UTC] thundix at web dot de
Hello, ok thanks for the information. I will contact my webhost and ask if he can update the extension. Thanks and sry for the bogus bug report.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 06:01:29 2024 UTC