| 85 int ref; |
85 int ref; |
| 86 } ProxyRequest; |
86 } ProxyRequest; |
| 87 |
87 |
| 88 static void proxy_unref(ProxyRequest *proxy) { |
88 static void proxy_unref(ProxyRequest *proxy) { |
| 89 if(--proxy->ref == 0) { |
89 if(--proxy->ref == 0) { |
| |
90 //const char *method = pblock_findkeyval(pb_key_method, proxy->rq->reqpb); |
| |
91 //const char *uri = pblock_findkeyval(pb_key_uri, proxy->rq->reqpb); |
| |
92 //log_ereport(LOG_INFORM, "reverse-proxy: %s %s finished", method, uri); |
| 90 http_client_free(proxy->client); |
93 http_client_free(proxy->client); |
| 91 free(proxy->read_buf); |
94 free(proxy->read_buf); |
| 92 free(proxy); |
95 free(proxy); |
| 93 } |
96 } |
| 94 } |
97 } |
| 313 int http_reverse_proxy_service(pblock *param, Session *sn, Request *rq) { |
316 int http_reverse_proxy_service(pblock *param, Session *sn, Request *rq) { |
| 314 EventHandler *ev = sn->ev; |
317 EventHandler *ev = sn->ev; |
| 315 const char *method = pblock_findkeyval(pb_key_method, rq->reqpb); |
318 const char *method = pblock_findkeyval(pb_key_method, rq->reqpb); |
| 316 const char *uri = pblock_findkeyval(pb_key_uri, rq->reqpb); |
319 const char *uri = pblock_findkeyval(pb_key_uri, rq->reqpb); |
| 317 const char *query = pblock_findkeyval(pb_key_query, rq->reqpb); |
320 const char *query = pblock_findkeyval(pb_key_query, rq->reqpb); |
| |
321 |
| |
322 //log_ereport(LOG_INFORM, "reverse-proxy: %s %s", method, uri); |
| 318 |
323 |
| 319 char *host_header = pblock_findval("host-header", param); |
324 char *host_header = pblock_findval("host-header", param); |
| 320 |
325 |
| 321 const char *location = pblock_findval("location", param); |
326 const char *location = pblock_findval("location", param); |
| 322 if(location) { |
327 if(location) { |