#249 ::S3 missing "Host:" header

open
Darren New
amazon-s3 (2)
5
2012-03-01
2012-03-01
Sam O'Connor
No

::S3 does not send a "Host:" header.
This causes "HTTP/1.1 400 Bad Request" to be returned by some transparent proxies.
(e.g. when using Telstra 3G through the telstra.iph APN).

The patch below sets the host header.

--- /System/Library/Tcl/tcllib1.12/amazon-s3/S3.tcl.orig 2012-02-25 15:32:45.000000000 +1100
+++ /System/Library/Tcl/tcllib1.12/amazon-s3/S3.tcl 2012-03-02 09:13:07.000000000 +1100
@@ -252,6 +252,7 @@
if {${content-type} != ""} {
dict set headers content-type ${content-type}
}
+ dict set headers host s3.amazonaws.com
set xamz ""
foreach key [lsort [dict keys $headers x-amz-*]] {
# Assume each is seen only once, for now, and is canonical already.

Discussion