Changeset 35157 in project


Ignore:
Timestamp:
02/18/18 17:42:27 (7 months ago)
Author:
sjamaan
Message:

http-client: Rip out md5, message-digest and string-utils dependencies (replace with ismple-md5)

Location:
release/4/http-client
Files:
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • release/4/http-client/0.16/http-client.meta

    r33921 r35157  
    22
    33((synopsis "High-level HTTP client library")
    4  (depends (intarweb "1.6.1") (uri-common "0.7") (message-digest "3.0.0")
    5           (md5 "3.0.0") string-utils (sendfile "1.7.4"))
     4 (depends (intarweb "1.6.1") (uri-common "0.7") (simple-md5 "0.0.1")
     5          (sendfile "1.7.4"))
    66 (test-depends test)
    77 (author "Peter Bex")
  • release/4/http-client/0.16/http-client.scm

    r34980 r35157  
    5050(use srfi-1 srfi-13 srfi-18 srfi-69
    5151     ports files extras tcp data-structures posix
    52      intarweb uri-common message-digest md5 string-utils sendfile)
     52     intarweb uri-common message-digest simple-md5 sendfile)
    5353
    5454;; Major TODOs:
     
    463463              (header-contents 'set-cookie2 (response-headers r) '()))))
    464464
    465 (define (call-with-output-digest primitive proc)
    466   (let* ((ctx-info (message-digest-primitive-context-info primitive))
    467          (ctx (if (procedure? ctx-info) (ctx-info) (allocate ctx-info)))
    468          (update-digest (message-digest-primitive-update primitive))
    469          (update (lambda (str) (update-digest ctx str (string-length str))))
    470          (outport (make-output-port update void)))
    471     (handle-exceptions exn
    472       (unless (procedure? ctx-info) (free ctx))
    473       (let ((result (make-string
    474                      (message-digest-primitive-digest-length primitive))))
    475         ((message-digest-primitive-init primitive) ctx)
    476         (proc outport)
    477         ((message-digest-primitive-final primitive) ctx result)
    478         (unless (procedure? ctx-info) (free ctx))
    479         (string->hex result)))))
    480 
    481465(define (get-username/password for-request-header for-uri for-realm)
    482466  (if (eq? for-request-header 'authorization)
     
    505489         (let* ((hashconc
    506490                 (lambda args
    507                    (message-digest-string
    508                     (md5-primitive) (string-join (map ->string args) ":"))))
     491                   (string->md5sum (string-join (map ->string args) ":"))))
    509492                (authless-uri (update-uri (request-uri new-request)
    510493                                          username: #f password: #f))
     
    528511                                   (uri->string authless-uri)
    529512                                   ;; Generate digest from writer's output
    530                                    (call-with-output-digest
    531                                     (md5-primitive)
    532                                     (lambda (p)
    533                                       (writer
    534                                        (update-request new-request port: p)))))
     513                                   ;; TODO: This should not generate one
     514                                   ;; large string but use a custom port.
     515                                   ;; Ideally we extract this from
     516                                   ;; this egg into another one.
     517                                   (string->md5sum
     518                                    (call-with-output-string
     519                                     (lambda (p)
     520                                       (writer
     521                                        (update-request new-request port: p))))))
    535522                         (hashconc (request-method new-request)
    536523                                   (uri->string authless-uri))))
  • release/4/http-client/trunk/http-client.meta

    r33921 r35157  
    22
    33((synopsis "High-level HTTP client library")
    4  (depends (intarweb "1.6.1") (uri-common "0.7") (message-digest "3.0.0")
    5           (md5 "3.0.0") string-utils (sendfile "1.7.4"))
     4 (depends (intarweb "1.6.1") (uri-common "0.7") (simple-md5 "0.0.1")
     5          (sendfile "1.7.4"))
    66 (test-depends test)
    77 (author "Peter Bex")
  • release/4/http-client/trunk/http-client.scm

    r34980 r35157  
    5050(use srfi-1 srfi-13 srfi-18 srfi-69
    5151     ports files extras tcp data-structures posix
    52      intarweb uri-common message-digest md5 string-utils sendfile)
     52     intarweb uri-common message-digest simple-md5 sendfile)
    5353
    5454;; Major TODOs:
     
    120120
    121121(define client-software
    122   (make-parameter (list (list "CHICKEN Scheme HTTP-client" "0.16" #f))))
     122  (make-parameter (list (list "CHICKEN Scheme HTTP-client" "0.17" #f))))
    123123
    124124
     
    463463              (header-contents 'set-cookie2 (response-headers r) '()))))
    464464
    465 (define (call-with-output-digest primitive proc)
    466   (let* ((ctx-info (message-digest-primitive-context-info primitive))
    467          (ctx (if (procedure? ctx-info) (ctx-info) (allocate ctx-info)))
    468          (update-digest (message-digest-primitive-update primitive))
    469          (update (lambda (str) (update-digest ctx str (string-length str))))
    470          (outport (make-output-port update void)))
    471     (handle-exceptions exn
    472       (unless (procedure? ctx-info) (free ctx))
    473       (let ((result (make-string
    474                      (message-digest-primitive-digest-length primitive))))
    475         ((message-digest-primitive-init primitive) ctx)
    476         (proc outport)
    477         ((message-digest-primitive-final primitive) ctx result)
    478         (unless (procedure? ctx-info) (free ctx))
    479         (string->hex result)))))
    480 
    481465(define (get-username/password for-request-header for-uri for-realm)
    482466  (if (eq? for-request-header 'authorization)
     
    505489         (let* ((hashconc
    506490                 (lambda args
    507                    (message-digest-string
    508                     (md5-primitive) (string-join (map ->string args) ":"))))
     491                   (string->md5sum (string-join (map ->string args) ":"))))
    509492                (authless-uri (update-uri (request-uri new-request)
    510493                                          username: #f password: #f))
     
    528511                                   (uri->string authless-uri)
    529512                                   ;; Generate digest from writer's output
    530                                    (call-with-output-digest
    531                                     (md5-primitive)
    532                                     (lambda (p)
    533                                       (writer
    534                                        (update-request new-request port: p)))))
     513                                   ;; TODO: This should not generate one
     514                                   ;; large string but use a custom port.
     515                                   ;; Ideally we extract this from
     516                                   ;; this egg into another one.
     517                                   (string->md5sum
     518                                    (call-with-output-string
     519                                     (lambda (p)
     520                                       (writer
     521                                        (update-request new-request port: p))))))
    535522                         (hashconc (request-method new-request)
    536523                                   (uri->string authless-uri))))
  • release/4/http-client/trunk/http-client.setup

    r34978 r35157  
    1111  'http-client
    1212  '("http-client.so" "http-client.import.so")
    13   `((version "0.16")
     13  `((version "0.17")
    1414    (documentation "http-client.html")))
Note: See TracChangeset for help on using the changeset viewer.