FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Can I stop sending content-length header?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Can I stop sending content-length header? [message #175634] Fri, 14 October 2011 08:05 Go to next message
Hans[1] is currently offline  Hans[1]
Messages: 3
Registered: October 2011
Karma: 0
Junior Member
I'm using php with IIS. for some test,I hope php does not send back
"content-length" header.
I know using chunked transport-encoding can do it, but I don't want to
use chunked coding either.

In general, I know some http 1.0 server will not send "content-length"
header and just closing the connection to indicate content finished. I
want to simulate this behavior. Can I do it some way?

Thanks a lot!
Re: Can I stop sending content-length header? [message #175639 is a reply to message #175634] Fri, 14 October 2011 09:56 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 10/14/2011 4:05 AM, Hans wrote:
> I'm using php with IIS. for some test,I hope php does not send back
> "content-length" header.
> I know using chunked transport-encoding can do it, but I don't want to
> use chunked coding either.
>
> In general, I know some http 1.0 server will not send "content-length"
> header and just closing the connection to indicate content finished. I
> want to simulate this behavior. Can I do it some way?
>
> Thanks a lot!

Not in PHP. If you don't send a content-length header, it will be sent
for you. This is not http 1.0, and the rules are different.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Can I stop sending content-length header? [message #175643 is a reply to message #175639] Fri, 14 October 2011 16:03 Go to previous messageGo to next message
Hans[1] is currently offline  Hans[1]
Messages: 3
Registered: October 2011
Karma: 0
Junior Member
On Oct 14, 2:56 am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> On 10/14/2011 4:05 AM, Hans wrote:
>
>> I'm using php with IIS.  for some test,I hope php does not send back
>> "content-length" header.
>> I know using chunked transport-encoding can do it, but I don't want to
>> use chunked coding either.
>
>> In general, I know some http 1.0 server will not send "content-length"
>> header and just closing the connection to indicate content finished. I
>> want to simulate this behavior.  Can I do it some way?
>
>> Thanks a lot!
>
> Not in PHP.  If you don't send a content-length header, it will be sent
> for you.  This is not http 1.0, and the rules are different.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

That's bad!, no way to hack it. Or I have to export my code from php
to python? Thanks any way!
Re: Can I stop sending content-length header? [message #175644 is a reply to message #175643] Fri, 14 October 2011 16:37 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 10/14/2011 12:03 PM, Hans wrote:
> On Oct 14, 2:56 am, Jerry Stuckle<jstuck...@attglobal.net> wrote:
>> On 10/14/2011 4:05 AM, Hans wrote:
>>
>>> I'm using php with IIS. for some test,I hope php does not send back
>>> "content-length" header.
>>> I know using chunked transport-encoding can do it, but I don't want to
>>> use chunked coding either.
>>
>>> In general, I know some http 1.0 server will not send "content-length"
>>> header and just closing the connection to indicate content finished. I
>>> want to simulate this behavior. Can I do it some way?
>>
>>> Thanks a lot!
>>
>> Not in PHP. If you don't send a content-length header, it will be sent
>> for you. This is not http 1.0, and the rules are different.
>>
>
> That's bad!, no way to hack it. Or I have to export my code from php
> to python? Thanks any way!

I don't think you can stop python from doing it, either.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Can I stop sending content-length header? [message #175646 is a reply to message #175644] Sat, 15 October 2011 08:11 Go to previous messageGo to next message
Hans[1] is currently offline  Hans[1]
Messages: 3
Registered: October 2011
Karma: 0
Junior Member
On Oct 14, 9:37 am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> On 10/14/2011 12:03 PM, Hans wrote:
>
>
>
>
>
>
>
>
>
>> On Oct 14, 2:56 am, Jerry Stuckle<jstuck...@attglobal.net>  wrote:
>>> On 10/14/2011 4:05 AM, Hans wrote:
>
>>>> I'm using php with IIS.  for some test,I hope php does not send back
>>>> "content-length" header.
>>>> I know using chunked transport-encoding can do it, but I don't want to
>>>> use chunked coding either.
>
>>>> In general, I know some http 1.0 server will not send "content-length"
>>>> header and just closing the connection to indicate content finished. I
>>>> want to simulate this behavior.  Can I do it some way?
>
>>>> Thanks a lot!
>
>>> Not in PHP.  If you don't send a content-length header, it will be sent
>>> for you.  This is not http 1.0, and the rules are different.
>
>> That's bad!, no way to hack it.  Or I have to export my code from php
>> to python? Thanks any way!
>
> I don't think you can stop python from doing it, either.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

Using python seems can do everything. I already tried a simple python
code(using python itself without any other web server support) to do
it. but export all my php code to python will be a hard work.
Re: Can I stop sending content-length header? [message #175647 is a reply to message #175634] Sat, 15 October 2011 08:58 Go to previous messageGo to next message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 14-10-2011 10:05, Hans wrote:
> I'm using php with IIS. for some test,I hope php does not send back
> "content-length" header.
> I know using chunked transport-encoding can do it, but I don't want to
> use chunked coding either.
>
> In general, I know some http 1.0 server will not send "content-length"
> header and just closing the connection to indicate content finished. I
> want to simulate this behavior. Can I do it some way?
>
> Thanks a lot!

Will this help:
http://www.php.net/manual/en/function.header.php#96442

It still uses HTTP/1.1 but with a 204 response (as i try to understand
what xxxbunker is doing there ;)

--
Luuk
Re: Can I stop sending content-length header? [message #175651 is a reply to message #175634] Sun, 16 October 2011 03:55 Go to previous message
Eli the Bearded is currently offline  Eli the Bearded
Messages: 22
Registered: April 2011
Karma: 0
Junior Member
In comp.lang.php, Hans <hansyin(at)gmail(dot)com> wrote:
> I'm using php with IIS. for some test,I hope php does not send back
> "content-length" header.
> I know using chunked transport-encoding can do it, but I don't want to
> use chunked coding either.
>
> In general, I know some http 1.0 server will not send "content-length"
> header and just closing the connection to indicate content finished. I
> want to simulate this behavior. Can I do it some way?

Have the client send a HTTP/1.0 request? Tell the server to server the
script as HTTP/1.0? I know Apache has some controls for that (see
"force-response-1.0"). Not sure you can do it in PHP though.

Elijah
------
has never worked with IIS
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to redirect user based on user country?
Next Topic: Site to open blocked sites, and prohibited and encoded
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 06:40:54 GMT 2024

Total time taken to generate the page: 0.06311 seconds