9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Laptop!
@ 2007-04-01  5:29 Devon H. O'Dell
  2007-04-01  5:57 ` Federico G. Benavento
  0 siblings, 1 reply; 3+ messages in thread
From: Devon H. O'Dell @ 2007-04-01  5:29 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I just installed today's CD image on my Compaq Presario V4000 laptop.
It's working great at 1280x800x32. I'm sending this mail with abaco +
the webfs patch. Though the cookie handling seems like it could use
with some help in any case -- it is broken for eBay.

That said, eBay looks a helluvalot better in abaco than it does in
Mothra or Charon (the latter of which seems to have a lot of issues
with posting forms).

If fontfs was in a nicer state, integrating these two would be really awesome.

I didn't install Venti, because I figured it was kind of a waste for a laptop.

That's today's midnight rant, in any case. More coming when I'm
actually coherent.

--dho


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] Laptop!
  2007-04-01  5:29 [9fans] Laptop! Devon H. O'Dell
@ 2007-04-01  5:57 ` Federico G. Benavento
  2007-04-01  7:40   ` Federico Benavento
  0 siblings, 1 reply; 3+ messages in thread
From: Federico G. Benavento @ 2007-04-01  5:57 UTC (permalink / raw)
  To: 9fans

> I'm sending this mail with abaco +
> the webfs patch. Though the cookie handling seems like it could use
> with some help in any case -- it is broken for eBay.
> 

I think I fixed some of the bugs in the cookie's code, I'm not sure
my changes are fixes or hacks, that's why this is not patch.
I'd really like someone to review them and submit the appropriate
patch. thanks.


g% 9fs sources
post...
g% diff -c /n/sources/plan9/sys/src/cmd/webfs /sys/src/cmd/webfs
diff -c /n/sources/plan9/sys/src/cmd/webfs/cookies.c /sys/src/cmd/webfs/cookies.c
/n/sources/plan9/sys/src/cmd/webfs/cookies.c:533,545 - /sys/src/cmd/webfs/cookies.c:533,548
  {
  	int lname, lpattern;
  
- 	if(cistrcmp(name, pattern)==0)
+ 	 if(pattern[0] != '.')
+ 		return 0;
+ 
+ 	if(cistrcmp(name, pattern+1) == 0)
  		return 1;
  
  	if(strcmp(ipattr(name), "dom")==0 && pattern[0]=='.'){
  		lname = strlen(name);
  		lpattern = strlen(pattern);
- 		if(lname >= lpattern && cistrcmp(name+lname-lpattern, pattern)==0)
+ 		if(lname>=lpattern && cistrcmp(name+lname-lpattern, pattern)==0)
  			return 1;
  	}
  
/n/sources/plan9/sys/src/cmd/webfs/cookies.c:557,563 - /sys/src/cmd/webfs/cookies.c:560,566
  {
  	return isdomainmatch(dom, c->dom)
  		&& strncmp(c->path, path, strlen(c->path))==0
- 		&& c->expire >= now;
+ 		&& (c->expire==0 || c->expire>=now);
  }
  
  /* 
/n/sources/plan9/sys/src/cmd/webfs/cookies.c:578,584 - /sys/src/cmd/webfs/cookies.c:581,587
  	for(i=0; i<jar->nc; i++){
  		if(cookiedebug)
  			fprint(2, "\ttry %s %s %d %s\n", jar->c[i].dom, jar->c[i].path, jar->c[i].secure, jar->c[i].name);
- 		if((issecure || !jar->c[i].secure) && iscookiematch(&jar->c[i], dom, path, now)){
+ 		if(/*(issecure || !jar->c[i].secure) &&*/ iscookiematch(&jar->c[i], dom, path, now)){
  			if(cookiedebug)
  				fprint(2, "\tmatched\n");
  			addcookie(j, &jar->c[i]);
/n/sources/plan9/sys/src/cmd/webfs/cookies.c:612,618 - /sys/src/cmd/webfs/cookies.c:615,621
  		return "request host does not match cookie domain";
  
  	if(strcmp(ipattr(dom), "dom")==0
- 	&& memchr(dom, '.', strlen(dom)-strlen(c->dom)) != nil)
+ 	&& memchr(dom, '.', strlen(c->dom)-strlen(dom)) != nil)
  		return "request host contains dots before cookie domain";
  
  	return 0;

Federico G. Benavento

---
/bin/fortune:
It's not Camelot, but it's not Cleveland, either.  -Boston Mayor Kevin White



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] Laptop!
  2007-04-01  5:57 ` Federico G. Benavento
@ 2007-04-01  7:40   ` Federico Benavento
  0 siblings, 0 replies; 3+ messages in thread
From: Federico Benavento @ 2007-04-01  7:40 UTC (permalink / raw)
  To: 9fans

hola,

> I think I fixed some of the bugs in the cookie's code, I'm not sure
> my changes are fixes or hacks, that's why this is not patch.
> I'd really like someone to review them and submit the appropriate
> patch. thanks.
>
>

found a bug in my changes, good that I didn't submit it as a patch :)
here is the corrected one:

g% diff -c /n/sources/plan9/sys/src/cmd/webfs /sys/src/cmd/webfs
diff -c /n/sources/plan9/sys/src/cmd/webfs/cookies.c
/sys/src/cmd/webfs/cookies.c
/n/sources/plan9/sys/src/cmd/webfs/cookies.c:533,545 -
/sys/src/cmd/webfs/cookies.c:533,548
  {
  	int lname, lpattern;

- 	if(cistrcmp(name, pattern)==0)
+ 	 if(pattern[0] != '.')
+ 		return 0;
+
+ 	if(cistrcmp(name, pattern+1) == 0)
  		return 1;

  	if(strcmp(ipattr(name), "dom")==0 && pattern[0]=='.'){
  		lname = strlen(name);
  		lpattern = strlen(pattern);
- 		if(lname >= lpattern && cistrcmp(name+lname-lpattern, pattern)==0)
+ 		if(lname>=lpattern && cistrcmp(name+lname-lpattern, pattern)==0)
  			return 1;
  	}

/n/sources/plan9/sys/src/cmd/webfs/cookies.c:557,563 -
/sys/src/cmd/webfs/cookies.c:560,566
  {
  	return isdomainmatch(dom, c->dom)
  		&& strncmp(c->path, path, strlen(c->path))==0
- 		&& c->expire >= now;
+ 		&& (c->expire==0 || c->expire>=now);
  }

  /*
/n/sources/plan9/sys/src/cmd/webfs/cookies.c:578,584 -
/sys/src/cmd/webfs/cookies.c:581,587
  	for(i=0; i<jar->nc; i++){
  		if(cookiedebug)
  			fprint(2, "\ttry %s %s %d %s\n", jar->c[i].dom, jar->c[i].path,
jar->c[i].secure, jar->c[i].name);
- 		if((issecure || !jar->c[i].secure) && iscookiematch(&jar->c[i],
dom, path, now)){
+ 		if(/*(issecure || !jar->c[i].secure) &&*/
iscookiematch(&jar->c[i], dom, path, now)){
  			if(cookiedebug)
  				fprint(2, "\tmatched\n");
  			addcookie(j, &jar->c[i]);
/n/sources/plan9/sys/src/cmd/webfs/cookies.c:612,618 -
/sys/src/cmd/webfs/cookies.c:615,622
  		return "request host does not match cookie domain";

  	if(strcmp(ipattr(dom), "dom")==0
- 	&& memchr(dom, '.', strlen(dom)-strlen(c->dom)) != nil)
+ 	&& strlen(c->dom)-strlen(dom) > 0
+ 	&& memchr(dom, '.', strlen(c->dom)-strlen(dom)) != nil)
  		return "request host contains dots before cookie domain";

  	return 0;
-- 
Federico G. Benavento


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-04-01  7:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-01  5:29 [9fans] Laptop! Devon H. O'Dell
2007-04-01  5:57 ` Federico G. Benavento
2007-04-01  7:40   ` Federico Benavento

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).