473,666 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting the "href" in a stylesheet link to an executable script?

I recently noticed the stylesheet link in an html page had the href set
to a PHP script, as in:

<LINK REL="stylesheet " href="some_css. php" type="text/css">

Presumably the file being referenced was actually an executable PHP
script and not a css file that happened to have a .php extension.
Based on that assumption, I tried the same thing with a Perl script
(the webserver being tested happens to have mod_perl installed but not
mod_php), as in:

<LINK REL="stylesheet " href="dyn_css.p l" type="text/css">

The result was a server error with the error_log entry:

Bareword found where operator expected at
/srv/www/plwa/test/dyn_css.html line 4, near ""dyn_css.p l" type"
(Missing operator before type?)

The Perl script returns a simple stylesheet object...

body {
background-color: #000000;
font-family: Verdana;
font-size: 10px;
color: #FFFFFF;
border: 5px solid #AAAAAA;
}

.... which is exactly what the aforementioned PHP script returned when
retrieved by wget.

So, the question is: can an executable script be referenced in a
stylesheet link? If so, can anyome comment on why I might be getting
the above error from the server?

O/S: SuSE Linux 8.x
Server: Apache 2.x with mod_perl (.pl files associated with the
perl-script handler using an AddHandler statement).

Thanks!
--
Dave H.

Sep 16 '05 #1
12 3155
"Dave Hammond" <dh****@gmail.c om> wrote in news:1126876909 .069914.315680
@f14g2000cwb.go oglegroups.com:
So, the question is: can an executable script be referenced in a
stylesheet link? If so, can anyome comment on why I might be getting
the above error from the server?


This is quite interesting if it can be done ... have you looked into what
content-type the server is returning for the php file? Use wget to get the
headers returned (wget -S). Most likely they have set the content-type to
text/css and not text/html which is usual for php scripts.

In PHP you would change the header something like this:
header("Content-Type: text/css")
before any content is output to the client.

It might be what they are doing.

Stian
Sep 16 '05 #2
A good hypothesis, but according to wget -S the type being returned is
text/html:

HTTP request sent, awaiting response...
1 HTTP/1.1 200 OK
2 Date: Fri, 16 Sep 2005 12:45:45 GMT
3 Server: Apache/2.0.46 (Red Hat)
4 Accept-Ranges: bytes
5 X-Powered-By: PHP/4.3.2
6 Connection: close
7 Content-Type: text/html; charset=UTF-8

[ <=> ] 867 846.68K/s
10:55:29 (846.68 KB/s) - `gp_css.php' saved [867]

--
Dave H.

Sep 16 '05 #3
Dave Hammond wrote:

<LINK REL="stylesheet " href="dyn_css.p l" type="text/css">

The result was a server error with the error_log entry:

Bareword found where operator expected at
/srv/www/plwa/test/dyn_css.html line 4, near ""dyn_css.p l" type"
(Missing operator before type?)

Is your server configured to run perl on files that have the extension
"pl"?
--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Sep 16 '05 #4
Jim Moe <jm************ ***@sohnen-moe.com> writes:
Dave Hammond wrote:
<LINK REL="stylesheet " href="dyn_css.p l" type="text/css">
The result was a server error with the error_log entry:
Bareword found where operator expected at
/srv/www/plwa/test/dyn_css.html line 4, near ""dyn_css.p l" type"
(Missing operator before type?)

Is your server configured to run perl on files that have the
extension "pl"?


It obviously is, given that the above error is a Perl syntax error. ;-)

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Sep 16 '05 #5
I thought that "bareword" phrase looked familiar ;-)

Of course, now the question is why, when run from the apache mod_perl
handler, does it generate the syntax error? Here's the script in
question:

# cat dyn_css.pl
#!/usr/bin/perl

print <<EOFEOF;
Content-type: text/html

body {
background-color: #000000;
font-family: Verdana;
font-size: 10px;
color: #FFFFFF;
border: 5px solid #AAAAAA;
}
EOFEOF

Not exactly brain surgery :) And, of course it passes perl -cw syntax
checking and runs just fine from the command line. So, why does it
generate the error?

-Dave H.

Sep 19 '05 #6
Dave Hammond wrote:

print <<EOFEOF;
Content-type: text/html

body {

Not exactly brain surgery :) And, of course it passes perl -cw syntax
checking and runs just fine from the command line. So, why does it
generate the error?

HTTP expects <CR><LF>, not just <LF>. If you are serving from a *nix
system, perhaps it is just sending a simple newline (<LF>) as a linebreak?

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Sep 19 '05 #7
This is a re-post... not sure why it didn't show up the first time
around. Please ignore this if it ends up to be a dupe...

I should have realized that the "Bareword found" error looked familiar.
Of course, now the question is why is Perl complaining. The script is
trivial; it passes the Perl -cw syntax check and outputs the expected
text. Here is the source:

#!/usr/bin/perl

print <<EOFEOF;
Content-type: text/html

body {
background-color: #000000;
font-family: Verdana;
font-size: 10px;
color: #FFFFFF;
border: 5px solid #AAAAAA;
}
EOFEOF

This seems to prove that Apache is attempting to call Perl, although
exactly how is not clear. Is there any way to log the syntax of the
call that Apache is making to Perl?

-Dave H.

Sep 19 '05 #8

On Mon, 19 Sep 2005, Jim Moe wrote:
Dave Hammond wrote:

print <<EOFEOF;
Content-type: text/html
The content looks more like text/css to me!!!
body {

Not exactly brain surgery :) And, of course it passes perl -cw syntax
checking and runs just fine from the command line. So, why does it
generate the error?
HTTP expects <CR><LF>, not just <LF>.


I thought this was meant to be a CGI script? As such it's entitled to use
its local newline convention. It's the job of the web server to turn
valid parsed-headers CGI output (per the CGI RFC) into valid HTTP protocol
(per the HTTP RFC, 2616), and that includes newlines conversion as
necessary.
If you are serving from a *nix system,
perhaps it is just sending a simple newline (<LF>) as a linebreak?


Very likely, but unless it's a no-parse-headers script (which it isn't
going to be unless the O.P has gone to special effort to make it so) then
that should be no problem.

But I don't look any more closely at Perl scripts until they've been
properly tested per the posting guidelines of comp.lang.perl. misc.

Sep 19 '05 #9
On 19 Sep 2005, Dave Hammond wrote:
Organization: http://groups.google.com
User-Agent: G2/0.2
The innocents abroad.
body {
font-family: Verdana;
font-size: 10px;


DO NOT specify a body font-size - not in px anyway!

--
Top-posting.
What's the most irritating thing on Usenet?

Sep 20 '05 #10

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

Similar topics

3
3749
by: jwayne | last post by:
I'm trying to implement a navigation bar with multiple a href classes. The following example works exactly as I want it to, but for Internet Explorer only. Firefox does not indent each link. http://jonathanwayne.com/test/test.html Here's the relevant snippet: <div class="nav"> <a href="#">link 0</a>
7
3006
by: Nathan | last post by:
I've been reading a bit about proper ways to use <a> tags to launch javascript functions, but I'm still not clear on one issue. I understand it is common to create a link in HTML such as <a href="javascriptless.html"> then override the href in java by setting it to href='#', and setting an onclick function. The problem I'm having is that when I click on the # link, the browser scrolls to the top of the page. Is there a way to
10
3731
by: Gernot Frisch | last post by:
Hi, I'm currently writing: <span onclick="window.open(...);">Klick Here</span> but I want to use the <a href> for this, since it is defined in the css script the way I want my link to open. Now, if I use a href, the href will be executed as well. What can I du in order to make the href not execute if javascript is enabled?
6
4679
by: kelvlam | last post by:
Hello, I'm a new begininer with JavaScript. I'm trying to figure out which is the best approach, and to understand the differences between them. I have a <Aelement that's suppose to either launch a popup window, or it will link you to some dynamic created page. I have declared a global JavaScript function
19
2848
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - I have <a href="javascript:somefunction()"what ... ? ----------------------------------------------------------------------- Whatever the rest of your question, this is generally a very bad use of the javascript pseudo protocol. It was designed so that a function could return a new page. For example: `` javascript:"<p>Hello</p>" ''. Using it simply to...
3
2029
by: PJ6 | last post by:
Embedded javascript can be served from a DLL with an include that uses a special URL generated by the Page.ClientScript.GetWebResourceUrl method at runtime. For example: <script src="/DEV-WEB/WebResource.axd?d=Fzr7sc4IZAELIE4FCpgaNkpd1YgQqgig1EfiFj9_b7U1&t=633202779231250800"type="text/javascript"></script> .... so can style sheets: <link rel="stylesheet" type="text/css"
5
8672
by: dangt85 | last post by:
Hello, I have the following page: ... <style type="text/css"> body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
0
8454
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8362
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
8878
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...
0
8785
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8560
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
5671
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
4200
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...
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1778
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.