Bug 9906 - error parsing config file
Summary: error parsing config file
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: phhttpd
Version: 6.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Zach Brown
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-03-01 21:15 UTC by Brock Organ
Modified: 2015-05-18 01:40 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-03-07 16:01:39 UTC
Embargoed:


Attachments (Terms of Use)

Description Brock Organ 2000-03-01 21:15:59 UTC
using the following valid phhttpd.conf file we get a parse error:

[root@test95 /root]# phhttpd -c /etc/phhttpd.conf.space
/etc/phhttpd.conf.space:1: error: Extra spaces at the beginning of the
document are not allowed


^
couldn't parse config file /etc/phhttpd.conf.space
[root@test95 /root]#

below (between the -'s) is the EXACT file (note whitespace IS important):


-------------- BEGIN FILE --------------------




<phhttpd>


<global>
	<tunnel file="/var/run/phhttpd/tunnel.socket" mode="0600" />
	<control file="/var/run/phhttpd/control.socket" mode="0600" />
	<mime file="/etc/mime.types" />
	<maxfds num="5000" />
</global>





<logging>

	<template name="logtemplate">
		<route source="access" type="file" file="/var/log/phhttpd/access.log"
mode="0660" />
		<route source="referer" type="file" file="/var/log/phhttpd/referer.log"
mode="0660" />
		<route source="agent" type="file" file="/var/log/phhttpd/agent.log"
mode="0660" />
	</template>
</logging>



<virtual docroot="/home/httpd/html">




	<name>localhost</name>

	<listen v4="*" port="80"/>




	<md5 />
	<logs>

		<applytemplate name="logtemplate" />
	</logs>
</virtual>

</phhttpd>
------------------ END FILE ------------------
note that the above file is the exact copy of the /etc/phhttpd.conf
packaged, except with the text of the comments removed ...

The file below is the exact text of the above, but with excess whitespace
removed ... phhttpd parses and starts running using this conf file ...

------------------- BEGIN FILE -------------------------
<phhttpd>
<global>
	<tunnel file="/var/run/phhttpd/tunnel.socket" mode="0600" />
	<control file="/var/run/phhttpd/control.socket" mode="0600" />
	<mime file="/etc/mime.types" />
	<maxfds num="5000" />
</global>
<logging>
	<template name="logtemplate">
		<route source="access" type="file" file="/var/log/phhttpd/access.log"
mode="0660" />
		<route source="referer" type="file" file="/var/log/phhttpd/referer.log"
mode="0660" />
		<route source="agent" type="file" file="/var/log/phhttpd/agent.log"
mode="0660" />
	</template>
</logging>
<virtual docroot="/home/httpd/html">
	<name>localhost</name>
	<listen v4="*" port="80"/>
	<md5 />
	<logs>
		<applytemplate name="logtemplate" />
	</logs>
</virtual>
</phhttpd>
---------------- END FILE ---------------------

The final example uses the stock /etc/phhttpd.conf file; again it appears
like there is trouble parsing the file:

[root@test95 /root]# phhttpd -c /etc/phhttpd.conf
[root@test95 /root]# no control path specified in the config file.

[root@test95 /root]#

But the stock conf file is the same as the two files in our examples
here... so all three files SHOULD be valid conf files, but phhttpd only
accepts one of them ...

Comment 1 Zach Brown 2000-03-02 15:53:59 UTC
libxml is not happy when whitespace is the first thing in the config file.
I will try and update the documentation to reflect this.

I wasn't able to reproduce the 'no control path'.. with your config file
and phhttpd-0.1.0-2.  It was also able to use the example config file
as well, comments or not.

Am I on crack?

Comment 2 Zach Brown 2000-03-07 16:01:59 UTC
libxml changed how it deals with xml that starts with a comment (which
I'm told is illegal.  OK :)).  6.1's libxml happily returned the parsed
document by ignoring the comment.  6.2's happily returned an empty document.
So the config file has been updated with BIG WARNINGS against doing things
that libxml doesn't like.


Note You need to log in before you can comment on or make changes to this bug.