aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/hget.c
diff options
context:
space:
mode:
authorAnthony Martin <ality@pbrane.org>2010-06-28 14:37:26 -0700
committerRuss Cox <rsc@swtch.com>2010-06-28 14:37:26 -0700
commit598020ec4ebadc3351e698bc5b3005b315e97ff6 (patch)
tree1bc2a71f6e3a58a4e42f0a4a84145bfcc9e56ed7 /src/cmd/hget.c
parent0efbfd36f554a534750bbebb1e68a76aada3faa6 (diff)
downloadplan9port-598020ec4ebadc3351e698bc5b3005b315e97ff6.tar.gz
plan9port-598020ec4ebadc3351e698bc5b3005b315e97ff6.tar.bz2
plan9port-598020ec4ebadc3351e698bc5b3005b315e97ff6.zip
hget: use absolute url for POST through a proxy
R=rsc CC=codebot http://codereview.appspot.com/1282042
Diffstat (limited to 'src/cmd/hget.c')
-rw-r--r--src/cmd/hget.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/cmd/hget.c b/src/cmd/hget.c
index 5c6ee807..c30bb0b3 100644
--- a/src/cmd/hget.c
+++ b/src/cmd/hget.c
@@ -387,13 +387,23 @@ dohttp(URL *u, URL *px, Range *r, Out *out, long mtime)
dfprint(fd, "Authorization: Basic %s\r\n",
u->cred);
} else {
- dfprint(fd, "POST %s HTTP/1.0\r\n"
- "Host: %s\r\n"
- "Content-type: application/x-www-form-urlencoded\r\n"
- "Content-length: %d\r\n"
- "User-agent: Plan9/hget\r\n"
- "\r\n",
- u->page, u->host, strlen(u->postbody));
+ if(px->host == nil){
+ dfprint(fd, "POST %s HTTP/1.0\r\n"
+ "Host: %s\r\n"
+ "Content-type: application/x-www-form-urlencoded\r\n"
+ "Content-length: %d\r\n"
+ "User-agent: Plan9/hget\r\n"
+ "\r\n",
+ u->page, u->host, strlen(u->postbody));
+ } else {
+ dfprint(fd, "POST http://%s%s HTTP/1.0\r\n"
+ "Host: %s\r\n"
+ "Content-type: application/x-www-form-urlencoded\r\n"
+ "Content-length: %d\r\n"
+ "User-agent: Plan9/hget\r\n"
+ "\r\n",
+ u->host, u->page, u->host, strlen(u->postbody));
+ }
dfprint(fd, "%s", u->postbody);
}
if(r->start != 0){