summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@yahoo.com>2017-08-09 21:26:51 +0200
committerJoel Klinghed <the_jk@yahoo.com>2017-08-09 21:26:51 +0200
commit32ea52d76984f93282f36aa445b2e0f70096538b (patch)
tree08d5540b3ea58629f845ac87c39d03f56a7a2b38 /src
parent572d9ba729e12708deed0a6156209bbdc28698af (diff)
Handle HEAD request in normal proxy
Diffstat (limited to 'src')
-rw-r--r--src/proxy.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/proxy.cc b/src/proxy.cc
index 70a14cd..bec4924 100644
--- a/src/proxy.cc
+++ b/src/proxy.cc
@@ -248,6 +248,7 @@ struct Client : public BaseClient {
std::unique_ptr<HttpRequest> request;
std::unique_ptr<Connect> connect;
std::unique_ptr<Url> url;
+ bool head_request;
Content content;
RemoteState remote_state;
void* resolve;
@@ -1167,6 +1168,7 @@ void ProxyImpl::client_empty_input(size_t index) {
client_error(index, 400, "Bad request");
return;
}
+ client.head_request = client.request->method_equal("HEAD");
}
if (!client_request(index)) {
client.content.type = CONTENT_NONE;
@@ -1415,6 +1417,10 @@ void ProxyImpl::client_remote_event(size_t index, int fd, uint8_t events) {
index);
client.remote.content.type = CONTENT_CLOSE;
} else {
+ if (client.head_request) {
+ client.head_request = false;
+ client.remote.content.type = CONTENT_NONE;
+ }
if (client.remote.content.type == CONTENT_NONE) {
client.remote_state = WAITING;
client.remote.read_flag = 0;