Cleaned it up. Removed old messy testing code.

test-github-pull-request
Thomas Hintz 14 years ago
parent 68ca72bd4f
commit 13efd6a2c3

@ -17,11 +17,6 @@
(import scheme chicken srfi-1 extras srfi-13 data-structures ports posix) (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) (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 ; needed to make intarweb work with Amazon's screwy authorization header
(define (aws-param-subunparser params) (define (aws-param-subunparser params)
(sprintf "~A:~A" (alist-ref 'access-key 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")) uri: (uri-reference (string-append "http" (if (https) "s" "") "://" bucket ".s3.amazonaws.com"))
headers: (let ((n (current-date 0))) headers: (let ((n (current-date 0)))
(headers `((date #(,(intarweb-date n) ())) (headers `((date #(,(intarweb-date n) ()))
; (authorization ,(string-append "AWS " (access-key) ":"
(authorization #(aws ((access-key . ,(access-key)) (authorization #(aws ((access-key . ,(access-key))
(signed-secret . (signed-secret .
,(make-aws-authorization ,(make-aws-authorization
@ -85,40 +79,4 @@
(lambda () (lambda ()
((sxpath '(x:ListBucketResult x:Contents x:Key *text*)) ((sxpath '(x:ListBucketResult x:Contents x:Key *text*))
(ssax:xml->sxml (current-input-port) '((x . "http://s3.amazonaws.com/doc/2006-03-01/"))))))) (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)
Loading…
Cancel
Save