chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] http-client and set-cookie


From: Daishi Kato
Subject: Re: [Chicken-users] http-client and set-cookie
Date: Fri, 14 Jan 2011 00:55:41 +0900
User-agent: Wanderlust/2.14.0 (Africa) Emacs/21.4 Mule/5.0 (SAKAKI)

Hi Peter,

I found a similar problem with my simple POST request using:
(define (post-page url args)
  (call-with-values
    (lambda ()
      (with-input-from-request
       (make-request method: 'POST
                     headers: (headers (list (list 'user-agent useragent)))
                     uri: (uri-reference url))
       args read-string))
    (lambda (x _ _) x)))

It gives me:
Error: bad argument type - not a structure of the required type
(/ "xxxxxxx" "")
URI-common

It seems like it fails in path-match? in process-set-cookie!.
I'm not totally sure, but could it be something like this?

  (define (path-match? uri path)
    (and (uri-path-absolute? uri)
-        (let loop ((path (cdr (uri-path path)))
+        (let loop ((path (cdr path))
                    (uri-path (cdr (uri-path uri))))
           (or (null? path)               ; done
               (and (not (null? uri-path))
                    (or (and (string-null? (car path)) (null? (cdr path)))
  
                        (and (string=? (car path) (car uri-path))
                             (loop (cdr path) (cdr uri-path)))))))))

Best,
Daishi

At Sun, 26 Dec 2010 00:29:54 +0100,
Peter Bex wrote:
> On Sat, Dec 25, 2010 at 08:04:33PM -0300, Hugo Arregui wrote:
> > Hi guys,
> > 
> > I localized the problem, the request header contains:  (set-cookie
> > #(("blogger_TID" . "XXX") ((httponly . #t))))
> > and in http-client.scm:299 (process-set-cookie! proc), (get-param
> > 'path c) returns #f
> > 
> > I just check for #f first, and works fine.
> > 
> > Now, my questions:
> > 
> > -it's a bug? I really don't understand what get-param is.
> 
> It's a bug.  Path is an optional parameter for the set-cookie header.
> get-param simply extracts that parameter from the header.  It looks like
> I added code to default to the current URI's path, but I forgot to
> actually use the derived path.
> 
> Please try the attached patch and let me know if it helps.
> 
> > -It's was hard to find the problem because the stack wasn't helpful, i
> > have to debug by hand, adding prints on egg source and that kind of
> > things. Is there a better way to do that?
> 
> The debug output is helpful, if you realize it's a continuation call
> trace rather than a traditional "call stack".  I often find the default
> length is a little short though.  You can increase that with -:aN where
> N is the desired length.  I usually just pass -:a100 or something and
> scroll through it.
> 
> Cheers,
> Peter
> -- 
> http://sjamaan.ath.cx
> --
> "The process of preparing programs for a digital computer
>  is especially attractive, not only because it can be economically
>  and scientifically rewarding, but also because it can be an aesthetic
>  experience much like composing poetry or music."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]