[ECOS] Re: GoAhead problem:treeapp.asp

Grant Edwards grante@visi.com
Sun Oct 10 08:37:00 GMT 2004


On Sun, Oct 10, 2004 at 10:09:37AM +0800, liu hua wrote:

> I used the GoAhead 2.1.8 in my eCos target(s3c4510).When I
> load the default GoAhead web site (home.asp),it doesn't handle
> with the left side menu applet (classes/treeapp.jar) -
>
> How to resolve this problem?Who can give me help?

Yup, there's a known bug in the GoAhead Java applets. They
generate requests that use invalid paths.  By chance, it works
OK using "real" files, but doesn't work with a rom image
containing "pseudo-files".

Sheesh.  I reported this 4 or 5 YEARS ago, and it's STILL
broken? Is the fdset size bug still in there as well?

Here's a patch for the rom lookup mechanism.  If the lookup
fails, it attempts to fix the bogus pathname generated by
GoAhead's java applets by prepending a "/" to the path and
re-trying the lookup.

-- 
Grant



-------------- next part --------------
--- ../eCos-Apps/goahead/rom.c	2004-10-09 19:46:34.000000000 -0500
+++ rom.c	2001-08-19 16:53:30.000000000 -0500
@@ -56,34 +56,49 @@
 /******************************************************************************/
 /*
  *	Close the ROM module
  */
 
 void websRomClose()
 {
 	symClose(romTab);
 }
 
+static sym_t *trySymLookup(char_t *path)
+{
+  char newpath[128];
+  sym_t	*sp;
+  
+  sp = symLookup(romTab,path);
+  if (sp)
+	return sp;
+  newpath[0] = '/';
+  newpath[(sizeof newpath)-1] = '\0';
+  strncpy(newpath+1,path,(sizeof newpath)-2);
+  return symLookup(romTab,newpath);
+}
+
+
 /******************************************************************************/
 /*
  *	Open a web page
  */
 
 int websRomPageOpen(webs_t wp, char_t *path, int mode, int perm)
 {
 	websRomPageIndexType	*wip;
 	sym_t					*sp;
 
 	a_assert(websValid(wp));
 	a_assert(path && *path);
 
-	if ((sp = symLookup(romTab, path)) == NULL) {
+	if ((sp = trySymLookup(path)) == NULL) {
 		return -1;
 	}
 	wip = (websRomPageIndexType*) sp->content.value.integer;
 	wip->pos = 0;
 	return (wp->docfd = wip - websRomPageIndex);
 }
 
 /******************************************************************************/
 /*
  *	Close a web page
@@ -98,21 +113,21 @@
  *	Stat a web page
  */
 
 int websRomPageStat(char_t *path, websStatType *sbuf)
 {
 	websRomPageIndexType	*wip;
 	sym_t					*sp;
 
 	a_assert(path && *path);
 
-	if ((sp = symLookup(romTab, path)) == NULL) {
+	if ((sp = trySymLookup(path)) == NULL) {
 		return -1;
 	}
 	wip = (websRomPageIndexType*) sp->content.value.integer;
 
 	memset(sbuf, 0, sizeof(websStatType));
 	sbuf->size = wip->size;
 	if (wip->page == NULL) {
 		sbuf->isDir = 1;
 	}
 	return 0;

-------------- next part --------------
-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


More information about the Ecos-discuss mailing list