v = (config.proxy) ? http_arg_get(&hc->hc_args, "X-Forwarded-For") : NULL;
if (v) {
+ if (hc->hc_proxy_ip == NULL)
+ hc->hc_proxy_ip = malloc(sizeof(*hc->hc_proxy_ip));
+ *hc->hc_proxy_ip = *hc->hc_peer;
if (tcp_get_ip_from_str(v, hc->hc_peer) == NULL) {
http_error(hc, HTTP_STATUS_BAD_REQUEST);
+ free(hc->hc_proxy_ip);
+ hc->hc_proxy_ip = NULL;
return -1;
}
- hc->hc_is_proxied = 1;
}
tcp_get_str_from_ip(hc->hc_peer, authbuf, sizeof(authbuf));
atomic_set(&hc->hc_extra_insend, 0);
atomic_set(&hc->hc_extra_chunks, 0);
- hc->hc_is_proxied = 0;
do {
hc->hc_no_output = 0;
free(hc->hc_nonce);
hc->hc_nonce = NULL;
+ free(hc->hc_proxy_ip);
free(hc->hc_local_ip);
}
char *hc_peer_ipstr;
struct sockaddr_storage *hc_self;
char *hc_representative;
+ struct sockaddr_storage *hc_proxy_ip;
struct sockaddr_storage *hc_local_ip;
pthread_mutex_t *hc_paths_mutex;
uint8_t hc_no_output;
uint8_t hc_shutdown;
uint8_t hc_is_local_ip; /*< a connection from the local network */
- uint8_t hc_is_proxied;
/* Support for HTTP POST */
rtsp_stream_status ( void *opaque, htsmsg_t *m )
{
http_connection_t *hc = opaque;
- htsmsg_add_str(m, "type", (hc->hc_is_proxied)? "SAT>IP/proxy" : "SAT>IP");
+ char buf[128];
+
+ htsmsg_add_str(m, "type", "SAT>IP");
+ if (hc->hc_proxy_ip) {
+ tcp_get_str_from_ip(hc->hc_proxy_ip, buf, sizeof(buf));
+ htsmsg_add_str(m, "proxy", buf);
+ }
if (hc->hc_username)
htsmsg_add_str(m, "user", hc->hc_username);
}
tcp_server_launch_t *tsl;
lock_assert(&global_lock);
htsmsg_t *l, *e, *m;
- char buf[1024];
+ char buf[128];
int c = 0;
/* Build list */
{ name: 'server_port' },
{ name: 'peer', sortType: stype },
{ name: 'peer_port' },
+ { name: 'proxy' },
{ name: 'user', sortType: stype },
{
name: 'started',
header: _("Server Port"),
dataIndex: 'server_port',
sortable: true
+ }, {
+ width: 50,
+ id: 'proxy',
+ header: _("Proxy Address"),
+ dataIndex: 'proxy',
+ sortable: true
}]);
grid = new Ext.grid.GridPanel({
http_stream_status ( void *opaque, htsmsg_t *m )
{
http_connection_t *hc = opaque;
- htsmsg_add_str(m, "type", (hc->hc_is_proxied)? "HTTP/proxy" : "HTTP");
+ char buf[128];
+
+ htsmsg_add_str(m, "type", "HTTP");
+ if (hc->hc_proxy_ip) {
+ tcp_get_str_from_ip(hc->hc_proxy_ip, buf, sizeof(buf));
+ htsmsg_add_str(m, "proxy", buf);
+ }
if (hc->hc_username)
htsmsg_add_str(m, "user", hc->hc_username);
}