hget: use absolute url for POST through a proxy
R=rsc CC=codebot http://codereview.appspot.com/1282042
This commit is contained in:
parent
0efbfd36f5
commit
598020ec4e
@ -387,6 +387,7 @@ dohttp(URL *u, URL *px, Range *r, Out *out, long mtime)
|
|||||||
dfprint(fd, "Authorization: Basic %s\r\n",
|
dfprint(fd, "Authorization: Basic %s\r\n",
|
||||||
u->cred);
|
u->cred);
|
||||||
} else {
|
} else {
|
||||||
|
if(px->host == nil){
|
||||||
dfprint(fd, "POST %s HTTP/1.0\r\n"
|
dfprint(fd, "POST %s HTTP/1.0\r\n"
|
||||||
"Host: %s\r\n"
|
"Host: %s\r\n"
|
||||||
"Content-type: application/x-www-form-urlencoded\r\n"
|
"Content-type: application/x-www-form-urlencoded\r\n"
|
||||||
@ -394,6 +395,15 @@ dohttp(URL *u, URL *px, Range *r, Out *out, long mtime)
|
|||||||
"User-agent: Plan9/hget\r\n"
|
"User-agent: Plan9/hget\r\n"
|
||||||
"\r\n",
|
"\r\n",
|
||||||
u->page, u->host, strlen(u->postbody));
|
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);
|
dfprint(fd, "%s", u->postbody);
|
||||||
}
|
}
|
||||||
if(r->start != 0){
|
if(r->start != 0){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user