473,770 Members | 1,954 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("Locatio n: /my_internal_red irected_page.ph p");

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("Locatio n: /my_internal_red irected_page.ph p");
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 2079
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("locatio n"), 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.ne t> 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("Locatio n: /my_internal_red irected_page.ph p");

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("Locatio n: /my_internal_red irected_page.ph p");
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.ne t> 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("Locatio n: /my_internal_red irected_page.ph p");

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.ne t>
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("Locatio n: /my_internal_red irected_page.ph p");

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("Locatio n: /my_internal_red irected_page.ph p");
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********@arc turus.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********@arc turus.com.au> napisal w wiadomosci
news:40******** *************@u t-29elizabeth-reader-01.hobart.pipen etworks.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******** *************@n ews20.bellgloba l.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("locatio n"), 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.htm l

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.ne t> 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("Locatio n: /my_internal_red irected_page.ph p");

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("Locatio n: /my_internal_red irected_page.ph p");
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("Locatio n: http://www.google.com" );
header("Status: 200");
?>

--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com
Jul 17 '05 #10

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

Similar topics

4
2137
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 aims to be easier to use and more powerful. I've developped yet a first alpha that contains several components: File Source
0
3146
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 version information you get incremental backups on a per-version basis. SEE CODE BELOW Basic idea is: start TSISOON with the options: 1. "compact this db"
7
1973
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 have had a few instances where one developer or another was working on code, and did not realize that by passing their value type to a method that accepted an object parameter (or in many cases, a delegate).
2
1637
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% /usr/local/pgsql/data.old /dev/hdb2 4.5G 357M 3.9G 9% /usr/local/pgsql/data Is this normal? I've made some queries to the system and all the
17
1923
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 to stick a whole bunch of literal strings in my code. Quite frankly, I consider them a plague imposed on developers by the RAD designers that come with Visual Studio. The problem with using literal strings to refer to controls, data sources,...
10
1864
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 similar to this saying that you could make thousands of dollars within weeks with only an initial investment of $6.00!! So, I thought yeah right. This must be a scam, but like most of us, I as curious, so I kept reading. Anyway, it said that you...
20
2189
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 like to be able to write: readlock(o)
0
844
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 suggestion doesn't make much sense to me, try writing what are you trying to achieve.
6
2267
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. There is also an MFC dll that is called from this asp application to make a syntax check on quite many commands. You don't have to know what a command is. The problem that we get is the following when the asp pages calls the MFC
0
9453
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10254
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
10036
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
9904
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
8929
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...
1
7451
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
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
5354
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...
2
3607
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.