/*
proxy.c -- Proxy handling functions.
- Copyright (C) 2015 Guus Sliepen <guus@tinc-vpn.org>
+ Copyright (C) 2015-2017 Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
}
case PROXY_EXEC:
- return true;
+ abort();
default:
logger(LOG_ERR, "Unknown proxy type");
ifdebug(CONNECTIONS) logger(LOG_DEBUG, "Proxy request granted");
c->allow_request = ID;
+ c->status.proxy_passed = true;
+ send_id(c);
return 8;
} else {
logger(LOG_ERR, "Proxy request rejected");
} else {
ifdebug(CONNECTIONS) logger(LOG_DEBUG, "Proxy request granted");
c->allow_request = ID;
+ c->status.proxy_passed = true;
+ send_id(c);
return replen;
}
if(!p || p - c->buffer >= c->buflen)
return 0;
- while(p = memchr(p + 1, '\n', c->buflen - (p + 1 - c->buffer))) {
- if(p[-1] == '\n')
+ while((p = memchr(p + 1, '\n', c->buflen - (p + 1 - c->buffer)))) {
+ if(p > c->buffer + 3 && !memcmp(p - 3, "\r\n\r\n", 4))
break;
}
logger(LOG_DEBUG, "Proxy request granted");
replen = p + 1 - c->buffer;
c->allow_request = ID;
+ c->status.proxy_passed = true;
+ send_id(c);
return replen;
} else {
+ p = memchr(c->buffer, '\n', c->buflen);
+ p[-1] = 0;
logger(LOG_ERR, "Proxy request rejected: %s", c->buffer + 9);
return false;
}