3b7af84b7d8ebe9d30811103accd61584add9d9a galt Sun Mar 19 22:24:29 2017 -0700 Initial check-in of proxy stuff. Added support for https_proxy for configuring https proxy. Added no_proxy for configuring domain suffixes which should be excluded from proxying. src/product/README.proxy updated. There are probably some documentation pages that will still need updating. diff --git src/inc/net.h src/inc/net.h index 212b46f..4718f54 100644 --- src/inc/net.h +++ src/inc/net.h @@ -198,30 +198,36 @@ /* Read entire URL and return it as a string. URL should be text (embedded zeros will be * interpreted as end of string). If the url doesn't exist or has other problems, * returns NULL. Does *not* include http headers. */ struct lineFile *netHttpLineFileMayOpen(char *url, struct netParsedUrl **npu); /* Parse URL and open an HTTP socket for it but don't send a request yet. */ void netHttpGet(struct lineFile *lf, struct netParsedUrl *npu, boolean keepAlive); /* Send a GET request, possibly with Keep-Alive. */ int netOpenHttpExt(char *url, char *method, char *optionalHeader); /* Return a file handle that will read the url. optionalHeader * may by NULL or may contain cookies and other info. */ +void setAuthorization(struct netParsedUrl npu, char *authHeader, struct dyString *dy); +/* Set the specified authorization header with BASIC auth base64-encoded user and password */ + +boolean checkNoProxy(char *host); +/* See if host endsWith element on no_proxy list. */ + int netHttpConnect(char *url, char *method, char *protocol, char *agent, char *optionalHeader); /* Parse URL, connect to associated server on port, and send most of * the request to the server. If specified in the url send user name * and password too. Typically the "method" will be "GET" or "POST" * and the agent will be the name of your program or * library. optionalHeader may be NULL or contain additional header * lines such as cookie info. * Proxy support via hg.conf httpProxy or env var http_proxy * Return data socket, or -1 if error.*/ int netHttpGetMultiple(char *url, struct slName *queries, void *userData, void (*responseCB)(void *userData, char *req, char *hdr, struct dyString *body)); /* Given an URL which is the base of all requests to be made, and a * linked list of queries to be appended to that base and sent in as