Lines Matching refs:ps

152 static WEB_SESSION *ps;  variable
278 if (ps == NULL) in web_cleanup()
283 if (ps->keystore) { in web_cleanup()
284 (void) close_keystore(err, ps->keystore, NULL); in web_cleanup()
287 ps->keystore = NULL; in web_cleanup()
291 if (ps->uniqfile) { in web_cleanup()
292 (void) remove_dwnld_file(ps->uniqfile); in web_cleanup()
293 free(ps->uniqfile); in web_cleanup()
294 ps->uniqfile = NULL; in web_cleanup()
296 if (ps->link) { in web_cleanup()
297 (void) remove_dwnld_file(ps->link); in web_cleanup()
298 free(ps->link); in web_cleanup()
299 ps->link = NULL; in web_cleanup()
301 if (ps->dwnld_dir) { in web_cleanup()
302 (void) rmdir(ps->dwnld_dir); in web_cleanup()
303 ps->dwnld_dir = NULL; in web_cleanup()
305 if (ps->errstr) { in web_cleanup()
306 free(ps->errstr); in web_cleanup()
307 ps->errstr = NULL; in web_cleanup()
310 if (ps->content) { in web_cleanup()
311 free(ps->content); in web_cleanup()
312 ps->content = NULL; in web_cleanup()
315 if (ps->resp) { in web_cleanup()
316 http_free_respinfo(ps->resp); in web_cleanup()
317 ps->resp = NULL; in web_cleanup()
320 if (ps) { in web_cleanup()
321 free(ps); in web_cleanup()
322 ps = NULL; in web_cleanup()
368 ps->timeout = timeout; in web_session_control()
371 ps->keystore = keystore; in web_session_control()
374 ps->dwnld_dir = xstrdup(dwnld_dir); in web_session_control()
406 ps->url.hport.hostname); in web_session_control()
412 ps->url.hport.hostname); in web_session_control()
424 ps->data.cur_pos, ps->data.content_length)) { in web_session_control()
437 ps->url.hport.hostname); in web_session_control()
443 ps->url.hport.hostname); in web_session_control()
473 ps->url.hport.hostname); in web_session_control()
479 ps->url.hport.hostname); in web_session_control()
703 if (ps->certfile) { in web_disconnect()
704 (void) unlink(ps->certfile); in web_disconnect()
706 if (http_srv_disconnect(ps->hps) == 0) in web_disconnect()
707 if (http_srv_close(ps->hps) == 0) in web_disconnect()
1625 if (url_parse(url, &ps->url) != URL_PARSE_SUCCESS) { in parse_url_proxy()
1632 if (url_parse_hostport(proxy, &ps->proxy, proxy_port) in parse_url_proxy()
1659 if ((ps->hps = http_srv_init(&ps->url)) == NULL) { in web_setup()
1660 pkgerr_add(err, PKGERR_WEB, gettext(ERR_INIT_SESS), ps->url); in web_setup()
1669 if (ps->proxy.hostname[0] != '\0' && in web_setup()
1670 http_set_proxy(ps->hps, &ps->proxy) != 0) { in web_setup()
1671 pkgerr_add(err, PKGERR_WEB, gettext(ERR_INIT_SESS), ps->url); in web_setup()
1675 if (http_set_keepalive(ps->hps, keepalive) != 0) { in web_setup()
1676 pkgerr_add(err, PKGERR_WEB, gettext(ERR_INIT_SESS), ps->url); in web_setup()
1680 if (http_set_socket_read_timeout(ps->hps, ps->timeout) != 0) { in web_setup()
1681 pkgerr_add(err, PKGERR_WEB, gettext(ERR_INIT_SESS), ps->url); in web_setup()
1685 if (http_set_random_file(ps->hps, RANDOM) != 0) { in web_setup()
1686 pkgerr_add(err, PKGERR_WEB, gettext(ERR_INIT_SESS), ps->url); in web_setup()
1721 if (ps->url.https == B_TRUE) { in web_connect()
1723 if (find_ca_certs(err, ps->keystore, &sec_cas) != 0) { in web_connect()
1742 if ((path = write_ca_file(err, ps->dwnld_dir, sec_cas, in web_connect()
1748 ps->certfile = path; in web_connect()
1749 if (http_set_password(ps->hps, WEB_CA_PHRASE) != 0) { in web_connect()
1764 if (http_srv_connect(ps->hps) != 0) { in web_connect()
1765 while ((errcode = http_get_lasterr(ps->hps, &errsrc)) != 0) { in web_connect()
1793 ps->url.hport.hostname); in web_connect()
1925 if ((http_head_request(ps->hps, ps->url.abspath)) != 0) { in web_send_request()
1926 while ((errcode = http_get_lasterr(ps->hps, in web_send_request()
1956 ps->url.hport.hostname); in web_send_request()
1969 if (http_get_range_request(ps->hps, ps->url.abspath, in web_send_request()
1971 while ((errcode = http_get_lasterr(ps->hps, in web_send_request()
2005 ps->url.hport.hostname); in web_send_request()
2021 if ((http_get_request(ps->hps, ps->url.abspath)) in web_send_request()
2023 while ((errcode = http_get_lasterr(ps->hps, in web_send_request()
2057 ps->url.hport.hostname); in web_send_request()
2100 if (http_process_headers(ps->hps, &ps->resp) != 0) { in web_eval_headers()
2101 if ((ps->resp != NULL) && (ps->resp->statusmsg != NULL)) { in web_eval_headers()
2103 ps->resp->statusmsg); in web_eval_headers()
2106 herr = http_get_lasterr(ps->hps, &errsrc); in web_eval_headers()
2155 ps->data.prev_cont_length = in web_get_file()
2156 ps->data.content_length = in web_get_file()
2157 ps->data.cur_pos = 0; in web_get_file()
2159 if ((head_val = http_get_header_value(ps->hps, in web_get_file()
2161 ps->data.content_length = atol(head_val); in web_get_file()
2172 if ((head_val = http_get_header_value(ps->hps, in web_get_file()
2195 if ((bname = get_endof_string(ps->url.abspath, '/')) == NULL) { in web_get_file()
2198 gettext(ERR_PARSE_URL), ps->url.abspath); in web_get_file()
2206 if ((head_val = http_get_header_value(ps->hps, LAST_MODIFIED_HDR)) in web_get_file()
2218 if ((ps->uniqfile = get_unique_filename(dwnld_dir, in web_get_file()
2228 if ((fd = open(ps->uniqfile, in web_get_file()
2236 if ((fd = open(ps->uniqfile, in web_get_file()
2242 ps->uniqfile); in web_get_file()
2248 ps->uniqfile, in web_get_file()
2250 ps->data.prev_cont_length = in web_get_file()
2257 ps->uniqfile); in web_get_file()
2267 ps->spool = B_FALSE; in web_get_file()
2290 ps->uniqfile); in web_get_file()
2295 ps->data.prev_cont_length = 0; in web_get_file()
2296 ps->uniqfile = xstrdup(tmp_file); in web_get_file()
2300 if (ps->data.prev_cont_length == ps->data.content_length) { in web_get_file()
2301 echo_out(nointeract, gettext(MSG_DWNLD_PREV), ps->uniqfile); in web_get_file()
2302 ps->data.cur_pos = ps->data.prev_cont_length; in web_get_file()
2311 } else if (ps->data.prev_cont_length != 0) { in web_get_file()
2312 ps->data.cur_pos = ps->data.prev_cont_length; in web_get_file()
2316 (ps->data.prev_cont_length != 0) ? in web_get_file()
2317 (ps->data.content_length - ps->data.cur_pos) : in web_get_file()
2318 ps->data.content_length)) { in web_get_file()
2324 ps->data.cur_pos, ps->data.content_length)) != WEB_OK) { in web_get_file()
2329 if (ps->data.prev_cont_length != 0) in web_get_file()
2334 progress_setup(nointeract, ps->data.content_length); in web_get_file()
2337 while (ps->data.cur_pos < ps->data.content_length) { in web_get_file()
2339 i = ((ps->data.content_length - ps->data.cur_pos) < BLOCK) ? in web_get_file()
2340 (ps->data.content_length - ps->data.cur_pos) in web_get_file()
2342 if ((n = http_read_body(ps->hps, ps->content, i)) <= 0) { in web_get_file()
2343 while ((errcode = http_get_lasterr(ps->hps, in web_get_file()
2376 ps->url.hport.hostname); in web_get_file()
2385 if ((n = write(fd, ps->content, n)) == 0) { in web_get_file()
2387 ps->uniqfile, strerror(errno)); in web_get_file()
2391 ps->data.cur_pos += n; in web_get_file()
2434 if ((ps->link = (char *)xmalloc(PATH_MAX)) == NULL) in make_link()
2436 if (((len = snprintf(ps->link, PATH_MAX, "%s/%s", in make_link()
2441 (void) link(ps->uniqfile, ps->link); in make_link()
2611 if ((ps = (WEB_SESSION *) in init_session()
2615 (void) memset(ps, 0, sizeof (*ps)); in init_session()
2617 if ((ps->content = (char *)xmalloc(BLOCK)) == NULL) { in init_session()
2621 (void) memset(ps->content, 0, BLOCK); in init_session()
2623 ps->data.cur_pos = 0UL; in init_session()
2624 ps->data.content_length = 0UL; in init_session()
2625 ps->url.https = B_FALSE; in init_session()
2626 ps->uniqfile = NULL; in init_session()
2627 ps->link = NULL; in init_session()
2628 ps->dwnld_dir = NULL; in init_session()
2629 ps->spool = B_TRUE; in init_session()
2630 ps->errstr = NULL; in init_session()
2631 ps->keystore = NULL; in init_session()
2713 if (ps->url.abspath) in get_unique_filename()
2714 if (strlcat(buf, ps->url.abspath, PATH_MAX) >= PATH_MAX) in get_unique_filename()
2716 if (ps->url.hport.hostname) in get_unique_filename()
2717 if (isdigit((int)ps->url.hport.hostname[0])) { in get_unique_filename()
2718 if (strlcat(buf, ps->url.hport.hostname, PATH_MAX) in get_unique_filename()
2723 get_startof_string(ps->url.hport.hostname, '.')) in get_unique_filename()
2962 if ((!ps->spool) || in remove_dwnld_file()
2963 (ps->data.cur_pos >= ps->data.content_length)) { in remove_dwnld_file()