473,320 Members | 1,933 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,320 software developers and data experts.

A GREAT SUGGESTION TO PHP DEVELOPPERS

Hello,

It would be great if there was an option to tell PHP to let the user
manage all the HTTP headers instead of sending what it thinks is good for
the programmer...

For example when you write:

header("Status: 200 OK");
header("Location: /my_internal_redirected_page.php");

PHP "decides" that the status will be "302 moved", ignoring the "Status:
200 OK" (ie: the programmer is stupid)...

I use PHP as a cgi along with mod_fastcgi, when fastcgi sees a relative
redirection with a "200 OK" status it autaumatically do an internal
redirection (very useful in some cases, to hide a file url for example).

Well, in PHP 4.3.4, the only way I found to achieve this was this
wonderful trick:

header("Location: /my_internal_redirected_page.php");
header("HTTP/1.0 200 OK");

If you put the Location header after the "HTTP/1.0 200 OK" header PHP
sends a 302 status without the Location header (no comment).

That reminds me Micro$oft programs that always know better what the user
wants to do than the user himself...

It is a pity which PHP behaves like micro$oft, if the programmer sends
stupid HTTP headers, PHP should let him do...

So I think that an option to let the programmer send all http headers
would be great, that way people who don't want to care about headers
won't have troubles and experimented programmers will be happy :)
I would like to thank all PHP developpers for their great work and I hope
they'll consider this suggestion ;)


John
PS: I posted this suggestion here because I don't know where to send
it... If someone knows a better place, please tell me.
Jul 17 '05 #1
11 2047
I dont approuve your suggestion because right now, it send the correct
header fallowing what you are doing with the http header. Exemple, if you
moved a file permanently and you send a 200 OK, we whould be in a world of
mess. It's like you are connecting to a ftp server but want to fake him as
you are doing a smtp connection... I dont get what whould be useful for. If
you are using header("location"), it's because your file is on another
place, so you should not send 200 ok as if the file requested is really
here, see...

Savut

"John Wellesz" <jo*****************************@firstream.net> wrote in
message news:Xn**********************@213.91.2.138...
Hello,

It would be great if there was an option to tell PHP to let the user
manage all the HTTP headers instead of sending what it thinks is good for
the programmer...

For example when you write:

header("Status: 200 OK");
header("Location: /my_internal_redirected_page.php");

PHP "decides" that the status will be "302 moved", ignoring the "Status:
200 OK" (ie: the programmer is stupid)...

I use PHP as a cgi along with mod_fastcgi, when fastcgi sees a relative
redirection with a "200 OK" status it autaumatically do an internal
redirection (very useful in some cases, to hide a file url for example).

Well, in PHP 4.3.4, the only way I found to achieve this was this
wonderful trick:

header("Location: /my_internal_redirected_page.php");
header("HTTP/1.0 200 OK");

If you put the Location header after the "HTTP/1.0 200 OK" header PHP
sends a 302 status without the Location header (no comment).

That reminds me Micro$oft programs that always know better what the user
wants to do than the user himself...

It is a pity which PHP behaves like micro$oft, if the programmer sends
stupid HTTP headers, PHP should let him do...

So I think that an option to let the programmer send all http headers
would be great, that way people who don't want to care about headers
won't have troubles and experimented programmers will be happy :)
I would like to thank all PHP developpers for their great work and I hope
they'll consider this suggestion ;)


John
PS: I posted this suggestion here because I don't know where to send
it... If someone knows a better place, please tell me.


Jul 17 '05 #2
On 2004-03-19, John Wellesz <jo*****************************@firstream.net> wrote:
Hello,

It would be great if there was an option to tell PHP to let the user
manage all the HTTP headers instead of sending what it thinks is good for
the programmer...

For example when you write:

header("Status: 200 OK");
header("Location: /my_internal_redirected_page.php");

PHP "decides" that the status will be "302 moved", ignoring the "Status:
200 OK" (ie: the programmer is stupid)...


I don't see why it would be good to make up your own status codes?

Question that i have right now: When buffering output, are the headers
buffered too? Is there a way to do this?

--
http://home.mysth.be/~timvw
Jul 17 '05 #3
Your suggestion would probably break 90% of the existing code out there that
does redirection. Most PHP programmers don't supply the status code when
they set the location header.

Uzytkownik "John Wellesz" <jo*****************************@firstream.net>
napisal w wiadomosci news:Xn**********************@213.91.2.138...
Hello,

It would be great if there was an option to tell PHP to let the user
manage all the HTTP headers instead of sending what it thinks is good for
the programmer...

For example when you write:

header("Status: 200 OK");
header("Location: /my_internal_redirected_page.php");

PHP "decides" that the status will be "302 moved", ignoring the "Status:
200 OK" (ie: the programmer is stupid)...

I use PHP as a cgi along with mod_fastcgi, when fastcgi sees a relative
redirection with a "200 OK" status it autaumatically do an internal
redirection (very useful in some cases, to hide a file url for example).

Well, in PHP 4.3.4, the only way I found to achieve this was this
wonderful trick:

header("Location: /my_internal_redirected_page.php");
header("HTTP/1.0 200 OK");

If you put the Location header after the "HTTP/1.0 200 OK" header PHP
sends a 302 status without the Location header (no comment).

That reminds me Micro$oft programs that always know better what the user
wants to do than the user himself...

It is a pity which PHP behaves like micro$oft, if the programmer sends
stupid HTTP headers, PHP should let him do...

So I think that an option to let the programmer send all http headers
would be great, that way people who don't want to care about headers
won't have troubles and experimented programmers will be happy :)
I would like to thank all PHP developpers for their great work and I hope
they'll consider this suggestion ;)

Jul 17 '05 #4
Thats the stupidest fucking thing I've ever heard.
Jul 17 '05 #5
Sean Malloy <no********@arcturus.com.au> wrote or quoted:
Thats the stupidest fucking thing I've ever heard.


Not new to the net by any chance - are you? ;-)
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #6
Uzytkownik "Sean Malloy" <no********@arcturus.com.au> napisal w wiadomosci
news:40*********************@ut-29elizabeth-reader-01.hobart.pipenetworks.co
m...
Thats the stupidest fucking thing I've ever heard.


I guess you haven't seen the Matrix sequels yet.
Jul 17 '05 #7
On 20 mars 2004, Sir Tim Van Wassenhove <eu**@pi.be> claimed in
news:c3*************@ID-188825.news.uni-berlin.de:

Question that i have right now: When buffering output, are the headers
buffered too? Is there a way to do this?


No, when ythe output is buffered, the headers are not, they are sent
directly.

Jul 17 '05 #8
On 19 mars 2004, Sir "Savut" <we***@hotmail.com> claimed in
news:UK*********************@news20.bellglobal.com :
I dont approuve your suggestion because right now, it sends the correct
header fallowing what you are doing with the http header.
I'm not agree, 302 is not an absolute correct answer. (see below)
Exemple, if you moved a file permanently and you send a 200 OK, we
whould be in a world of mess.
It simply won't work... (we are not doing HTML)
and for permanently we send a 301 status code not a 302.

Actually the "Location" header is also used with those status codes:

- 201 Created
- 300 Multiple Choices
- 301 Moved Permanently
- 302 Found
- 303 See Other
- 307 Temporary Redirect

source: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
It's like you are connecting to a ftp server but want
to fake him as you are doing a smtp connection... I dont get what
whould be useful for. If you are using header("location"), it's
because your file is on another place, so you should not send 200 ok
as if the file requested is really here, see...
200 means that the request has succeded not that the file "is here".

In CGI/1.1 standards, if you send a location with a _RELATIVE_ URL (an
absolute path), it HAS to do an internal redirection....

As mod_fastcgi for example (read the section
"Notes on CGI response headers"):

http://www.fastcgi.com/om_archive/se...apache/apache-
fastcgi/mod_fastcgi.html

PHP DOESN'T RESPECT THIS...

Your suggestion would probably break 90% of the existing code out
there that does redirection. Most PHP programmers don't supply the
status code when they set the location header.


That's why I suggest this as a new OPTION, disabled by default, to let
programmers manage headers without PHP interferences...
John
Jul 17 '05 #9
John Wellesz <jo*****************************@firstream.net> wrote in message news:<Xn**********************@213.91.2.138>...
Hello,

It would be great if there was an option to tell PHP to let the user
manage all the HTTP headers instead of sending what it thinks is good for
the programmer...

For example when you write:

header("Status: 200 OK");
header("Location: /my_internal_redirected_page.php");

PHP "decides" that the status will be "302 moved", ignoring the "Status:
200 OK" (ie: the programmer is stupid)...

I use PHP as a cgi along with mod_fastcgi, when fastcgi sees a relative
redirection with a "200 OK" status it autaumatically do an internal
redirection (very useful in some cases, to hide a file url for example).

Well, in PHP 4.3.4, the only way I found to achieve this was this
wonderful trick:

header("Location: /my_internal_redirected_page.php");
header("HTTP/1.0 200 OK");


Sounds like you're referring the user notes by ahring.de
(02-Dec-2003 09:24) found at <http://in.php.net/header>

In that case, the following is working fine:

<?php
header("Location: http://www.google.com");
header("Status: 200");
?>

--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com
Jul 17 '05 #10
On 22 mars 2004, Sir ng**********@rediffmail.com (R. Rajesh Jeba Anbiah)
claimed in news:ab**************************@posting.google.c om:


Sounds like you're referring the user notes by ahring.de
(02-Dec-2003 09:24) found at <http://in.php.net/header>

In that case, the following is working fine:

<?php
header("Location: http://www.google.com");
header("Status: 200");
?>


I tried that but it didn't work (302 was sent), at least with PHP 4.3.4 on
FreeBSD 4.9 STABLE, it seems that after a "Location" header, PHP only
considers 3xx status codes...
Jul 17 '05 #11
I agree and have made a similar comment before. There are
circumstances where it's desirable to take complete responsibility for
generating the full HTTP response including headers, but there's
currently no way of turning everything off. I hit against this problem
when doing R&D into a WebDAV implementation. In the end I had to
abandon the use of PHP as a gateway technology which was a great pity.
It seems that PHP adopts the "nanny knows best" attitude and assumes
responsibility in this area.

Rob
On 21 Mar 2004 21:36:13 -0800, ng**********@rediffmail.com (R. Rajesh
Jeba Anbiah) wrote:
John Wellesz <jo*****************************@firstream.net> wrote in message news:<Xn**********************@213.91.2.138>...
Hello,

It would be great if there was an option to tell PHP to let the user
manage all the HTTP headers instead of sending what it thinks is good for
the programmer...

For example when you write:

header("Status: 200 OK");
header("Location: /my_internal_redirected_page.php");

PHP "decides" that the status will be "302 moved", ignoring the "Status:
200 OK" (ie: the programmer is stupid)...

I use PHP as a cgi along with mod_fastcgi, when fastcgi sees a relative
redirection with a "200 OK" status it autaumatically do an internal
redirection (very useful in some cases, to hide a file url for example).

Well, in PHP 4.3.4, the only way I found to achieve this was this
wonderful trick:

header("Location: /my_internal_redirected_page.php");
header("HTTP/1.0 200 OK");


Sounds like you're referring the user notes by ahring.de
(02-Dec-2003 09:24) found at <http://in.php.net/header>

In that case, the following is working fine:

<?php
header("Location: http://www.google.com");
header("Status: 200");
?>


---
Rob Tweed
M/Gateway Developments Ltd

Global DOMination with eXtc : http://www.mgateway.tzo.com
---
Jul 17 '05 #12

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

Similar topics

4
by: Alexander DEJANOVSKI | last post by:
Hi all, I'm starting a new project to develop an Open-Source EAI server in Python and I'm looking for motivated developpers and testers. It is inspired by Open Adaptor (www.openadaptor.org), but...
0
by: Willem | last post by:
Based on MK's TSI_SOON (http://www.trigeminal.com/)I've created a nifty little procedure that - whenever you compact you db you get an incremental backup copy. Given that you have a table with...
7
by: J.Marsch | last post by:
I don't know whether this is the appropriate place to give product feedback, but here goes: I would love to see some kind of diagnostic to let me know when implicit boxing has occurred. We...
2
by: Carlos Costa Portela | last post by:
Hello all! I've upgraded postgresql from 7.2 to 7.4, and my data dir has changed a lot: S.ficheros Tamaño Usado Disp Uso% Montado en /dev/hda1 1.9G 1.8G 64M 97%...
17
by: Jedrzej Miadowicz | last post by:
I recently (re)discovered data binding in Windows Forms thanks to its advances in Visual Studio 2005. As I looked a little deeper, however, I realize that it still suffers from an irksome tendency...
10
by: ravenwolf | last post by:
IT'S SIMPLE AND IT'S LEGAL!!!!!!! I found this on a bulletin board and decided to try it a little while back; I was browsing through news groups just as you are right now and came across an article...
20
by: Allan Ebdrup | last post by:
I have a suggestion for C# I would like reader/writer locks to be built in to the language. When you want to aquire a loct on an object o you write lock(o) { ...//critical region } I would...
0
by: Guilherme Polo | last post by:
On Mon, Sep 1, 2008 at 3:35 PM, <dudeja.rajat@gmail.comwrote: Note that you are not supposed to use _show, use showerror here instead. Remove the call to sys.exit then ? Your ask for a...
6
by: Tony Johansson | last post by:
Hello! We have a C#.ASP.NET application that runs on a IIS 6. The application contains actually several asp pages but there is no GUI. The application receive an xml file that is processed....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.