[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-janitors] #1448: http-client escaping URI path
From: |
Chicken Trac |
Subject: |
Re: [Chicken-janitors] #1448: http-client escaping URI path |
Date: |
Mon, 05 Mar 2018 09:39:16 -0000 |
#1448: http-client escaping URI path
-----------------------------------+-------------------------
Reporter: caolan | Owner:
Type: defect | Status: new
Priority: major | Milestone: someday
Component: extensions | Version: 4.13.0
Resolution: | Keywords: http-client
Estimated difficulty: |
-----------------------------------+-------------------------
Comment (by caolan):
One impact of the above workaround was that empty paths would not get
replaced with "/" (e.g. "https://caolan.org" would yield a 400 Bad Request
as it was missing the path, but "https://caolan.org/" would work).
Here's the updated workaround to address that:
{{{
diff -u http-client/http-client.scm http-client2/http-client.scm
--- http-client/http-client.scm 2018-03-05 09:37:52.304272371 +0000
+++ http-client2/http-client.scm 2018-03-05 09:37:36.848027692
+0000
@@ -49,7 +49,7 @@
(import chicken scheme lolevel)
(use srfi-1 srfi-13 srfi-18 srfi-69
ports files extras tcp data-structures posix
- intarweb uri-common simple-md5 sendfile)
+ intarweb uri-common (prefix uri-generic generic:) simple-md5
sendfile)
;; Major TODOs:
;; * Find a better approach for storing cookies, which does not
@@ -593,8 +593,17 @@
;; generate them in requests to proxies." (also 5.1.2)
(req-uri (if (http-connection-proxy con)
req-uri
- (update-uri req-uri host: #f port: #f
scheme: #f
- path: (or (uri-path req-uri)
'(/ "")))))
+ (let ((ug (uri->uri-generic req-uri)))
+ (uri-generic->uri
+ (generic:update-uri
+ ug
+ host: #f
+ port: #f
+ scheme: #f
+ path: (if (or (not (generic:uri-path
ug))
+ (null? (generic:uri-path
ug)))
+ '(/ "")
+ (generic:uri-path ug)))))))
(request (write-request (update-request req uri: req-
uri)))
;; Writer should be prepared to be called several times
;; Maybe try and figure out a good way to use the
}}}
--
Ticket URL: <https://bugs.call-cc.org/ticket/1448#comment:1>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.
- Re: [Chicken-janitors] #1448: http-client escaping URI path,
Chicken Trac <=