[9fans] Laptop! - Plan9

This is a discussion on [9fans] Laptop! - Plan9 ; 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 ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: [9fans] Laptop!

  1. [9fans] Laptop!

    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

  2. Re: [9fans] Laptop!

    > 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; inc; 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


  3. Re: [9fans] Laptop!

    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; inc; 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

+ Reply to Thread