*/
if (p->pending_flush) sk_flush(p->sub_socket);
+ /* if we have a pending EOF to send, send it */
+ if (p->pending_eof) sk_write_eof(p->sub_socket);
+
/* if the backend wanted the socket unfrozen, try to unfreeze.
* our set_frozen handler will flush buffered receive data before
* unfreezing the actual underlying socket.
return sk_write_oob(ps->sub_socket, data, len);
}
+static void sk_proxy_write_eof (Socket s)
+{
+ Proxy_Socket ps = (Proxy_Socket) s;
+
+ if (ps->state != PROXY_STATE_ACTIVE) {
+ ps->pending_eof = 1;
+ return;
+ }
+ sk_write_eof(ps->sub_socket);
+}
+
static void sk_proxy_flush (Socket s)
{
Proxy_Socket ps = (Proxy_Socket) s;
const char *exclude_list;
/*
+ * Special local connections such as Unix-domain sockets
+ * unconditionally cannot be proxied, even in proxy-localhost
+ * mode. There just isn't any way to ask any known proxy type for
+ * them.
+ */
+ if (addr && sk_address_is_special_local(addr))
+ return 0; /* do not proxy */
+
+ /*
* Check the host name and IP against the hard-coded
* representations of `localhost'.
*/
sk_proxy_close,
sk_proxy_write,
sk_proxy_write_oob,
+ sk_proxy_write_eof,
sk_proxy_flush,
sk_proxy_set_private_ptr,
sk_proxy_get_private_ptr,
ret->error = NULL;
ret->pending_flush = 0;
+ ret->pending_eof = 0;
ret->freeze = 0;
bufchain_init(&ret->pending_input_data);
conf_get_int(conf, CONF_addressfamily));
if (sk_addr_error(proxy_addr) != NULL) {
ret->error = "Proxy error: Unable to resolve proxy host name";
+ sfree(pplug);
return (Socket)ret;
}
sfree(proxy_canonical_name);
type = sk_addrtype(p->remote_addr);
if (type == ADDRTYPE_IPV6) {
- plug_closing(p->plug, "Proxy error: SOCKS version 4 does"
- " not support IPv6", PROXY_ERROR_GENERAL, 0);
+ p->error = "Proxy error: SOCKS version 4 does not support IPv6";
return 1;
} else if (type == ADDRTYPE_IPV4) {
namelen = 0;