File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 486
486
(not (.get (.headers req') " Proxy-Connection" )))
487
487
(.set (.headers req') " Proxy-Connection" " Keep-Alive" ))
488
488
489
- (let [parts (:multipart req)
490
- [req' body] (if (nil? parts)
491
- [req' (:body req)]
489
+ (let [body (:body req)
490
+ parts (:multipart req)
491
+ multipart? (some? parts)
492
+ [req' body] (cond
493
+ ; ; RFC #7231 4.3.8. TRACE
494
+ ; ; A client MUST NOT send a message body...
495
+ (= :trace (:request-method req))
496
+ (do
497
+ (when (or (some? body) multipart?)
498
+ (log/warn " TRACE request body was omitted" ))
499
+ [req' nil ])
500
+
501
+ (not multipart?)
502
+ [req' body]
503
+
504
+ :else
492
505
(multipart/encode-request req' parts))]
493
506
494
507
(when-let [save-message (get req :aleph/save-request-message )]
Original file line number Diff line number Diff line change 343
343
(let [rsp (http/get (str " http://localhost:" port) {:connection-pool pool})]
344
344
(is (= http/default-response-executor (.executor rsp))))))))
345
345
346
+ (defn echo-handler [req]
347
+ {:status 200
348
+ :body (:body req)})
349
+
350
+ (deftest test-trace-request-omitted-body
351
+ (with-handler echo-handler
352
+ (is (= " " (-> @(http/trace (str " http://localhost:" port) {:body " REQUEST" })
353
+ :body
354
+ bs/to-string)))))
355
+
346
356
; ;;
347
357
348
358
(defn get-netty-client-event-threads []
You can’t perform that action at this time.
0 commit comments