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()
702 if (ps->certfile) { in web_disconnect()
703 (void) unlink(ps->certfile); in web_disconnect()
705 if (http_srv_disconnect(ps->hps) == 0) in web_disconnect()
706 if (http_srv_close(ps->hps) == 0) in web_disconnect()
1623 if (url_parse(url, &ps->url) != URL_PARSE_SUCCESS) { in parse_url_proxy()
1630 if (url_parse_hostport(proxy, &ps->proxy, proxy_port) in parse_url_proxy()
1657 if ((ps->hps = http_srv_init(&ps->url)) == NULL) { in web_setup()
1658 pkgerr_add(err, PKGERR_WEB, gettext(ERR_INIT_SESS), ps->url); in web_setup()
1667 if (ps->proxy.hostname[0] != '\0' && in web_setup()
1668 http_set_proxy(ps->hps, &ps->proxy) != 0) { in web_setup()
1669 pkgerr_add(err, PKGERR_WEB, gettext(ERR_INIT_SESS), ps->url); in web_setup()
1673 if (http_set_keepalive(ps->hps, keepalive) != 0) { in web_setup()
1674 pkgerr_add(err, PKGERR_WEB, gettext(ERR_INIT_SESS), ps->url); in web_setup()
1678 if (http_set_socket_read_timeout(ps->hps, ps->timeout) != 0) { in web_setup()
1679 pkgerr_add(err, PKGERR_WEB, gettext(ERR_INIT_SESS), ps->url); in web_setup()
1683 if (http_set_random_file(ps->hps, RANDOM) != 0) { in web_setup()
1684 pkgerr_add(err, PKGERR_WEB, gettext(ERR_INIT_SESS), ps->url); in web_setup()
1719 if (ps->url.https == B_TRUE) { in web_connect()
1721 if (find_ca_certs(err, ps->keystore, &sec_cas) != 0) { in web_connect()
1740 if ((path = write_ca_file(err, ps->dwnld_dir, sec_cas, in web_connect()
1746 ps->certfile = path; in web_connect()
1747 if (http_set_password(ps->hps, WEB_CA_PHRASE) != 0) { in web_connect()
1762 if (http_srv_connect(ps->hps) != 0) { in web_connect()
1763 while ((errcode = http_get_lasterr(ps->hps, &errsrc)) != 0) { in web_connect()
1791 ps->url.hport.hostname); in web_connect()
1923 if ((http_head_request(ps->hps, ps->url.abspath)) != 0) { in web_send_request()
1924 while ((errcode = http_get_lasterr(ps->hps, in web_send_request()
1954 ps->url.hport.hostname); in web_send_request()
1967 if (http_get_range_request(ps->hps, ps->url.abspath, in web_send_request()
1969 while ((errcode = http_get_lasterr(ps->hps, in web_send_request()
2003 ps->url.hport.hostname); in web_send_request()
2019 if ((http_get_request(ps->hps, ps->url.abspath)) in web_send_request()
2021 while ((errcode = http_get_lasterr(ps->hps, in web_send_request()
2055 ps->url.hport.hostname); in web_send_request()
2098 if (http_process_headers(ps->hps, &ps->resp) != 0) { in web_eval_headers()
2099 if ((ps->resp != NULL) && (ps->resp->statusmsg != NULL)) { in web_eval_headers()
2101 ps->resp->statusmsg); in web_eval_headers()
2104 herr = http_get_lasterr(ps->hps, &errsrc); in web_eval_headers()
2153 ps->data.prev_cont_length = in web_get_file()
2154 ps->data.content_length = in web_get_file()
2155 ps->data.cur_pos = 0; in web_get_file()
2157 if ((head_val = http_get_header_value(ps->hps, in web_get_file()
2159 ps->data.content_length = atol(head_val); in web_get_file()
2170 if ((head_val = http_get_header_value(ps->hps, in web_get_file()
2193 if ((bname = get_endof_string(ps->url.abspath, '/')) == NULL) { in web_get_file()
2196 gettext(ERR_PARSE_URL), ps->url.abspath); in web_get_file()
2204 if ((head_val = http_get_header_value(ps->hps, LAST_MODIFIED_HDR)) in web_get_file()
2216 if ((ps->uniqfile = get_unique_filename(dwnld_dir, in web_get_file()
2226 if ((fd = open(ps->uniqfile, in web_get_file()
2234 if ((fd = open(ps->uniqfile, in web_get_file()
2240 ps->uniqfile); in web_get_file()
2246 ps->uniqfile, in web_get_file()
2248 ps->data.prev_cont_length = in web_get_file()
2255 ps->uniqfile); in web_get_file()
2265 ps->spool = B_FALSE; in web_get_file()
2288 ps->uniqfile); in web_get_file()
2293 ps->data.prev_cont_length = 0; in web_get_file()
2294 ps->uniqfile = xstrdup(tmp_file); in web_get_file()
2298 if (ps->data.prev_cont_length == ps->data.content_length) { in web_get_file()
2299 echo_out(nointeract, gettext(MSG_DWNLD_PREV), ps->uniqfile); in web_get_file()
2300 ps->data.cur_pos = ps->data.prev_cont_length; in web_get_file()
2309 } else if (ps->data.prev_cont_length != 0) { in web_get_file()
2310 ps->data.cur_pos = ps->data.prev_cont_length; in web_get_file()
2314 (ps->data.prev_cont_length != 0) ? in web_get_file()
2315 (ps->data.content_length - ps->data.cur_pos) : in web_get_file()
2316 ps->data.content_length)) { in web_get_file()
2322 ps->data.cur_pos, ps->data.content_length)) != WEB_OK) { in web_get_file()
2327 if (ps->data.prev_cont_length != 0) in web_get_file()
2332 progress_setup(nointeract, ps->data.content_length); in web_get_file()
2335 while (ps->data.cur_pos < ps->data.content_length) { in web_get_file()
2337 i = ((ps->data.content_length - ps->data.cur_pos) < BLOCK) ? in web_get_file()
2338 (ps->data.content_length - ps->data.cur_pos) in web_get_file()
2340 if ((n = http_read_body(ps->hps, ps->content, i)) <= 0) { in web_get_file()
2341 while ((errcode = http_get_lasterr(ps->hps, in web_get_file()
2374 ps->url.hport.hostname); in web_get_file()
2383 if ((n = write(fd, ps->content, n)) == 0) { in web_get_file()
2385 ps->uniqfile, strerror(errno)); in web_get_file()
2389 ps->data.cur_pos += n; in web_get_file()
2432 if ((ps->link = (char *)xmalloc(PATH_MAX)) == NULL) in make_link()
2434 if (((len = snprintf(ps->link, PATH_MAX, "%s/%s", in make_link()
2439 (void) link(ps->uniqfile, ps->link); in make_link()
2609 if ((ps = (WEB_SESSION *) in init_session()
2613 (void) memset(ps, 0, sizeof (*ps)); in init_session()
2615 if ((ps->content = (char *)xmalloc(BLOCK)) == NULL) { in init_session()
2619 (void) memset(ps->content, 0, BLOCK); in init_session()
2621 ps->data.cur_pos = 0UL; in init_session()
2622 ps->data.content_length = 0UL; in init_session()
2623 ps->url.https = B_FALSE; in init_session()
2624 ps->uniqfile = NULL; in init_session()
2625 ps->link = NULL; in init_session()
2626 ps->dwnld_dir = NULL; in init_session()
2627 ps->spool = B_TRUE; in init_session()
2628 ps->errstr = NULL; in init_session()
2629 ps->keystore = NULL; in init_session()
2711 if (ps->url.abspath) in get_unique_filename()
2712 if (strlcat(buf, ps->url.abspath, PATH_MAX) >= PATH_MAX) in get_unique_filename()
2714 if (ps->url.hport.hostname) in get_unique_filename()
2715 if (isdigit((int)ps->url.hport.hostname[0])) { in get_unique_filename()
2716 if (strlcat(buf, ps->url.hport.hostname, PATH_MAX) in get_unique_filename()
2721 get_startof_string(ps->url.hport.hostname, '.')) in get_unique_filename()
2960 if ((!ps->spool) || in remove_dwnld_file()
2961 (ps->data.cur_pos >= ps->data.content_length)) { in remove_dwnld_file()