Changeset 35273 in project for release


Ignore:
Timestamp:
03/10/18 19:38:44 (9 months ago)
Author:
sjamaan
Message:

http-client: Avoid mangling the URI's path when sending a request line (fixes #1448)

Location:
release/4/http-client/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/http-client/trunk/http-client.scm

    r35199 r35273  
    594594                 (req-uri (if (http-connection-proxy con)
    595595                              req-uri
    596                               (update-uri req-uri host: #f port: #f scheme: #f
    597                                           path: (or (uri-path req-uri) '(/ "")))))
     596                              (update-uri req-uri
     597                                          host: #f port: #f scheme: #f)))
     598                 ;; Update path only when it needs to be updated, to
     599                 ;; avoid unnecessarily mangling it (see #1448)
     600                 (req-uri (if (or (http-connection-proxy con)
     601                                  (not (member (uri-path req-uri)
     602                                               '(() #f))))
     603                              req-uri
     604                              (update-uri req-uri path: '(/ ""))))
    598605                 (request (write-request (update-request req uri: req-uri)))
    599606                 ;; Writer should be prepared to be called several times
  • release/4/http-client/trunk/tests/run.scm

    r34766 r35273  
    636636          (test "No body got sent (GET)" #f (log-body (last logs))))))))
    637637
     638(test-group "url normalization"
     639  (let* ((logs (with-server-responses
     640                (lambda ()
     641                  ;; Reported by Caolan McMahon in #1448: URI paths
     642                  ;; would be re-encoded in a lossy way, dropping
     643                  ;; special characters.
     644                  (with-input-from-request
     645                   "https://img.discogs.com/dMvk8q681FkVCkhv3qRvTfwlLZk=/fit-in/300x300/filters:strip_icc():format(jpeg):mode_rgb():quality(40)/discogs-images/R-8062430-1454420247-1268.jpeg.jpg" #f read-string))
     646                (conc "HTTP/1.0 200 OK\r\n\r\n")))
     647         (req (log-request (last logs))))
     648    (test "URI path was not mangled"
     649          "/dMvk8q681FkVCkhv3qRvTfwlLZk=/fit-in/300x300/filters:strip_icc():format(jpeg):mode_rgb():quality(40)/discogs-images/R-8062430-1454420247-1268.jpeg.jpg"
     650          (uri->string (request-uri req)))))
     651
    638652(test-group "error handling"
    639653  (with-server-responses
Note: See TracChangeset for help on using the changeset viewer.