diff --git a/amazon-s3.scm b/amazon-s3.scm index 1f1eeed..ac7dab8 100644 --- a/amazon-s3.scm +++ b/amazon-s3.scm @@ -17,11 +17,6 @@ (import scheme chicken srfi-1 extras srfi-13 data-structures ports posix) (use base64 sha1 http-client uri-common intarweb srfi-19 hmac ssax sxpath) -;(header-unparsers -; (alist-update! 'authorization -; (lambda (v) (list (vector-ref (first v) 0))) -; (header-unparsers))) - ; needed to make intarweb work with Amazon's screwy authorization header (define (aws-param-subunparser params) (sprintf "~A:~A" (alist-ref 'access-key params) @@ -74,7 +69,6 @@ uri: (uri-reference (string-append "http" (if (https) "s" "") "://" bucket ".s3.amazonaws.com")) headers: (let ((n (current-date 0))) (headers `((date #(,(intarweb-date n) ())) -; (authorization ,(string-append "AWS " (access-key) ":" (authorization #(aws ((access-key . ,(access-key)) (signed-secret . ,(make-aws-authorization @@ -85,40 +79,4 @@ (lambda () ((sxpath '(x:ListBucketResult x:Contents x:Key *text*)) (ssax:xml->sxml (current-input-port) '((x . "http://s3.amazonaws.com/doc/2006-03-01/"))))))) - ;read-string))) - - - - - -;(define *the-date* #f) -;(define *date-as-date* (current-date -4)) -;(define (update-date) -; (set! *date-as-date* (current-date -4)) -; (set! *the-date* (date->string *date-as-date* "~a, ~d ~b ~Y ~T GMT"))) -;(define (sig) (make-aws-authorization "GET" "/test-bucket-keep-the-records" date: *the-date* content-type: "application/x-www-form-urlencoded")) - -;(define (get-test) -; (update-date) -; (handle-exceptions -; exn -; ((condition-property-accessor 'client-error 'body) exn) -; (with-input-from-request -; (make-request method: 'GET -; uri: (uri-reference "http://s3.amazonaws.com/test-bucket-keep-the-records") -; headers: (headers `((date #(,(string->time (date->string *date-as-date* "~a ~b ~d ~T ~Y GMT")) ())) -; (authorization ,(string-append ":" (sig)))))) -; '() -; read-string))) -) - -;(update-date) -;(define r (make-request uri: (uri-reference "") -; port: (current-output-port) -; headers: (headers `((date #(,(string->time (date->string *date-as-date* "~a ~b ~d ~T ~Y ~z")) ())) -; (authorization ,(string-append "" (sig))))))) -;(header-unparsers -; (alist-update! 'authorization -; (lambda (v) (list (vector-ref (first v) 0))) -; (header-unparsers))) -;(write-request r) \ No newline at end of file +) \ No newline at end of file