defer changing to proxy uri until connected

Reported-by: shyswork
Signed-off-by: Andy Green <andy.green@linaro.org>
fix origin

And fix client header of Origin, add prefix "http://" to make a valid URI, to make golang websocket server happy.
Subject: [PATCH] On iOS with nonblocking sockets I experience SSL error which
 is not really an error (
 http://lists.freeradius.org/pipermail/freeradius-users/2009-August/040155.html
 ). Added check for that. Additional fixes for comments and logging.
Subject: [PATCH] Additional check for EISONN. On iOS "if (connect()) == -1 ||
 errno == EISCONN)" doesn't work.
cover-proxy-read-EAGAIN.patch
Subject: [PATCH] Because of nonblocking sockets reading from  proxy might not
 work in one turn. We should check for EAGAIN.
Merge remote-tracking branch 'upstream/master'