runrev adds http header for free?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

runrev adds http header for free?

Bert Shuler
I wanted to write a quick http server, mostly just to learn rev.

It was very easy, and I am happy so far, but I have a mystery I hope  
someone can help me with.
My code is here: http://www.mediafire.com/?jbldjj0ogck

  It seems that when I write the data back out to to the socket,  
runrev adds a http header on its own, and I cant add the one I want.
Really weird.

When I have it execute this perl script, you can see the problem:

#!/usr/bin/perl

  print "Content-type: text/html\n\n";
  print "<tt>\n";
  foreach $key (sort keys(%ENV)) {
     print "$key = $ENV{$key}<p>";
  }

Also, I am open to advice on my coding, but please if it is bashing  
me, send that directly to me at [hidden email]

Thanks



_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: runrev adds http header for free?

xtalkprogrammer
Hi Bert,

You can set the httpHeaders property. E.g. the User-Agent. There's  
lots of information in the list archives and of course you need to  
check the docs.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Benefit from our inexpensive hosting services. See http://economy-x-talk.com/server.html 
  for more info.

On 18 jul 2008, at 15:57, Bert Shuler wrote:

> I wanted to write a quick http server, mostly just to learn rev.
>
> It was very easy, and I am happy so far, but I have a mystery I hope  
> someone can help me with.
> My code is here: http://www.mediafire.com/?jbldjj0ogck
>
> It seems that when I write the data back out to to the socket,  
> runrev adds a http header on its own, and I cant add the one I want.
> Really weird.
>
> When I have it execute this perl script, you can see the problem:
>
> #!/usr/bin/perl
>
> print "Content-type: text/html\n\n";
> print "<tt>\n";
> foreach $key (sort keys(%ENV)) {
>    print "$key = $ENV{$key}<p>";
> }
>
> Also, I am open to advice on my coding, but please if it is bashing  
> me, send that directly to me at [hidden email]
>
> Thanks

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Kind regards,

Drs. Mark Schonewille

Economy-x-Talk Consultancy and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Facebook: http://facebook.com/LiveCode.Beginner
KvK: 50277553
Reply | Threaded
Open this post in threaded view
|

Re: runrev adds http header for free?

Bert Shuler
ok, I thought that was only used when using the URL keyword.
I am simply writing to a socket.
How would rev even know I was intending to write http?


On Jul 18, 2008, at 10:02 AM, Mark Schonewille wrote:

> Hi Bert,
>
> You can set the httpHeaders property. E.g. the User-Agent. There's  
> lots of information in the list archives and of course you need to  
> check the docs.
>
> --
> Best regards,
>
> Mark Schonewille
>
> Economy-x-Talk Consulting and Software Engineering
> http://economy-x-talk.com
> http://www.salery.biz
>
> Benefit from our inexpensive hosting services. See http://economy-x-talk.com/server.html 
>  for more info.
>
> On 18 jul 2008, at 15:57, Bert Shuler wrote:
>
>> I wanted to write a quick http server, mostly just to learn rev.
>>
>> It was very easy, and I am happy so far, but I have a mystery I  
>> hope someone can help me with.
>> My code is here: http://www.mediafire.com/?jbldjj0ogck
>>
>> It seems that when I write the data back out to to the socket,  
>> runrev adds a http header on its own, and I cant add the one I want.
>> Really weird.
>>
>> When I have it execute this perl script, you can see the problem:
>>
>> #!/usr/bin/perl
>>
>> print "Content-type: text/html\n\n";
>> print "<tt>\n";
>> foreach $key (sort keys(%ENV)) {
>>   print "$key = $ENV{$key}<p>";
>> }
>>
>> Also, I am open to advice on my coding, but please if it is bashing  
>> me, send that directly to me at [hidden email]
>>
>> Thanks
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: runrev adds http header for free?

xtalkprogrammer
Hi Bert,

Maybe I don't understand what is going on without looking at your  
code. At which point do you see unwanted http headers? When you write  
data to perl or when you read the data into rev? Is it possible that  
Perl adds the headers, since you're using "print "Content-type: text/
html\n\n";"? Maybe you want "print "Content-type: text/plain\n\n";".

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Benefit from our inexpensive hosting services. See http://economy-x-talk.com/server.html 
  for more info.

On 18 jul 2008, at 16:05, Bert Shuler wrote:

> ok, I thought that was only used when using the URL keyword.
> I am simply writing to a socket.
> How would rev even know I was intending to write http?
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Kind regards,

Drs. Mark Schonewille

Economy-x-Talk Consultancy and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Facebook: http://facebook.com/LiveCode.Beginner
KvK: 50277553
Reply | Threaded
Open this post in threaded view
|

Re: runrev adds http header for free?

Bert Shuler
The header written by perl shows as html in the browser, because rev  
somehow added a header.


On Jul 18, 2008, at 10:21 AM, Mark Schonewille wrote:

> Hi Bert,
>
> Maybe I don't understand what is going on without looking at your  
> code. At which point do you see unwanted http headers? When you  
> write data to perl or when you read the data into rev? Is it  
> possible that Perl adds the headers, since you're using "print  
> "Content-type: text/html\n\n";"? Maybe you want "print "Content-
> type: text/plain\n\n";".
>
> --
> Best regards,
>
> Mark Schonewille
>
> Economy-x-Talk Consulting and Software Engineering
> http://economy-x-talk.com
> http://www.salery.biz
>
> Benefit from our inexpensive hosting services. See http://economy-x-talk.com/server.html 
>  for more info.
>
> On 18 jul 2008, at 16:05, Bert Shuler wrote:
>
>> ok, I thought that was only used when using the URL keyword.
>> I am simply writing to a socket.
>> How would rev even know I was intending to write http?
>>
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: runrev adds http header for free?

masmit
Could it be that the browser is expecting 2 crlfs after the header,  
while 2 lfs are all that's being written?

Even if the perl script is producing crlfs, Rev tends to convert  
crlfs to lfs unless you specifically prevent it.

Perhaps it would help if you inserted the line:

replace lf with crlf in buffer

before writing it out to the socket.

I'm fairly sure that Rev would not be adding spurious headers - I  
think it's only  libUrl that would have that capability, and I'm sure  
it's better behaved than that, even if it's installed in your cgi setup.

Best,

Mark

On 18 Jul 2008, at 15:27, Bert Shuler wrote:

> The header written by perl shows as html in the browser, because  
> rev somehow added a header.
>
>
> On Jul 18, 2008, at 10:21 AM, Mark Schonewille wrote:
>
>> Hi Bert,
>>
>> Maybe I don't understand what is going on without looking at your  
>> code. At which point do you see unwanted http headers? When you  
>> write data to perl or when you read the data into rev? Is it  
>> possible that Perl adds the headers, since you're using "print  
>> "Content-type: text/html\n\n";"? Maybe you want "print "Content-
>> type: text/plain\n\n";".
>>
>> --
>> Best regards,
>>
>> Mark Schonewille
>>
>> Economy-x-Talk Consulting and Software Engineering
>> http://economy-x-talk.com
>> http://www.salery.biz
>>
>> Benefit from our inexpensive hosting services. See http://economy- 
>> x-talk.com/server.html for more info.
>>
>> On 18 jul 2008, at 16:05, Bert Shuler wrote:
>>
>>> ok, I thought that was only used when using the URL keyword.
>>> I am simply writing to a socket.
>>> How would rev even know I was intending to write http?
>>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: runrev adds http header for free?

Bert Shuler
Mark, I think your on to something.
I think my web browser is not recognizing my header, and live http  
headers is lieing to me.

I ran this test, and it seems to disprove the free runrev header idea.


telnet 127.0.0.1 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /env.pl HTTP/1.1
Content-type: text/html

<tt>
Apple_PubSub_Socket_Render = /tmp/launch-JAC787/Render<p>COMMAND_MODE  
= legacy<p>DISPLAY = /tmp/launch-bf8cAs/:0<p>HOME = /Users/
bshuler<p>LOGNAME = bshuler<p>PATH = /usr/bin:/bin:/usr/sbin:/
sbin<p>PWD = /Applications/Revolution Studio/2.9.0-
gm-1<p>SECURITYSESSIONID = 620680<p>SHELL = /bin/bash<p>SHLVL =  
1<p>SSH_AUTH_SOCK = /tmp/launch-YZYPQ5/Listeners<p>TMPDIR = /var/
folders/B1/B1LJiAyjGNuOhekZm3xRKE+++TI/-Tmp-/<p>USER = bshuler<p>_ = /
Users/bshuler/Sites//env.pl<p>__CF_USER_TEXT_ENCODING =  
0x1F5:0:0<p>Connection closed by foreign host.


On Jul 18, 2008, at 11:16 AM, Mark Smith wrote:

> Could it be that the browser is expecting 2 crlfs after the header,  
> while 2 lfs are all that's being written?
>
> Even if the perl script is producing crlfs, Rev tends to convert  
> crlfs to lfs unless you specifically prevent it.
>
> Perhaps it would help if you inserted the line:
>
> replace lf with crlf in buffer
>
> before writing it out to the socket.
>
> I'm fairly sure that Rev would not be adding spurious headers - I  
> think it's only  libUrl that would have that capability, and I'm  
> sure it's better behaved than that, even if it's installed in your  
> cgi setup.
>
> Best,
>
> Mark
>
> On 18 Jul 2008, at 15:27, Bert Shuler wrote:
>> The header written by perl shows as html in the browser, because  
>> rev somehow added a header.
>>
>>
>> On Jul 18, 2008, at 10:21 AM, Mark Schonewille wrote:
>>
>>> Hi Bert,
>>>
>>> Maybe I don't understand what is going on without looking at your  
>>> code. At which point do you see unwanted http headers? When you  
>>> write data to perl or when you read the data into rev? Is it  
>>> possible that Perl adds the headers, since you're using "print  
>>> "Content-type: text/html\n\n";"? Maybe you want "print "Content-
>>> type: text/plain\n\n";".
>>>
>>> --
>>> Best regards,
>>>
>>> Mark Schonewille
>>>
>>> Economy-x-Talk Consulting and Software Engineering
>>> http://economy-x-talk.com
>>> http://www.salery.biz
>>>
>>> Benefit from our inexpensive hosting services. See http://economy-x-talk.com/server.html 
>>>  for more info.
>>>
>>> On 18 jul 2008, at 16:05, Bert Shuler wrote:
>>>
>>>> ok, I thought that was only used when using the URL keyword.
>>>> I am simply writing to a socket.
>>>> How would rev even know I was intending to write http?
>>>>
>>>
>>> _______________________________________________
>>> use-revolution mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your  
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: runrev adds http header for free?

Bert Shuler
That was the problem. Once I get the CGI gateway working ill post it  
again... just incase someone finds it useful.

Thanks all!

Bert


On Jul 18, 2008, at 11:34 AM, Bert Shuler wrote:

> Mark, I think your on to something.
> I think my web browser is not recognizing my header, and live http  
> headers is lieing to me.
>
> I ran this test, and it seems to disprove the free runrev header idea.
>
>
> telnet 127.0.0.1 8080
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> GET /env.pl HTTP/1.1
> Content-type: text/html
>
> <tt>
> Apple_PubSub_Socket_Render = /tmp/launch-JAC787/
> Render<p>COMMAND_MODE = legacy<p>DISPLAY = /tmp/launch-bf8cAs/:
> 0<p>HOME = /Users/bshuler<p>LOGNAME = bshuler<p>PATH = /usr/bin:/
> bin:/usr/sbin:/sbin<p>PWD = /Applications/Revolution Studio/2.9.0-
> gm-1<p>SECURITYSESSIONID = 620680<p>SHELL = /bin/bash<p>SHLVL =  
> 1<p>SSH_AUTH_SOCK = /tmp/launch-YZYPQ5/Listeners<p>TMPDIR = /var/
> folders/B1/B1LJiAyjGNuOhekZm3xRKE+++TI/-Tmp-/<p>USER = bshuler<p>_  
> = /Users/bshuler/Sites//env.pl<p>__CF_USER_TEXT_ENCODING =  
> 0x1F5:0:0<p>Connection closed by foreign host.
>
>
> On Jul 18, 2008, at 11:16 AM, Mark Smith wrote:
>
>> Could it be that the browser is expecting 2 crlfs after the header,  
>> while 2 lfs are all that's being written?
>>
>> Even if the perl script is producing crlfs, Rev tends to convert  
>> crlfs to lfs unless you specifically prevent it.
>>
>> Perhaps it would help if you inserted the line:
>>
>> replace lf with crlf in buffer
>>
>> before writing it out to the socket.
>>
>> I'm fairly sure that Rev would not be adding spurious headers - I  
>> think it's only  libUrl that would have that capability, and I'm  
>> sure it's better behaved than that, even if it's installed in your  
>> cgi setup.
>>
>> Best,
>>
>> Mark
>>
>> On 18 Jul 2008, at 15:27, Bert Shuler wrote:
>>> The header written by perl shows as html in the browser, because  
>>> rev somehow added a header.
>>>
>>>
>>> On Jul 18, 2008, at 10:21 AM, Mark Schonewille wrote:
>>>
>>>> Hi Bert,
>>>>
>>>> Maybe I don't understand what is going on without looking at your  
>>>> code. At which point do you see unwanted http headers? When you  
>>>> write data to perl or when you read the data into rev? Is it  
>>>> possible that Perl adds the headers, since you're using "print  
>>>> "Content-type: text/html\n\n";"? Maybe you want "print "Content-
>>>> type: text/plain\n\n";".
>>>>
>>>> --
>>>> Best regards,
>>>>
>>>> Mark Schonewille
>>>>
>>>> Economy-x-Talk Consulting and Software Engineering
>>>> http://economy-x-talk.com
>>>> http://www.salery.biz
>>>>
>>>> Benefit from our inexpensive hosting services. See http://economy-x-talk.com/server.html 
>>>>  for more info.
>>>>
>>>> On 18 jul 2008, at 16:05, Bert Shuler wrote:
>>>>
>>>>> ok, I thought that was only used when using the URL keyword.
>>>>> I am simply writing to a socket.
>>>>> How would rev even know I was intending to write http?
>>>>>
>>>>
>>>> _______________________________________________
>>>> use-revolution mailing list
>>>> [hidden email]
>>>> Please visit this url to subscribe, unsubscribe and manage your  
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>
>>>
>>> _______________________________________________
>>> use-revolution mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your  
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>> _______________________________________________
>> use-revolution mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: runrev adds http header for free?

Andre Garzia-3
Bert,

http://www.andregarzia.com/RevHTTP.zip lots of cgi demos and a web
server made in rev. All free and commented.

Cheers
andre

On Fri, Jul 18, 2008 at 12:44 PM, Bert Shuler <[hidden email]> wrote:

> That was the problem. Once I get the CGI gateway working ill post it
> again... just incase someone finds it useful.
>
> Thanks all!
>
> Bert
>
>
> On Jul 18, 2008, at 11:34 AM, Bert Shuler wrote:
>
>> Mark, I think your on to something.
>> I think my web browser is not recognizing my header, and live http headers
>> is lieing to me.
>>
>> I ran this test, and it seems to disprove the free runrev header idea.
>>
>>
>> telnet 127.0.0.1 8080
>> Trying 127.0.0.1...
>> Connected to localhost.
>> Escape character is '^]'.
>> GET /env.pl HTTP/1.1
>> Content-type: text/html
>>
>> <tt>
>> Apple_PubSub_Socket_Render = /tmp/launch-JAC787/Render<p>COMMAND_MODE =
>> legacy<p>DISPLAY = /tmp/launch-bf8cAs/:0<p>HOME = /Users/bshuler<p>LOGNAME =
>> bshuler<p>PATH = /usr/bin:/bin:/usr/sbin:/sbin<p>PWD =
>> /Applications/Revolution Studio/2.9.0-gm-1<p>SECURITYSESSIONID =
>> 620680<p>SHELL = /bin/bash<p>SHLVL = 1<p>SSH_AUTH_SOCK =
>> /tmp/launch-YZYPQ5/Listeners<p>TMPDIR =
>> /var/folders/B1/B1LJiAyjGNuOhekZm3xRKE+++TI/-Tmp-/<p>USER = bshuler<p>_ =
>> /Users/bshuler/Sites//env.pl<p>__CF_USER_TEXT_ENCODING =
>> 0x1F5:0:0<p>Connection closed by foreign host.
>>
>>
>> On Jul 18, 2008, at 11:16 AM, Mark Smith wrote:
>>
>>> Could it be that the browser is expecting 2 crlfs after the header, while
>>> 2 lfs are all that's being written?
>>>
>>> Even if the perl script is producing crlfs, Rev tends to convert crlfs to
>>> lfs unless you specifically prevent it.
>>>
>>> Perhaps it would help if you inserted the line:
>>>
>>> replace lf with crlf in buffer
>>>
>>> before writing it out to the socket.
>>>
>>> I'm fairly sure that Rev would not be adding spurious headers - I think
>>> it's only  libUrl that would have that capability, and I'm sure it's better
>>> behaved than that, even if it's installed in your cgi setup.
>>>
>>> Best,
>>>
>>> Mark
>>>
>>> On 18 Jul 2008, at 15:27, Bert Shuler wrote:
>>>>
>>>> The header written by perl shows as html in the browser, because rev
>>>> somehow added a header.
>>>>
>>>>
>>>> On Jul 18, 2008, at 10:21 AM, Mark Schonewille wrote:
>>>>
>>>>> Hi Bert,
>>>>>
>>>>> Maybe I don't understand what is going on without looking at your code.
>>>>> At which point do you see unwanted http headers? When you write data to perl
>>>>> or when you read the data into rev? Is it possible that Perl adds the
>>>>> headers, since you're using "print "Content-type: text/html\n\n";"? Maybe
>>>>> you want "print "Content-type: text/plain\n\n";".
>>>>>
>>>>> --
>>>>> Best regards,
>>>>>
>>>>> Mark Schonewille
>>>>>
>>>>> Economy-x-Talk Consulting and Software Engineering
>>>>> http://economy-x-talk.com
>>>>> http://www.salery.biz
>>>>>
>>>>> Benefit from our inexpensive hosting services. See
>>>>> http://economy-x-talk.com/server.html for more info.
>>>>>
>>>>> On 18 jul 2008, at 16:05, Bert Shuler wrote:
>>>>>
>>>>>> ok, I thought that was only used when using the URL keyword.
>>>>>> I am simply writing to a socket.
>>>>>> How would rev even know I was intending to write http?
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> use-revolution mailing list
>>>>> [hidden email]
>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>> subscription preferences:
>>>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>>
>>>>
>>>> _______________________________________________
>>>> use-revolution mailing list
>>>> [hidden email]
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>
>>> _______________________________________________
>>> use-revolution mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



--
http://www.andregarzia.com All We Do Is Code.
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution