Home | History | Annotate | Download | only in ftp

Lines Matching defs:ui

230 initurlinfo(struct urlinfo *ui)
232 ui->host = ui->port = ui->path = 0;
233 ui->utype = UNKNOWN_URL_T;
234 ui->portnum = 0;
248 freeurlinfo(struct urlinfo *ui)
250 FREEPTR(ui->host);
251 FREEPTR(ui->port);
252 FREEPTR(ui->path);
405 get_port(const struct urlinfo *ui)
408 switch(ui->utype) {
425 use_relative(const struct urlinfo *ui)
427 if (ui == NULL)
429 switch (ui->utype) {
474 parse_url(const char *url, const char *desc, struct urlinfo *ui,
481 if (url == NULL || desc == NULL || ui == NULL || auth == NULL)
489 ui->utype = HTTP_URL_T;
490 ui->portnum = HTTP_PORT;
493 ui->utype = FTP_URL_T;
494 ui->portnum = FTP_PORT;
497 ui->utype = FILE_URL_T;
501 ui->utype = HTTPS_URL_T;
502 ui->portnum = HTTPS_PORT;
505 copyurlinfo(ui, rui);
510 freeurlinfo(ui);
526 if (ui->utype == FTP_URL_T) /* skip first / for ftp URLs */
528 ui->path = ftp_strdup(ep);
533 if (ui->utype == FTP_URL_T)
580 ui->host = thost;
593 ui->portnum = (in_port_t)nport;
596 tport = get_port(ui);
600 ui->port = ftp_strdup(tport);
601 if (ui->path == NULL) {
603 if (ui->utype == FTP_URL_T) /* skip first / for ftp URLs */
605 ui->path = ftp_strdup(emptypath);
611 STRorNULL(ui->host), STRorNULL(ui->port),
612 ui->portnum ? ui->portnum : -1, STRorNULL(ui->path));
620 ftp_socket(const struct urlinfo *ui, void **ssl, struct authinfo *auth)
625 const char *host = ui->host;
626 const char *port = ui->port;
630 if (ui->utype != HTTPS_URL_T)
780 handle_proxy(const char *url, const char *penv, struct urlinfo *ui,
785 if (isipv6addr(ui->host) && strchr(ui->host, '%') != NULL) {
787 ui->host);
805 if (ui->utype == HTTPS_URL_T)
806 pui.path = ftp_strdup(ui->path);
811 freeurlinfo(ui);
812 *ui = pui;
818 print_host(FETCH *fin, const struct urlinfo *ui)
822 if (strchr(ui->host, ':') == NULL) {
823 fetch_printf(fin, "Host: %s", ui->host);
829 h = ftp_strdup(ui->host);
837 if ((ui->utype == HTTP_URL_T && ui->portnum != HTTP_PORT) ||
838 (ui->utype == HTTPS_URL_T && ui->portnum != HTTPS_PORT))
839 fetch_printf(fin, ":%u", ui->portnum);
865 const struct urlinfo *ui)
873 ui->host, ui->portnum);
877 fetch_printf(fin, "GET %s HTTP/1.0\r\n", ui->path);
882 fetch_printf(fin, "GET %s HTTP/1.1\r\n", ui->path);
883 print_host(fin, ui);
949 print_connect(FETCH *fin, const struct urlinfo *ui)
954 if (isipv6addr(ui->host)) {
959 if ((p = strchr(ui->host, '%')) == NULL)
960 snprintf(hname, sizeof(hname), "[%s]", ui->host);
963 (int)(p - ui->host), ui->host);
966 h = ui->host;
968 fetch_printf(fin, "CONNECT %s:%d HTTP/1.1\r\n", h, ui->portnum);
969 fetch_printf(fin, "Host: %s:%d\r\n", h, ui->portnum);
1074 volatile int *rval, struct urlinfo *ui)
1110 ui);
1121 char **auth, struct urlinfo *ui)
1243 pauth->auth, wauth->auth, ui);
1248 *rval = go_fetch(location, ui);
1255 ui);
1284 struct urlinfo *oui, struct urlinfo *ui, struct authinfo *wauth,
1353 ui);
1420 struct urlinfo ui, oui;
1436 initurlinfo(&ui);
1446 if (parse_url(url, "URL", &ui, &wauth, rui) == -1)
1449 copyurlinfo(&oui, &ui);
1451 if (ui.utype == FILE_URL_T && ! EMPTYSTRING(ui.host)
1452 && strcasecmp(ui.host, "localhost") != 0) {
1457 if (EMPTYSTRING(ui.path)) {
1458 if (ui.utype == FTP_URL_T) {
1462 if (!IS_HTTP_TYPE(ui.utype) || outfile == NULL) {
1468 decodedpath = ftp_strdup(ui.path);
1488 if (ui.utype == FTP_URL_T) {
1505 if (ui.utype == FILE_URL_T) { /* file:// URLs */
1538 (void)strlcpy(hostnamebuf, ui.host, sizeof(hostnamebuf));
1543 if (ui.utype == HTTPS_URL_T)
1546 if (penv == NULL && IS_HTTP_TYPE(ui.utype))
1548 else if (ui.utype == FTP_URL_T)
1554 isproxy = handle_noproxy(ui.host, ui.portnum);
1556 if (isproxy == 0 && ui.utype == FTP_URL_T) {
1568 if (handle_proxy(url, penv, &ui, &pauth) < 0)
1573 s = ftp_socket(&ui, &ssl, &wauth);
1575 warnx("Can't connect to `%s:%s'", ui.host, ui.port);
1595 switch (connectmethod(fin, url, penv, &oui, &ui,
1610 hasleading = print_get(fin, hasleading, isproxy, &oui, &ui);
1634 __UNVOLATILE(&auth), &ui)) {
1875 warnx("Improper response from `%s:%s'", ui.host, ui.port);
1894 freeurlinfo(&ui);
1956 struct urlinfo ui;
1963 initurlinfo(&ui);
1967 if ((parse_url(url, "URL", &ui, &auth, NULL) == -1) ||
1969 EMPTYSTRING(ui.host)) {
1979 if (! EMPTYSTRING(ui.path)
1980 && (cp = strrchr(ui.path, ';')) != NULL) {
1997 ui.utype = CLASSIC_URL_T;
1998 ui.host = ftp_strdup(url);
1999 cp = strchr(ui.host, '@');
2002 auth.user = ui.host;
2004 ui.host = ftp_strdup(cp + 1);
2006 cp = strchr(ui.host, ':');
2009 ui.path = ftp_strdup(cp + 1);
2012 if (EMPTYSTRING(ui.host))
2016 dir = ui.path;
2041 if (cp == dir && ui.utype == CLASSIC_URL_T) {
2054 if (ui.utype == FTP_URL_T && file != NULL) {
2061 STRorNULL(ui.host), STRorNULL(ui.port),
2062 STRorNULL(ui.path), STRorNULL(dir), STRorNULL(file));
2066 (ui.utype == CLASSIC_URL_T || ui.utype == FTP_URL_T)) {
2080 xargv[1] = ui.host;
2083 if (ui.port) {
2084 xargv[2] = ui.port;
2094 (connected == 1 && !ftp_login(ui.host, auth.user, auth.pass))) {
2096 ui.host, ui.port ? ui.port : "?");
2181 if (ui.utype == FTP_URL_T) {
2192 if (ui.utype == FTP_URL_T || *dir != '\0') {
2267 freeurlinfo(&ui);