1. CGI and euc
- Posted by bugmagnet Jan 14, 2013
- 2460 views
One should read the friendly manual, or at least the friendly wiki, especially the bit that says
On Windows you should always use eui.exe to run CGI programs, or you may have problems with standard output.
because even when you run a script through euc, the binary doesn't behave itself. In my case, the binary sat in memory chewing 25% of CPU. Eventually, there were four in there chewing 100% of my CPU.
Now there's no Euphoria binaries in memory and I'm seriously considering using some other compiler for CGI EXEs. (Yes, I know I don't have to do CGI EXEs but I want to.)
Can someone tell me what I have to do to build a Euphoria EXE that will work as a CGI?
Irritated, irate and irrationally yours,
Bugmagnet.
2. Re: CGI and euc
- Posted by jimcbrown (admin) Jan 14, 2013
- 2434 views
One should read the friendly manual, or at least the friendly wiki, especially the bit that says
On Windows you should always use eui.exe to run CGI programs, or you may have problems with standard output.
This just refers to using eui.exe over euiw.exe (as euiw.exe typically doesn't write stuff to standard output).
because even when you run a script through euc, the binary doesn't behave itself.
Remember that you have to pass the -con option to euc, or else the binaries will be like euiw.exe (unable to write to standard output).
In my case, the binary sat in memory chewing 25% of CPU. Eventually, there were four in there chewing 100% of my CPU.
Now there's no Euphoria binaries in memory and I'm seriously considering using some other compiler for CGI EXEs. (Yes, I know I don't have to do CGI EXEs but I want to.)
Can someone tell me what I have to do to build a Euphoria EXE that will work as a CGI?
Irritated, irate and irrationally yours,
Bugmagnet.
What version of Euphoria and which C compiler (and the C compiler version) did you use to build?
3. Re: CGI and euc
- Posted by bugmagnet Jan 14, 2013
- 2424 views
Remember that you have to pass the -con option to euc, or else the binaries will be like euiw.exe (unable to write to standard output).
Did that
What version of Euphoria and which C compiler (and the C compiler version) did you use to build?
Euphoria to C Translator v4.0.5
Windows, Using Managed Memory
Revision Date: 2012-10-11, Id: 362497032f33
Open Watcom C/C++ Version 1.9
4. Re: CGI and euc
- Posted by jimcbrown (admin) Jan 14, 2013
- 2434 views
What version of Euphoria and which C compiler (and the C compiler version) did you use to build?
Euphoria to C Translator v4.0.5
Windows, Using Managed Memory
Revision Date: 2012-10-11, Id: 362497032f33
Open Watcom C/C++ Version 1.9
Hmm. There are memory leaks, but afaik no known issues that'd cause high cpu usage like that.
There are three known memory leaks in that version of Euphoria:
http://openeuphoria.org/ticket/801.wc Translated program with insert() in a for-loop expansively consumes memory
http://openeuphoria.org/ticket/799.wc gets() memory leak
http://openeuphoria.org/ticket/830.wc replace() memory leak
(Worse, the replace() memory leak has not been solved yet, even in the bleeding edge trunk.)
And that's assuming you haven't found a new one. (Which you probably have.)
Can you release some example code that demonstrates the problem?
5. Re: CGI and euc
- Posted by bugmagnet Jan 14, 2013
- 2418 views
I haven't been able to reproduce the 25% CPU utilisation. Nevertheless, here's code, html, and part of the Chrome session:
-- suck.ex (suck eggs) --include std/net/url.e puts(1, "HTTP/1.0 200 OK\r\nContent-type:text/javascript\r\n\r\n" ) puts(1, "console.log('foo');\r\n")
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <script src="http://localhost:8088/cgi/suck.exe?argument=nothing particular" type="text/javascript"></script> </head> <body id="top"> </body> </html>
suck.exe?argument=nothing%20particular GET (failed) Pending quux.html:4 13B 358ms
6. Re: CGI and euc
- Posted by jimcbrown (admin) Jan 14, 2013
- 2415 views
I haven't been able to reproduce the 25% CPU utilisation. Nevertheless, here's code, html, and part of the Chrome session:
What is this code meant to demonstrate, if not the 25% CPU utilisation?
7. Re: CGI and euc
- Posted by bugmagnet Jan 14, 2013
- 2407 views
I haven't been able to reproduce the 25% CPU utilisation. Nevertheless, here's code, html, and part of the Chrome session:
What is this code meant to demonstrate, if not the 25% CPU utilisation?
Umm ... the fact that it doesn't work; that trying to write a CGI EXE in Euphoria is a waste of hair.
Bugmagnet
8. Re: CGI and euc
- Posted by jimcbrown (admin) Jan 14, 2013
- 2407 views
I haven't been able to reproduce the 25% CPU utilisation. Nevertheless, here's code, html, and part of the Chrome session:
What is this code meant to demonstrate, if not the 25% CPU utilisation?
Umm ... the fact that it doesn't work; that trying to write a CGI EXE in Euphoria is a waste of hair.
Bugmagnet
Well, I didn't have quick access to a Windoze HTTP server with CGI set up, but I did test this on a Linux/GNU Apache 2 server.
Apache first complained that "HTTP/1.0 200 OK" was a bad/invalid header - giving me a 500 Internal Error on the web browser, but after I took the "HTTP/1.0 200 OK\r\n" out from the first puts(), it worked fine and I got a text file with the following contents:
console.log('foo');
Are you seeing different behavior?
9. Re: CGI and euc
- Posted by bugmagnet Jan 14, 2013
- 2392 views
Oh, and I ... err ... remembered why the 25% utilisation: I had
puts(1, gets(0))
in earlier versions of the code.
Blushingly,
Bugmagnet
10. Re: CGI and euc
- Posted by bugmagnet Jan 14, 2013
- 2400 views
Are you seeing different behavior?
I'm seeing an absence of behaviour. The line from the Chrome "Network" tab in a previous posting shows that the code isn't working. Now whether that means it's not outputting anything or not letting go or something, I can't tell. But Chrome tries to render the rest of the page and the cgi just sits there until it times out.
Bugmagnet.
11. Re: CGI and euc
- Posted by jimcbrown (admin) Jan 14, 2013
- 2428 views
Are you seeing different behavior?
I'm seeing an absence of behaviour. The line from the Chrome "Network" tab in a previous posting shows that the code isn't working. Now whether that means it's not outputting anything or not letting go or something, I can't tell. But Chrome tries to render the rest of the page and the cgi just sits there until it times out.
Bugmagnet.
This happens even after you remove the "HTTP/1.0 200 OK\r\n" bit?
What do your HTTP server logs say? (What HTTP server are you running with?)
You've tested this interpreted, and it works? Have you tried binding?
12. Re: CGI and euc
- Posted by CoJaBo2 Jan 14, 2013
- 2362 views
HTTP/1.0 200 OKCGI is not HTTP; This should be:
Status: 200 OK
There should be a space after the
Content-Type: text/javascript
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">HTML Transitional has been obsolete for quite a number of years; Use HTML5- <!DOCTYPE html>
<script src="http://localhost:8088/cgi/suck.exe?argument=nothing particular" type="text/javascript"></script>Spaces aren't valid in URLs; encode them as + or %20.
Edit by euphoric: two dots are a colon
13. Re: CGI and euc
- Posted by useless_ Jan 14, 2013
- 2374 views
HTTP/1.0 200 OKCGI is not HTTP; This should be:
Status: 200 OK
According to me and O'Reilly, the CGI script is perfectly within it's limits to make a complete HTTP header to send to the httpd. Technically, HTTP/1.0 is obsolete, and yet people still use it. And while i am mentioning O'Reilly, here's a quote from one of his books:
print "$server_protocol 200 OK", "\n"; print "Server: $server_software", "\n"; print "Content-type: text/plain", "\n\n"; print "OK, Here I go. I am going to count from 1 to 50!", "\n";Note the lack of \r at the end of header lines or between the header and the body. This is why i say Euphoria should be adaptive or smart when parsing headers, and not enforce the rules du jour. Basically, whatever the first line ends with, that's what you are going to get as a line/header terminator, and i don't care if it's "right" or not, it's what is.
There should be a space after the semicolon in headers:
Content-Type: text/javascript
Any number of spaces, even, from RFC2616: "The field value MAY be preceded by any amount of LWS, though a single SP is preferred.". Use only one to make CoBaJo happy.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">HTML Transitional has been obsolete for quite a number of years; Use HTML5- <!DOCTYPE html>
This site uses Transitional, so does my site. If the page is compliant to what's stated, and you simply change that header, your page is likely not compliant to HTML5 and will display wrong.
<script src="http://localhost:8088/cgi/suck.exe?argument=nothing particular" type="text/javascript"></script>Spaces aren't valid in URLs; encode them as + or %20.
I have links such as
<a href="canoe pontoons.html">and they work fine. The browser handles it. It's not illegal to have spaces until the space is actually sent to the server to get a page or post data. As general good programmng style, you should encode just prior to sending, as a single point in the program, for everything (not in the page body) being sent, else you could have a program flow bug where the url gets encoded twice. I've seen it happen.
And by the way, i also will object to http.e transparently following redirects, perhaps i don't want to goto the new url, the programmer should see the redirect and decide yes/no to send the new url to http.e for a second fetch.
useless
14. Re: CGI and euc
- Posted by CoJaBo2 Jan 14, 2013
- 2375 views
According to me and O'Reilly, the CGI script is perfectly within it's limits to make a complete HTTP header to send to the httpd. Technically, HTTP/1.0 is obsolete, and yet people still use it. And while i am mentioning O'Reilly, here's a quote from one of his books:
print "$server_protocol 200 OK", "\n"; print "Server: $server_software", "\n"; print "Content-type: text/plain", "\n\n"; print "OK, Here I go. I am going to count from 1 to 50!", "\n";
That seems strange; one of the previous posts implied that actually was the cause of the issue. I've never seen nor tested it myself.
This statement from the same chapter may imply it might not be supported by modern servers-
How does the server know if the CGI program has output a partial or a complete HTTP header without "looking" at it? It depends on which server you use. On the NCSA and CERN servers, programs that output complete headers must start with the "nph-" prefix (e.g., nph-test.pl), which stands for Non-Parsed Header.
Note the lack of \r at the end of header lines or between the header and the body. This is why i say Euphoria should be adaptive or smart when parsing headers, and not enforce the rules du jour. Basically, whatever the first line ends with, that's what you are going to get as a line/header terminator, and i don't care if it's "right" or not, it's what is.
I have yet to witness a server not translate \n to \r\n when going from CGI to HTTP, as required by the HTTP spec. \n as a linebreak actually seems to be legal in CGI, yet I've seen no case where it ever makes it to the browser that way. If you know one that does, by all means, post it.
There should be a space after the semicolon in headers:
Content-Type: text/javascript
Any number of spaces, even, from RFC2616: "The field value MAY be preceded by any amount of LWS, though a single SP is preferred.". Use only one *to make CoBaJo happy.
I didn't say that, the spec did. You quoted it yourself- "a single SP is preferred".
To quote the same RFC: "Applications ought to follow "common form", where one is known or indicated, when generating HTTP constructs, since there might exist some implementations that fail to accept anything beyond the common forms."
Strictly speaking, LWS also includes linebreaks, which would complicate parsing headers.. However, again, I've never witnessed any server ignore the recommendation to "follow a common form". CGI headers in an uncommon form are corrected before being transmitted.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">HTML Transitional has been obsolete for quite a number of years; Use HTML5- <!DOCTYPE html>
This site uses Transitional, so does my site. If the page is compliant to what's stated, and you simply change that header, your page is likely not compliant to HTML5 and will display wrong.
"Transitional" was for transitioning from HTML 3 to HTML 4; we're now on HTML5. Transitional is fine, if you wrote the page in 1999. Bugmagnet's code, presumably, was made in 2013, and thus should be using HTML5.
As an aside, I'm not sure why openeuphoria.org is using Transitional; at the very least, it should have been using Strict; it was probably copy-paste from an out-of-date tutorial. Theres no mandate to update old pages to HTML5, but note that doing so would not break anything.
<script src="http://localhost:8088/cgi/suck.exe?argument=nothing particular" type="text/javascript"></script>Spaces aren't valid in URLs; encode them as + or %20.
I have links such as
<a href="canoe pontoons.html">and they work fine. The browser handles it. It's not illegal to have spaces until the space is actually sent to the server to get a page or post data.
The browser is required to handle syntax errors; that doesn't make them valid.
Error Line 11, Column 100: Bad value http://localhost:8088/cgi/suck.exe?argument=nothing particular for attribute src on element script: Whitespace in query component. Use %20 in place of spaces. …088/cgi/suck.exe?argument=nothing particular" type="text/javascript"></script> Syntax of IRI reference: Any URL. For example: /hello, #canvas, or http://example.org/. Characters should be represented in NFC and spaces should be escaped as %20.
As general good programmng style, you should encode just prior to sending, as a single point in the program, for everything (not in the page body) being sent, else you could have a program flow bug where the url gets encoded twice. I've seen it happen.
In the case of writing HTML, this point would be when the data is output to the browser. The browser itself won't re-encode the URL unless it contains invalid characters already.
And by the way, i also will object to http.e transparently following redirects, perhaps i don't want to goto the new url, the programmer should see the redirect and decide yes/no to send the new url to http.e for a second fetch.
I noted this as well-
There should probably be a parameter "redirect_limit" or similar (defaulting to, say, 10) to specify how many it should follow (which, if set to 0, would either keep the current behavior or just error out). It may also be wise to hardcode an absolute maximum for that value as well.
15. Re: CGI and euc
- Posted by useless_ Jan 14, 2013
- 2379 views
You know, i am not going to keep fixing the creole paragraphing and attributions below.......................
According to me and O'Reilly, the CGI script is perfectly within it's limits to make a complete HTTP header to send to the httpd. Technically, HTTP/1.0 is obsolete, and yet people still use it. And while i am mentioning O'Reilly, here's a quote from one of his books:
print "$server_protocol 200 OK", "\n"; print "Server: $server_software", "\n"; print "Content-type: text/plain", "\n\n"; print "OK, Here I go. I am going to count from 1 to 50!", "\n";
That seems strange; one of the previous posts implied that actually was the cause of the issue. I've never seen nor tested it myself.
This statement from the same chapter may imply it might not be supported by modern servers-
How does the server know if the CGI program has output a partial or a complete HTTP header without "looking" at it? It depends on which server you use. On the NCSA and CERN servers, programs that output complete headers must start with the "nph-" prefix (e.g., nph-test.pl), which stands for Non-Parsed Header.
Note the lack of \r at the end of header lines or between the header and the body. This is why i say Euphoria should be adaptive or smart when parsing headers, and not enforce the rules du jour. Basically, whatever the first line ends with, that's what you are going to get as a line/header terminator, and i don't care if it's "right" or not, it's what is.
I have yet to witness a server not translate \n to \r\n when going from CGI to HTTP, as required by the HTTP spec. \n as a linebreak actually seems to be legal in CGI, yet I've seen no case where it ever makes it to the browser that way. If you know one that does, by all means, post it.
AGAIN, i am not logging all the various headers formats i have run across. My goal was to get the webpage, not document how it was sent.
There should be a space after the semicolon in headers:
Content-Type: text/javascript
Any number of spaces, even, from RFC2616: "The field value MAY be preceded by any amount of LWS, though a single SP is preferred.". Use only one *to make CoBaJo happy.
I didn't say that, the spec did. You quoted it yourself- "a single SP is preferred".
To quote the same RFC: "Applications ought to follow "common form", where one is known or indicated, when generating HTTP constructs, since there might exist some implementations that fail to accept anything beyond the common forms."
Right, "preferred" and "common form", so do not hardcode Eu to look for only one space and crash if zero or two are found.
Strictly speaking, LWS also includes linebreaks, which would complicate parsing headers.. However, again, I've never witnessed any server ignore the recommendation to "follow a common form". CGI headers in an uncommon form are corrected before being transmitted.
Unless the header is built by the CGI app, then it is sent as the httpd recieves it.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">HTML Transitional has been obsolete for quite a number of years; Use HTML5- <!DOCTYPE html>
This site uses Transitional, so does my site. If the page is compliant to what's stated, and you simply change that header, your page is likely not compliant to HTML5 and will display wrong.
"Transitional" was for transitioning from HTML 3 to HTML 4; we're now on HTML5. Transitional is fine, if you wrote the page in 1999. Bugmagnet's code, presumably, was made in 2013, and thus should be using HTML5.
As an aside, I'm not sure why openeuphoria.org is using Transitional; at the very least, it should have been using Strict; it was probably copy-paste from an out-of-date tutorial. Theres no mandate to update old pages to HTML5, but note that doing so would not break anything.
<script src="http://localhost:8088/cgi/suck.exe?argument=nothing particular" type="text/javascript"></script>Spaces aren't valid in URLs; encode them as + or %20.
I have links such as
<a href="canoe pontoons.html">and they work fine. The browser handles it. It's not illegal to have spaces until the space is actually sent to the server to get a page or post data.
The browser is required to handle syntax errors; that doesn't make them valid. [/quote]
[/quote]
[/quote]
[/quote]
I wasn't discussing browsers, i was discussing a Eu CGI app sending urls in plain un-escaped text to anything. My Eu code can read plain text in webpages and decide to follow or not, escape or not, and my choices of browsers behave well also. I am not changing anything to suit you.
Error Line 11, Column 100: Bad value http://localhost:8088/cgi/suck.exe?argument=nothing particular for attribute src on element script: Whitespace in query component. Use %20 in place of spaces. …088/cgi/suck.exe?argument=nothing particular" type="text/javascript"></script> Syntax of IRI reference: Any URL. For example: /hello, #canvas, or http://example.org/. Characters should be represented in NFC and spaces should be escaped as %20.
As general good programmng style, you should encode just prior to sending, as a single point in the program, for everything (not in the page body) being sent, else you could have a program flow bug where the url gets encoded twice. I've seen it happen.
In the case of writing HTML, this point would be when the data is output to the browser. The browser itself won't re-encode the URL unless it contains invalid characters already. [/quote] [/quote]
[/quote]
[/quote]
[/quote]
I thought we were talking about Euphoria CGI and Euphoria page fetching, i don't care what a browser will or won't or when do. Your Eu code should do whatever, then call url_encode() then call get_url(). Or whatever they are called now.
And by the way, i also will object to http.e transparently following redirects, perhaps i don't want to goto the new url, the programmer should see the redirect and decide yes/no to send the new url to http.e for a second fetch.
I noted this as well-
There should probably be a parameter "redirect_limit" or similar (defaulting to, say, 10) to specify how many it should follow (which, if set to 0, would either keep the current behavior or just error out). It may also be wise to hardcode an absolute maximum for that value as well.
[/quote]
It should default to NOT following a redirect. A server responce should be returned to the programmer for due consideration.
useless
16. Re: CGI and euc
- Posted by bugmagnet Jan 14, 2013
- 2321 views
Works with this:
<html> <head> <script src="http://localhost:8088/cgi/suck.exe?argument=nothing%20particular" type="text/javascript"></script> </head> <body> </body> </html>
-- suck.ex (suck eggs) --puts(1, "HTTP/1.0 200 OK\r\nContent-type:text/javascript\r\n\r\n" ) puts(1, "Content-Type: text/javascript\r\n\r\n" ) puts(1, "console.log('QUERY_STRING=" & getenv("QUERY_STRING") & "');\r\n")
And the console in Chrome says
QUERY_STRING=argument=nothing%20particular
So what's the issue with "HTTP/1.0 200 OK\r\n"?
Bugmagnet
17. Re: CGI and euc
- Posted by jimcbrown (admin) Jan 14, 2013
- 2332 views
Works with this:
<html> <head> <script src="http://localhost:8088/cgi/suck.exe?argument=nothing%20particular" type="text/javascript"></script> </head> <body> </body> </html>
-- suck.ex (suck eggs) --puts(1, "HTTP/1.0 200 OK\r\nContent-type:text/javascript\r\n\r\n" ) puts(1, "Content-Type: text/javascript\r\n\r\n" ) puts(1, "console.log('QUERY_STRING=" & getenv("QUERY_STRING") & "');\r\n")
And the console in Chrome says
QUERY_STRING=argument=nothing%20particular
So what's the issue with "HTTP/1.0 200 OK\r\n"?
Bugmagnet
I'm not sure. It's possible that this is just an Apache thing (the Apache web server might want to generate and send that header on its own), or maybe it's a configuration setting somewhere (like a passthru mode) that determines whether or not Apache will accept that line.
18. Re: CGI and euc
- Posted by jimcbrown (admin) Jan 14, 2013
- 2340 views
So what's the issue with "HTTP/1.0 200 OK\r\n"?
Bugmagnet
I'm not sure. It's possible that this is just an Apache thing (the Apache web server might want to generate and send that header on its own), or maybe it's a configuration setting somewhere (like a passthru mode) that determines whether or not Apache will accept that line.
On further investigation, this may simply be a long-standing Apache 2.x bug: https://issues.apache.org/bugzilla/show_bug.cgi?id=22898
19. Re: CGI and euc
- Posted by bugmagnet Jan 14, 2013
- 2306 views
This works
-- suck.ex (suck eggs) include std/net/url.e include std/filesys.e include std/dll.e include std/machine.e constant KEYB = 0, SCREEN = 1 constant TRUE = 1, FALSE = 0 -- set up C routines that we need: atom kernel32 = open_dll("kernel32.dll") if kernel32 = 0 then puts(SCREEN, "Can't open kernel32.dll!\n") abort(1) end if integer GetStdHandle = define_c_func(kernel32, "GetStdHandle", {C_LONG}, C_INT) if GetStdHandle = -1 then puts(1, "Can't find GetStdHandle\n") abort(1) end if integer WriteFile = define_c_func(kernel32, "WriteFile", {C_POINTER, C_POINTER, C_INT, C_POINTER, C_POINTER}, C_INT) if WriteFile = -1 then puts(1, "Can't find WriteFile\n") abort(1) end if sequence code = "HTTP/1.1 200 OK\r\n" & "Cache-Control: no-cache\r\n" & "Content-type:text/javascript\r\n" & "\r\n" & "console.log('" & getenv("QUERY_STRING") & "');\r\n" atom string_pointer = allocate(length(code)+1) poke(string_pointer, code & 0) atom byref = allocate(4) poke4(byref, 0) atom z = c_func(GetStdHandle,{-11}) atom x = c_func(WriteFile, {z, string_pointer, length(code), byref, 0}) free(string_pointer)
This doesn't work
-- suck.ex (suck eggs) puts(1, "HTTP/1.1 200 OK\r\n" ) puts(1, "Content-Type: text/javascript\r\n" ) puts(1, "Cache-Control: no-cache\r\n") puts(1, "\r\n" ) puts(1, "console.log('QUERY_STRING=" & getenv("QUERY_STRING") & "');\r\n")
I'm using HTTP 1.1 in both cases. The "pure" Euphoria fails. The version using Win32 API works. Weird.
Bugmagnet.
20. Re: CGI and euc
- Posted by CoJaBo2 Jan 14, 2013
- 2301 views
So what's the issue with "HTTP/1.0 200 OK\r\n"?
The issue with it is that that line is an HTTP header, while your program needs to be outputting CGI headers. It should be "Status: 200 OK\r\n" instead.
(Yes, it looks like, back in the nineties, NCSA, CERN, and Apache 1.0 had a feature to send raw HTTP headers over CGI; Apache 2.2, however, no longer supports this- you have to use the CGI syntax)
I wasn't discussing browsers, i was discussing a Eu CGI app sending urls in plain un-escaped text to anything. My Eu code can read plain text in webpages and decide to follow or not, escape or not, and my choices of browsers behave well also. I am not changing anything to suit you.
This thread is not about your app; it is about bugmagnet's app, which outputs HTML. In HTML, browser or no browser, links have to be escaped.
It should default to NOT following a redirect. A server responce should be returned to the programmer for due consideration.
The server response is often empty; in cases it is not, it is a fallback for HTTP/0.9 browsers, which don't support redirects. It makes sense that Eu should default to following them, as thats whats going to be needed in 95% of cases. The remaining times would be exceptions- apps that prompt the user to confirm following a redirect, apps that debug HTTP/status information (for the latter case, Eu really ought to support HEAD as well..).
21. Re: CGI and euc
- Posted by mattlewis (admin) Jan 14, 2013
- 2308 views
AGAIN, i am not logging all the various headers formats i have run across. My goal was to get the webpage, not document how it was sent.
That's fine, but if you want others to change their software to match what you've seen, then it's important to be able to communicate that and ideally identify how to reproduce it. When you cannot or refuse to help with the reproduction, you should not be surprised that changes are not made.
Matt
22. Re: CGI and euc
- Posted by useless_ Jan 14, 2013
- 2319 views
- Last edited Jan 15, 2013
AGAIN, i am not logging all the various headers formats i have run across. My goal was to get the webpage, not document how it was sent.
That's fine, but if you want others to change their software to match what you've seen, then it's important to be able to communicate that and ideally identify how to reproduce it. When you cannot or refuse to help with the reproduction, you should not be surprised that changes are not made.
Matt
You expect i'd log all the site headers i have recieved over the last 16 years? At some times, for months, i was hitting 2 to 5 urls per second on three computers at once. Pic of one:
http://designerthinking.com/images/busy/DESKTOP3.GIF
Each of those dosboxes are hitting different sites. No, i was not going to save over 4000 headers per hour for examination later.
useless
23. Re: CGI and euc
- Posted by useless_ Jan 14, 2013
- 2282 views
- Last edited Jan 15, 2013
I wasn't discussing browsers, i was discussing a Eu CGI app sending urls in plain un-escaped text to anything. My Eu code can read plain text in webpages and decide to follow or not, escape or not, and my choices of browsers behave well also. I am not changing anything to suit you.
This thread is not about your app; it is about bugmagnet's app, which outputs HTML. In HTML, browser or no browser, links have to be escaped.
I wasn't trying to help with my app, i was bugmagnet's app. But my app runs fine in contradiction to how you say it should be. HTML is plain text with SGML tags, i've used SGML before Win3 came out. The browser, or bugmagnet's app, should accept the plain text, and make it compliant to what the httpd is expecting before it is sent to the server. But the plain text, as recieved in the body of the HTML, need not be pre-encoded by the httpd. If you type in an url with spaces in it to a browser, or to an Eu app, it's THEN the browser or the Eu app's job to encode it before sending it. Same with the urls in the webpage body.
useless
24. Re: CGI and euc
- Posted by CoJaBo2 Jan 14, 2013
- 2282 views
I wasn't trying to help with my app, i was bugmagnet's app. But my app runs fine in contradiction to how you say it should be. HTML is plain text with SGML tags, i've used SGML before Win3 came out. The browser, or bugmagnet's app, should accept the plain text, and make it compliant to what the httpd is expecting before it is sent to the server. But the plain text, as recieved in the body of the HTML, need not be pre-encoded by the httpd. If you type in an url with spaces in it to a browser, or to an Eu app, it's THEN the browser or the Eu app's job to encode it before sending it. Same with the urls in the webpage body.
I'm not quite sure what your argument here is; I pointed out that URLs cannot have spaces and that this is invalid in HTML, to someone who may well have been unaware of this. I quoted the error from the official W3 validator stating this. Yes, it works, but it is wrong. It is not generally acceptable practice to recommend things to others that are clearly wrong. Sorry about that- blame the W3 if you must.
25. Re: CGI and euc
- Posted by jimcbrown (admin) Jan 15, 2013
- 2275 views
You expect i'd log all the site headers i have recieved over the last 16 years?
No, just the ones that caused problems. Or at least the URLs which caused enough problems that you had to go back and change your code. (You imply that you did see a not-super-strictly-rfc-compliant header at some point in time and that it made your code crash or something, requiring you to change it - otherwise, how would you even know that this was more than a purely hypothetical problem?)
No, i was not going to save over 4000 headers per hour for examination later.
That's under 10 megabytes of data a day - so doing this for one day doesn't seem unreasonable.
But, there's no great hurry on this either. If it takes you more than a couple of years to get enough spare time to track down an example, the world is unlikely to end in the meantime. (Although if the problem was very widespread, I'd expect someone else to report details on it long before that.)
Even then, I feel that it makes sense to apply the "m_sabal standard" here.
26. Re: CGI and euc
- Posted by bugmagnet Jan 15, 2013
- 2316 views
I am pleased to report that this now works:
-- suck.ex (suck eggs) puts(1, "Status: 200 OK\r\n" ) puts(1, "Content-Type: text/javascript\r\n" ) puts(1, "Cache-Control: no-cache\r\n") puts(1, "\r\n" ) puts(1, "console.log('QUERY_STRING=" & getenv("QUERY_STRING") & "');\r\n")
Note the change in the first line to "Status: 200 OK" which does appear to have been the main issue all along. Kudos to CoJaBo2 for noting this quite early in the piece.
Thanks to all who contributed.
Bugmagnet.