Dillo v3.1.1-46-g8a360e32
Loading...
Searching...
No Matches
http.c
Go to the documentation of this file.
1/*
2 * File: http.c
3 *
4 * Copyright (C) 2000-2007 Jorge Arellano Cid <jcid@dillo.org>
5 * Copyright (C) 2024 Rodrigo Arias Mallo <rodarima@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 */
12
18#include <config.h>
19
20#include <ctype.h> /* isdigit */
21#include <unistd.h>
22#include <errno.h> /* for errno */
23#include <stdlib.h>
24#include <fcntl.h>
25#include <assert.h>
26#include <sys/socket.h> /* for lots of socket stuff */
27#include <netinet/in.h> /* for ntohl and stuff */
28#include <arpa/inet.h> /* for inet_ntop */
29
30#include "IO.h"
31#include "iowatch.hh"
32#include "tls.h"
33#include "Url.h"
34#include "../msg.h"
35#include "../klist.h"
36#include "../dns.h"
37#include "../web.hh"
38#include "../cookies.h"
39#include "../auth.h"
40#include "../prefs.h"
41#include "../misc.h"
42
43#include "../uicmd.hh"
44
45/* Used to send a message to the bw's status bar */
46#define MSG_BW(web, root, ...) \
47D_STMT_START { \
48 if (a_Web_valid((web)) && (!(root) || (web)->flags & WEB_RootUrl)) \
49 a_UIcmd_set_msg((web)->bw, __VA_ARGS__); \
50} D_STMT_END
51
52#define _MSG_BW(web, root, ...)
53
54static const int HTTP_SOCKET_USE_PROXY = 0x1;
55static const int HTTP_SOCKET_QUEUED = 0x2;
56static const int HTTP_SOCKET_TO_BE_FREED = 0x4;
57static const int HTTP_SOCKET_TLS = 0x8;
58static const int HTTP_SOCKET_IOWATCH_ACTIVE = 0x10;
59
60/* 'web' is just a reference (no need to deallocate it here). */
61typedef struct {
62 int SockFD;
63 uint_t flags;
64 DilloWeb *web; /* reference to client's web structure */
65 DilloUrl *url;
66 Dlist *addr_list; /* Holds the DNS answer */
67 int addr_list_idx;
68 ChainLink *Info; /* Used for CCC asynchronous operations */
69 char *connected_to; /* Used for per-server connection limit */
70 uint_t connect_port;
71 Dstr *https_proxy_reply;
72} SocketData_t;
73
74/* Data structures and functions to queue sockets that need to be
75 * delayed due to the per host connection limit.
76 */
77typedef struct {
78 char *host;
79 uint_t port;
80 bool_t https;
81
82 int active_conns;
83 int running_the_queue;
84 Dlist *queue;
85} Server_t;
86
87typedef struct {
88 int fd;
89 int skey;
90} FdMapEntry_t;
91
92static void Http_socket_enqueue(Server_t *srv, SocketData_t* sock);
93static Server_t *Http_server_get(const char *host, uint_t port, bool_t https);
94static void Http_server_remove(Server_t *srv);
95static void Http_connect_socket(ChainLink *Info);
96static char *Http_get_connect_str(const DilloUrl *url);
97static void Http_send_query(SocketData_t *S);
98static void Http_socket_free(int SKey);
99
100/*
101 * Local data
102 */
103static Klist_t *ValidSocks = NULL; /* Active sockets list. It holds pointers to
104 * SocketData_t structures. */
105static DilloUrl *HTTP_Proxy = NULL;
106static char *HTTP_Proxy_Auth_base64 = NULL;
107static char *HTTP_Language_hdr = NULL;
109
110/* TODO: If fd_map will stick around in its present form (FDs and SocketData_t)
111 * then consider whether having both this and ValidSocks is necessary.
112 */
113static Dlist *fd_map;
114
118int a_Http_init(void)
119{
120 char *env_proxy = getenv("http_proxy");
121
123 dStrconcat("Accept-Language: ", prefs.http_language, "\r\n", NULL) :
124 dStrdup("");
125
126 if (env_proxy && strlen(env_proxy))
127 HTTP_Proxy = a_Url_new(env_proxy, NULL);
130
131/* This allows for storing the proxy password in "user:passwd" format
132 * in dillorc, but as this constitutes a security problem, it was disabled.
133 *
134 if (HTTP_Proxy && prefs.http_proxyuser && strchr(prefs.http_proxyuser, ':'))
135 HTTP_Proxy_Auth_base64 = a_Misc_encode_base64(prefs.http_proxyuser);
136 */
137
138 servers = dList_new(5);
139 fd_map = dList_new(20);
140
141 return 0;
142}
143
149{
150 return (HTTP_Proxy_Auth_base64 ? 1 : 0);
151}
152
156void a_Http_set_proxy_passwd(const char *str)
157{
158 char *http_proxyauth = dStrconcat(prefs.http_proxyuser, ":", str, NULL);
160 dFree(http_proxyauth);
161}
162
167static int Http_sock_new(void)
168{
169 SocketData_t *S = dNew0(SocketData_t, 1);
170 S->SockFD = -1;
171 return a_Klist_insert(&ValidSocks, S);
172}
173
177static int Http_fd_map_cmp(const void *v1, const void *v2)
178{
179 int fd = VOIDP2INT(v2);
180 const FdMapEntry_t *e = v1;
181
182 return (fd != e->fd);
183}
184
185static void Http_fd_map_add_entry(SocketData_t *sd)
186{
187 FdMapEntry_t *e = dNew0(FdMapEntry_t, 1);
188 e->fd = sd->SockFD;
189 e->skey = VOIDP2INT(sd->Info->LocalKey);
190
192 MSG_ERR("FD ENTRY ALREADY FOUND FOR %d\n", e->fd);
193 assert(0);
194 }
195
197}
198
202static void Http_fd_map_remove_entry(int fd)
203{
205
206 if (data) {
208 dFree(data);
209 } else {
210 MSG("FD ENTRY NOT FOUND FOR %d\n", fd);
211 }
212}
213
214void a_Http_connect_done(int fd, bool_t success)
215{
216 SocketData_t *sd;
217 FdMapEntry_t *fme = dList_find_custom(fd_map, INT2VOIDP(fd),
219
220 if (fme && (sd = a_Klist_get_data(ValidSocks, fme->skey))) {
221 ChainLink *info = sd->Info;
222 bool_t valid_web = a_Web_valid(sd->web);
223
224 if (success && valid_web) {
225 a_Chain_bfcb(OpSend, info, &sd->SockFD, "FD");
226 Http_send_query(sd);
227 } else {
228 if (valid_web)
229 MSG_BW(sd->web, 1, "Could not establish connection.");
230 MSG("fd %d is done and failed\n", sd->SockFD);
231 dClose(fd);
232 Http_socket_free(VOIDP2INT(info->LocalKey)); /* free sd */
233 a_Chain_bfcb(OpAbort, info, NULL, "Both");
234 dFree(info);
235 }
236 } else {
237 MSG("**** but no luck with fme %p or sd\n", (void *) fme);
238 }
239}
240
241static void Http_socket_activate(Server_t *srv, SocketData_t *sd)
242{
243 dList_remove(srv->queue, sd);
244 sd->flags &= ~HTTP_SOCKET_QUEUED;
245 srv->active_conns++;
246 sd->connected_to = srv->host;
247}
248
249static void Http_connect_queued_sockets(Server_t *srv)
250{
251 SocketData_t *sd;
252 int i;
253
254 srv->running_the_queue++;
255
256 for (i = 0;
257 (i < dList_length(srv->queue) &&
258 srv->active_conns < prefs.http_max_conns);
259 i++) {
260 sd = dList_nth_data(srv->queue, i);
261
262 if (sd->flags & HTTP_SOCKET_TO_BE_FREED) {
263 dList_remove(srv->queue, sd);
264 dFree(sd);
265 i--;
266 } else {
267 int connect_ready = TLS_CONNECT_READY;
268
269 if (sd->flags & HTTP_SOCKET_TLS)
270 connect_ready = a_Tls_connect_ready(sd->url);
271
272 if (connect_ready == TLS_CONNECT_NEVER || !a_Web_valid(sd->web)) {
273 int SKey = VOIDP2INT(sd->Info->LocalKey);
274
275 Http_socket_free(SKey);
276 } else if (connect_ready == TLS_CONNECT_READY) {
277 i--;
278 Http_socket_activate(srv, sd);
279 Http_connect_socket(sd->Info);
280 }
281 }
282 }
283
284 _MSG("Queue http%s://%s:%u len %d\n", srv->https ? "s" : "", srv->host,
285 srv->port, dList_length(srv->queue));
286
287 if (--srv->running_the_queue == 0) {
288 if (srv->active_conns == 0)
290 }
291}
292
296static void Http_socket_free(int SKey)
297{
298 SocketData_t *S;
299
300 if ((S = a_Klist_get_data(ValidSocks, SKey))) {
302
303 if (S->flags & HTTP_SOCKET_IOWATCH_ACTIVE) {
304 S->flags &= ~HTTP_SOCKET_IOWATCH_ACTIVE;
305 a_IOwatch_remove_fd(S->SockFD, -1);
306 dClose(S->SockFD);
307 }
308 dStr_free(S->https_proxy_reply, 1);
309
310 if (S->flags & HTTP_SOCKET_QUEUED) {
311 S->flags |= HTTP_SOCKET_TO_BE_FREED;
312 a_Url_free(S->url);
313 } else {
314 if (S->SockFD != -1)
315 Http_fd_map_remove_entry(S->SockFD);
317 if (S->connected_to) {
318 a_Tls_close_by_fd(S->SockFD);
319
320 Server_t *srv = Http_server_get(S->connected_to, S->connect_port,
321 (S->flags & HTTP_SOCKET_TLS));
322 srv->active_conns--;
324 }
325 a_Url_free(S->url);
326 dFree(S);
327 }
328 }
329}
330
335static char *Http_get_referer(const DilloUrl *url)
336{
337 char *referer = NULL;
338
339 if (!strcmp(prefs.http_referer, "host")) {
340 referer = dStrconcat("Referer: ", URL_SCHEME(url), "://",
341 URL_AUTHORITY(url), "/", "\r\n", NULL);
342 } else if (!strcmp(prefs.http_referer, "path")) {
343 referer = dStrconcat("Referer: ", URL_SCHEME(url), "://",
344 URL_AUTHORITY(url),
345 URL_PATH_(url) ? URL_PATH(url) : "/", "\r\n", NULL);
346 }
347 if (!referer)
348 referer = dStrdup("");
349 _MSG("http, referer='%s'\n", referer);
350 return referer;
351}
352
357{
358 Dstr *dstr;
359
360 if (URL_FLAGS(url) & URL_MultipartEnc) {
361 _MSG("submitting multipart/form-data!\n");
362 dstr = dStr_new("multipart/form-data; boundary=\"");
363 if (URL_DATA(url)->len > 2) {
364 /* boundary lines have "--" prepended. Skip that. */
365 const char *start = URL_DATA(url)->str + 2;
366 char *eol = strchr(start, '\r');
367 if (eol)
368 dStr_append_l(dstr, start, eol - start);
369 } else {
370 /* Zero parts; arbitrary boundary */
371 dStr_append_c(dstr, '0');
372 }
373 dStr_append_c(dstr,'"');
374 } else {
375 dstr = dStr_new("application/x-www-form-urlencoded");
376 }
377 return dstr;
378}
379
383static Dstr *Http_make_query_str(DilloWeb *web, bool_t use_proxy)
384{
385 char *ptr, *cookies, *referer, *auth;
386 const DilloUrl *url = web->url;
387 Dstr *query = dStr_new(""),
388 *request_uri = dStr_new(""),
389 *proxy_auth = dStr_new("");
390
391 /* BUG: dillo doesn't actually understand application/xml yet */
392 const char *accept_hdr_value =
393 web->flags & WEB_Image ? "image/png,image/*;q=0.8,*/*;q=0.5" :
394 web->flags & WEB_Stylesheet ? "text/css,*/*;q=0.1" :
395 "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
396
397 const char *connection_hdr_val =
398 (prefs.http_persistent_conns == TRUE) ? "keep-alive" : "close";
399
400 if (use_proxy) {
401 dStr_sprintfa(request_uri, "%s%s",
402 URL_STR(url),
403 (URL_PATH_(url) || URL_QUERY_(url)) ? "" : "/");
404 if ((ptr = strrchr(request_uri->str, '#')))
405 dStr_truncate(request_uri, ptr - request_uri->str);
407 dStr_sprintf(proxy_auth, "Proxy-Authorization: Basic %s\r\n",
409 } else {
410 dStr_sprintfa(request_uri, "%s%s%s%s",
411 URL_PATH(url),
412 URL_QUERY_(url) ? "?" : "",
413 URL_QUERY(url),
414 (URL_PATH_(url) || URL_QUERY_(url)) ? "" : "/");
415 }
416
417 cookies = a_Cookies_get_query(url, web->requester);
418 auth = a_Auth_get_auth_str(url, request_uri->str);
419 referer = Http_get_referer(url);
420 if (URL_FLAGS(url) & URL_Post) {
421 Dstr *content_type = Http_make_content_type(url);
423 query,
424 "POST %s HTTP/1.1\r\n"
425 "Host: %s\r\n"
426 "User-Agent: %s\r\n"
427 "Accept: %s\r\n"
428 "%s" /* language */
429 "Accept-Encoding: gzip, deflate\r\n"
430 "%s" /* auth */
431 "DNT: 1\r\n"
432 "%s" /* proxy auth */
433 "%s" /* referer */
434 "Connection: %s\r\n"
435 "Content-Type: %s\r\n"
436 "Content-Length: %ld\r\n"
437 "%s" /* cookies */
438 "\r\n",
439 request_uri->str, URL_AUTHORITY(url), prefs.http_user_agent,
440 accept_hdr_value, HTTP_Language_hdr, auth ? auth : "",
441 proxy_auth->str, referer, connection_hdr_val, content_type->str,
442 (long)URL_DATA(url)->len, cookies);
443 dStr_append_l(query, URL_DATA(url)->str, URL_DATA(url)->len);
444 dStr_free(content_type, TRUE);
445 } else {
447 query,
448 "GET %s HTTP/1.1\r\n"
449 "Host: %s\r\n"
450 "User-Agent: %s\r\n"
451 "Accept: %s\r\n"
452 "%s" /* language */
453 "Accept-Encoding: gzip, deflate\r\n"
454 "%s" /* auth */
455 "DNT: 1\r\n"
456 "%s" /* proxy auth */
457 "%s" /* referer */
458 "Connection: %s\r\n"
459 "%s" /* cache control */
460 "%s" /* cookies */
461 "\r\n",
462 request_uri->str, URL_AUTHORITY(url), prefs.http_user_agent,
463 accept_hdr_value, HTTP_Language_hdr, auth ? auth : "",
464 proxy_auth->str, referer, connection_hdr_val,
465 (URL_FLAGS(url) & URL_E2EQuery) ?
466 "Pragma: no-cache\r\nCache-Control: no-cache\r\n" : "",
467 cookies);
468 }
469 dFree(referer);
470 dFree(cookies);
471 dFree(auth);
472
473 dStr_free(request_uri, TRUE);
474 dStr_free(proxy_auth, TRUE);
475 _MSG("Query: {%s}\n", dStr_printable(query, 8192));
476 return query;
477}
478
482static void Http_send_query(SocketData_t *S)
483{
484 Dstr *query;
485 DataBuf *dbuf;
486
487 /* Create the query */
488 query = Http_make_query_str(S->web, S->flags & HTTP_SOCKET_USE_PROXY);
489 dbuf = a_Chain_dbuf_new(query->str, query->len, 0);
490
491 MSG_BW(S->web, 1, "Sending query%s...",
492 S->flags & HTTP_SOCKET_USE_PROXY ? " through proxy" : "");
493
494 /* send query */
495 a_Chain_bcb(OpSend, S->Info, dbuf, NULL);
496 dFree(dbuf);
497 dStr_free(query, 1);
498}
499
503static void Http_connect_tls(ChainLink *info)
504{
505 int SKey = VOIDP2INT(info->LocalKey);
506 SocketData_t *S = a_Klist_get_data(ValidSocks, SKey);
507
508 if (S->flags & HTTP_SOCKET_USE_PROXY) {
509 char *connect_str = Http_get_connect_str(S->url);
510 DataBuf *dbuf = a_Chain_dbuf_new(connect_str, strlen(connect_str), 0);
511
512 MSG_BW(S->web, 1, "Tunnel secure connection through proxy...");
513 a_Chain_bfcb(OpSend, info, &S->SockFD, "FD");
514 S->https_proxy_reply = dStr_new(NULL);
515 a_Chain_bcb(OpSend, info, dbuf, NULL);
516
517 dFree(dbuf);
518 dFree(connect_str);
519 } else {
520 MSG_BW(S->web, 1, "Secure connection negotiation...");
521 a_Tls_connect(S->SockFD, S->url);
522 }
523}
524
528static void Http_connect_socket_cb(int fd, void *data)
529{
530 int SKey = VOIDP2INT(data);
531 SocketData_t *S = a_Klist_get_data(ValidSocks, SKey);
532
533 if (S) {
534 int ret, connect_ret;
535 uint_t connect_ret_size = sizeof(connect_ret);
536
537 a_IOwatch_remove_fd(fd, -1);
538 S->flags &= ~HTTP_SOCKET_IOWATCH_ACTIVE;
539
540 ret = getsockopt(S->SockFD, SOL_SOCKET, SO_ERROR, &connect_ret,
541 &connect_ret_size);
542
543 if (ret < 0 || connect_ret != 0) {
544 if (ret < 0) {
545 MSG("Http_connect_socket_cb getsockopt ERROR: %s.\n",
546 dStrerror(errno));
547 } else {
548 MSG("Http_connect_socket_cb connect ERROR: %s.\n",
549 dStrerror(connect_ret));
550 }
551 MSG("Http_connect_socket() will try another IP address.\n");
552 S->addr_list_idx++;
553 Http_connect_socket(S->Info);
554 } else if (S->flags & HTTP_SOCKET_TLS) {
555 Http_connect_tls(S->Info);
556 } else {
557 a_Http_connect_done(S->SockFD, TRUE);
558 }
559 }
560}
561
567{
568 DilloHost *dh;
569 SocketData_t *S = a_Klist_get_data(ValidSocks, VOIDP2INT(Info->LocalKey));
570
571 for (; (dh = dList_nth_data(S->addr_list, S->addr_list_idx));
572 S->addr_list_idx++) {
573#ifdef ENABLE_IPV6
574 struct sockaddr_in6 name;
575#else
576 struct sockaddr_in name;
577#endif
578 socklen_t socket_len = 0;
579
580 if (S->addr_list_idx > 0 && S->SockFD >= 0) {
581 /* clean up the previous one that failed */
582 Http_fd_map_remove_entry(S->SockFD);
583 dClose(S->SockFD);
584 }
585 if ((S->SockFD = socket(dh->af, SOCK_STREAM, IPPROTO_TCP)) < 0) {
586 MSG("Http_connect_socket socket() ERROR: %s\n", dStrerror(errno));
587 continue;
588 }
590
591 /* set NONBLOCKING and close on exec. */
592 fcntl(S->SockFD, F_SETFL, O_NONBLOCK | fcntl(S->SockFD, F_GETFL));
593 fcntl(S->SockFD, F_SETFD, FD_CLOEXEC | fcntl(S->SockFD, F_GETFD));
594
595 /* Some OSes require this... */
596 memset(&name, 0, sizeof(name));
597 /* Set remaining parms. */
598 switch (dh->af) {
599 case AF_INET:
600 {
601 struct sockaddr_in *sin = (struct sockaddr_in *)&name;
602 socket_len = sizeof(struct sockaddr_in);
603 sin->sin_family = dh->af;
604 sin->sin_port = htons(S->connect_port);
605 memcpy(&sin->sin_addr, dh->data, (size_t)dh->alen);
606 if (a_Web_valid(S->web) && (S->web->flags & WEB_RootUrl))
607 MSG("Connecting to %s:%u\n", inet_ntoa(sin->sin_addr),
608 S->connect_port);
609 break;
610 }
611#ifdef ENABLE_IPV6
612 case AF_INET6:
613 {
614 char buf[128];
615 struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&name;
616 socket_len = sizeof(struct sockaddr_in6);
617 sin6->sin6_family = dh->af;
618 sin6->sin6_port = htons(S->connect_port);
619 memcpy(&sin6->sin6_addr, dh->data, dh->alen);
620 inet_ntop(dh->af, dh->data, buf, sizeof(buf));
621 if (a_Web_valid(S->web) && (S->web->flags & WEB_RootUrl))
622 MSG("Connecting to [%s]:%u\n", buf, S->connect_port);
623 break;
624 }
625#endif
626 } /* switch */
627 MSG_BW(S->web, 1, "Contacting host...");
628
629 if (connect(S->SockFD, (struct sockaddr *)&name, socket_len) == 0) {
630 /* probably never succeeds immediately on any system */
631 if (S->flags & HTTP_SOCKET_TLS) {
632 Http_connect_tls(Info);
633 break;
634 } else {
635 a_Http_connect_done(S->SockFD, TRUE);
636 break;
637 }
638 } else {
639 if (errno == EINPROGRESS) {
641 Info->LocalKey);
642 S->flags |= HTTP_SOCKET_IOWATCH_ACTIVE;
643 break;
644 } else {
645 MSG("Http_connect_socket connect ERROR: %s\n", dStrerror(errno));
646 MSG("We will try another IP address.\n");
647 }
648 }
649 } /* for */
650
651 if (S->addr_list_idx >= dList_length(S->addr_list) ) {
652 MSG("Http_connect_socket ran out of IP addrs to try.\n");
653 a_Http_connect_done(S->SockFD, FALSE);
654 }
655}
656
661static int Http_must_use_proxy(const char *hostname)
662{
663 char *np, *p, *tok;
664 int ret = 0;
665
666 if (HTTP_Proxy) {
667 ret = 1;
668 if (prefs.no_proxy) {
669 size_t host_len = strlen(hostname);
670
671 np = dStrdup(prefs.no_proxy);
672 for (p = np; (tok = dStrsep(&p, " ")); ) {
673 int start = host_len - strlen(tok);
674
675 if (start >= 0 && dStrAsciiCasecmp(hostname + start, tok) == 0) {
676 /* no_proxy token is suffix of host string */
677 ret = 0;
678 break;
679 }
680 }
681 dFree(np);
682 }
683 }
684 _MSG("Http_must_use_proxy: %s\n %s\n", hostname, ret ? "YES":"NO");
685 return ret;
686}
687
691static char *Http_get_connect_str(const DilloUrl *url)
692{
693 Dstr *dstr;
694 const char *auth1;
695 int auth_len;
696 char *auth2, *proxy_auth, *retstr;
697
699
700 dstr = dStr_new("");
701 auth1 = URL_AUTHORITY(url);
702 auth_len = strlen(auth1);
703 if (auth_len > 0 && !isdigit(auth1[auth_len - 1]))
704 /* if no port number, add HTTPS port */
705 auth2 = dStrconcat(auth1, ":443", NULL);
706 else
707 auth2 = dStrdup(auth1);
708 proxy_auth = HTTP_Proxy_Auth_base64 ?
709 dStrconcat ("Proxy-Authorization: Basic ",
710 HTTP_Proxy_Auth_base64, "\r\n", NULL) :
711 dStrdup("");
713 dstr,
714 "CONNECT %s HTTP/1.1\r\n"
715 "Host: %s\r\n"
716 "%s"
717 "\r\n",
718 auth2,
719 auth2,
720 proxy_auth);
721
722 dFree(auth2);
723 dFree(proxy_auth);
724 retstr = dstr->str;
725 dStr_free(dstr, 0);
726 return retstr;
727}
728
734static void Http_dns_cb(int Status, Dlist *addr_list, void *data)
735{
736 int SKey = VOIDP2INT(data);
737 bool_t clean_up = TRUE;
738 SocketData_t *S;
739 Server_t *srv;
740
741 S = a_Klist_get_data(ValidSocks, SKey);
742 if (S) {
743 const char *host = URL_HOST((S->flags & HTTP_SOCKET_USE_PROXY) ?
744 HTTP_Proxy : S->url);
745 if (a_Web_valid(S->web)) {
746 if (Status == 0 && addr_list) {
747
748 /* Successful DNS answer; save the IP */
749 S->addr_list = addr_list;
750 S->addr_list_idx = 0;
751 clean_up = FALSE;
752 srv = Http_server_get(host, S->connect_port,
753 (S->flags & HTTP_SOCKET_TLS));
754 Http_socket_enqueue(srv, S);
756 } else {
757 /* DNS wasn't able to resolve the hostname */
758 MSG_BW(S->web, 0, "ERROR: DNS can't resolve %s", host);
759 }
760 }
761 if (clean_up) {
762 ChainLink *info = S->Info;
763
764 Http_socket_free(SKey);
765 a_Chain_bfcb(OpAbort, info, NULL, "Both");
766 dFree(info);
767 }
768 }
769}
770
778static int Http_get(ChainLink *Info, void *Data1)
779{
780 SocketData_t *S;
781 char *hostname;
782 const DilloUrl *url;
783
785 /* Reference Web data */
786 S->web = Data1;
787 /* Reference Info data */
788 S->Info = Info;
789
790 /* Proxy support */
791 if (Http_must_use_proxy(URL_HOST(S->web->url))) {
792 url = HTTP_Proxy;
794 } else {
795 url = S->web->url;
796 }
797 hostname = dStrdup(URL_HOST(url));
798 S->connect_port = URL_PORT(url);
799 S->url = a_Url_dup(S->web->url);
800 if (!dStrAsciiCasecmp(URL_SCHEME(S->url), "https"))
801 S->flags |= HTTP_SOCKET_TLS;
802
803 /* Let the user know what we'll do */
804 MSG_BW(S->web, 1, "DNS resolving %s", hostname);
805
806 /* Let the DNS engine resolve the hostname, and when done,
807 * we'll try to connect the socket from the callback function */
808 a_Dns_resolve(hostname, Http_dns_cb, Info->LocalKey);
809
810 dFree(hostname);
811 return 0;
812}
813
820static bool_t Http_socket_reuse_compatible(SocketData_t *old,
821 SocketData_t *new)
822{
823 /*
824 * If we are using TLS through a proxy, we need to ensure that old and new
825 * are going through to the same host:port.
826 */
827 if (a_Web_valid(new->web) &&
828 ((old->flags & HTTP_SOCKET_TLS) == 0 ||
829 (old->flags & HTTP_SOCKET_USE_PROXY) == 0 ||
830 ((URL_PORT(old->url) == URL_PORT(new->url)) &&
831 !dStrAsciiCasecmp(URL_HOST(old->url), URL_HOST(new->url)))))
832 return TRUE;
833 return FALSE;
834}
835
840static void Http_socket_reuse(int SKey)
841{
842 SocketData_t *new_sd, *old_sd = a_Klist_get_data(ValidSocks, SKey);
843
844 if (old_sd) {
845 Server_t *srv = Http_server_get(old_sd->connected_to,
846 old_sd->connect_port,
847 (old_sd->flags & HTTP_SOCKET_TLS));
848 int i, n = dList_length(srv->queue);
849
850 for (i = 0; i < n; i++) {
851 new_sd = dList_nth_data(srv->queue, i);
852
853 if (!(new_sd->flags & HTTP_SOCKET_TO_BE_FREED) &&
854 Http_socket_reuse_compatible(old_sd, new_sd)) {
855 const bool_t success = TRUE;
856
857 new_sd->SockFD = old_sd->SockFD;
858
859 old_sd->connected_to = NULL;
860 srv->active_conns--;
861 Http_socket_free(SKey);
862
863 _MSG("Reusing fd %d for %s\n",new_sd->SockFD,URL_STR(new_sd->url));
864 Http_socket_activate(srv, new_sd);
865 Http_fd_map_add_entry(new_sd);
866 a_Http_connect_done(new_sd->SockFD, success);
867 return;
868 }
869 }
870 /* Free the connection before closing the file descriptor, so more data
871 * can be written. */
872 int old_fd = old_sd->SockFD;
873 Http_socket_free(SKey);
874 dClose(old_fd);
875 }
876}
877
881void a_Http_ccc(int Op, int Branch, int Dir, ChainLink *Info,
882 void *Data1, void *Data2)
883{
884 int SKey = VOIDP2INT(Info->LocalKey);
885 SocketData_t *sd;
886 DataBuf *dbuf;
887
888 dReturn_if_fail( a_Chain_check("a_Http_ccc", Op, Branch, Dir, Info) );
889
890 if (Branch == 1) {
891 if (Dir == BCK) {
892 /* HTTP query branch */
893 switch (Op) {
894 case OpStart:
895 /* ( Data1 = Web ) */
896 SKey = Http_sock_new();
897 Info->LocalKey = INT2VOIDP(SKey);
898 /* link IO */
900 a_Chain_bcb(OpStart, Info, NULL, NULL);
901 /* async. connection */
902 Http_get(Info, Data1);
903 break;
904 case OpEnd:
905 /* finished the HTTP query branch */
906 a_Chain_bcb(OpEnd, Info, NULL, NULL);
907 dFree(Info);
908 break;
909 case OpAbort:
910 _MSG("ABORT 1B\n");
911 Http_socket_free(SKey);
912 a_Chain_bcb(OpAbort, Info, NULL, NULL);
913 dFree(Info);
914 break;
915 default:
916 MSG_WARN("Unused CCC 1B Op %d\n", Op);
917 break;
918 }
919 } else { /* 1 FWD */
920 /* HTTP send-query status branch */
921 switch (Op) {
922 case OpAbort:
923 _MSG("ABORT 1F\n");
924 if ((sd = a_Klist_get_data(ValidSocks, SKey)))
925 MSG_BW(sd->web, 1, "Can't get %s", URL_STR(sd->url));
926 Http_socket_free(SKey);
927 a_Chain_fcb(OpAbort, Info, NULL, "Both");
928 dFree(Info);
929 break;
930 default:
931 MSG_WARN("Unused CCC 1F Op %d\n", Op);
932 break;
933 }
934 }
935 } else if (Branch == 2) {
936 if (Dir == FWD) {
937 sd = a_Klist_get_data(ValidSocks, SKey);
938 assert(sd);
939 /* Receiving from server */
940 switch (Op) {
941 case OpSend:
942 if (sd->https_proxy_reply) {
943 dbuf = Data1;
944 dStr_append(sd->https_proxy_reply, dbuf->Buf);
945 if (strstr(sd->https_proxy_reply->str, "\r\n\r\n")) {
946 if (sd->https_proxy_reply->len >= 12 &&
947 sd->https_proxy_reply->str[9] == '2') {
948 /* e.g. "HTTP/1.1 200 Connection established[...]" */
949 MSG("CONNECT through proxy succeeded. Reply:\n%s\n",
950 sd->https_proxy_reply->str);
951 dStr_free(sd->https_proxy_reply, 1);
952 sd->https_proxy_reply = NULL;
953 MSG_BW(sd->web, 1, "Secure connection negotiation...");
954 a_Tls_connect(sd->SockFD, sd->url);
955 } else {
956 MSG_BW(sd->web, 1, "Can't connect through proxy to %s",
957 URL_HOST(sd->url));
958 MSG("CONNECT through proxy failed. Server sent:\n%s\n",
959 sd->https_proxy_reply->str);
960 Http_socket_free(SKey);
961 a_Chain_bfcb(OpAbort, Info, NULL, "Both");
962 dFree(Info);
963 }
964 }
965 } else {
966 /* Data1 = dbuf */
967 a_Chain_fcb(OpSend, Info, Data1, "send_page_2eof");
968 }
969 break;
970 case OpEnd:
971 if (sd->https_proxy_reply) {
972 MSG("CONNECT through proxy failed. "
973 "Full reply not received:\n%s\n",
974 sd->https_proxy_reply->len ? sd->https_proxy_reply->str :
975 "(nothing)");
976 Http_socket_free(SKey);
977 a_Chain_bfcb(OpAbort, Info, NULL, "Both");
978 } else {
979 Http_socket_free(SKey);
980 a_Chain_fcb(OpEnd, Info, NULL, NULL);
981 }
982 dFree(Info);
983 break;
984 case OpAbort:
985 if (sd->https_proxy_reply) {
986 MSG("CONNECT through proxy failed. "
987 "Full reply not received:\n%s\n",
988 sd->https_proxy_reply->len ? sd->https_proxy_reply->str :
989 "(nothing)");
990 }
991 Http_socket_free(SKey);
992 a_Chain_fcb(OpAbort, Info, NULL, "Both");
993 dFree(Info);
994 break;
995 default:
996 MSG_WARN("Unused CCC 2F Op %d\n", Op);
997 break;
998 }
999 } else { /* 2 BCK */
1000 switch (Op) {
1001 case OpStart:
1002 a_Chain_link_new(Info, a_Http_ccc, BCK, a_IO_ccc, 2, 2);
1003 a_Chain_bcb(OpStart, Info, NULL, NULL); /* IORead */
1004 break;
1005 case OpSend:
1006 if (Data2) {
1007 if (!strcmp(Data2, "FD")) {
1008 int fd = *(int*)Data1;
1009 FdMapEntry_t *fme = dList_find_custom(fd_map, INT2VOIDP(fd),
1011 Info->LocalKey = INT2VOIDP(fme->skey);
1012 a_Chain_bcb(OpSend, Info, Data1, Data2);
1013 } else if (!strcmp(Data2, "reply_complete")) {
1014 a_Chain_bfcb(OpEnd, Info, NULL, NULL);
1015 Http_socket_reuse(SKey);
1016 dFree(Info);
1017 }
1018 }
1019 break;
1020 case OpAbort:
1021 Http_socket_free(SKey);
1022 a_Chain_bcb(OpAbort, Info, NULL, NULL);
1023 dFree(Info);
1024 break;
1025 default:
1026 MSG_WARN("Unused CCC 2B Op %d\n", Op);
1027 break;
1028 }
1029 }
1030 }
1031}
1032
1037static void Http_socket_enqueue(Server_t *srv, SocketData_t* sock)
1038{
1039 sock->flags |= HTTP_SOCKET_QUEUED;
1040
1041 if ((sock->web->flags & WEB_Image) == 0) {
1042 int i, n = dList_length(srv->queue);
1043
1044 for (i = 0; i < n; i++) {
1045 SocketData_t *curr = dList_nth_data(srv->queue, i);
1046
1047 if (a_Web_valid(curr->web) && (curr->web->flags & WEB_Image)) {
1048 dList_insert_pos(srv->queue, sock, i);
1049 return;
1050 }
1051 }
1052 }
1053 dList_append(srv->queue, sock);
1054}
1055
1056static Server_t *Http_server_get(const char *host, uint_t port, bool_t https)
1057{
1058 int i;
1059 Server_t *srv;
1060
1061 for (i = 0; i < dList_length(servers); i++) {
1062 srv = (Server_t*) dList_nth_data(servers, i);
1063
1064 if (port == srv->port && https == srv->https &&
1065 !dStrAsciiCasecmp(host, srv->host))
1066 return srv;
1067 }
1068
1069 srv = dNew0(Server_t, 1);
1070 srv->queue = dList_new(10);
1071 srv->running_the_queue = 0;
1072 srv->host = dStrdup(host);
1073 srv->port = port;
1074 srv->https = https;
1075 dList_append(servers, srv);
1076
1077 return srv;
1078}
1079
1080static void Http_server_remove(Server_t *srv)
1081{
1082 SocketData_t *sd;
1083
1084 while ((sd = dList_nth_data(srv->queue, 0))) {
1085 dList_remove_fast(srv->queue, sd);
1086 dFree(sd);
1087 }
1088 dList_free(srv->queue);
1090 dFree(srv->host);
1091 dFree(srv);
1092}
1093
1095{
1096 Server_t *srv;
1097 SocketData_t *sd;
1098
1099 while (dList_length(servers) > 0) {
1100 srv = (Server_t*) dList_nth_data(servers, 0);
1101 while ((sd = dList_nth_data(srv->queue, 0))) {
1102 dList_remove(srv->queue, sd);
1103 dFree(sd);
1104 }
1105 Http_server_remove(srv);
1106 }
1108}
1109
1110static void Http_fd_map_remove_all(void)
1111{
1112 FdMapEntry_t *fme;
1113 int i, n = dList_length(fd_map);
1114
1115 for (i = 0; i < n; i++) {
1116 fme = (FdMapEntry_t *) dList_nth_data(fd_map, i);
1117 dFree(fme);
1118 }
1120}
1121
void a_IO_ccc(int Op, int Branch, int Dir, ChainLink *Info, void *Data1, void *Data2)
CCC function for the IO module.
Definition IO.c:359
char * a_Auth_get_auth_str(const DilloUrl *url, const char *request_uri)
Return the authorization header for an HTTP query.
Definition auth.c:472
#define _MSG(...)
Definition bookmarks.c:45
#define MSG(...)
Definition bookmarks.c:46
int a_Chain_bcb(int Op, ChainLink *Info, void *Data1, void *Data2)
Issue the backward callback of the 'Info' link.
Definition chain.c:126
DataBuf * a_Chain_dbuf_new(void *buf, int size, int code)
Allocate and initialize a new DataBuf structure.
Definition chain.c:171
ChainLink * a_Chain_link_new(ChainLink *AInfo, ChainFunction_t AFunc, int Direction, ChainFunction_t BFunc, int AtoB_branch, int BtoA_branch)
Create a new link from module A to module B.
Definition chain.c:55
int a_Chain_check(char *FuncStr, int Op, int Branch, int Dir, ChainLink *Info)
Check whether the CCC is operative.
Definition chain.c:186
int a_Chain_bfcb(int Op, ChainLink *Info, void *Data1, void *Data2)
Issue the backward callback of the 'Info' link and then the forward callback (used for OpAbort and Op...
Definition chain.c:150
int a_Chain_fcb(int Op, ChainLink *Info, void *Data1, void *Data2)
Issue the forward callback of the 'Info' link.
Definition chain.c:103
#define OpAbort
Definition chain.h:17
#define FWD
Definition chain.h:29
#define OpStart
Definition chain.h:13
#define BCK
Definition chain.h:30
#define OpSend
Definition chain.h:14
#define OpEnd
Definition chain.h:16
unsigned int uint_t
Definition d_size.h:20
unsigned char bool_t
Definition d_size.h:21
char * dStrconcat(const char *s1,...)
Concatenate a NULL-terminated list of strings.
Definition dlib.c:102
char * dStrsep(char **orig, const char *delim)
strsep() implementation
Definition dlib.c:159
void dFree(void *mem)
Definition dlib.c:68
int dStrAsciiCasecmp(const char *s1, const char *s2)
Definition dlib.c:203
void dStr_sprintfa(Dstr *ds, const char *format,...)
Printf-like function that appends.
Definition dlib.c:464
void dStr_append(Dstr *ds, const char *s)
Append a C string to a Dstr.
Definition dlib.c:316
void dList_insert_pos(Dlist *lp, void *data, int pos0)
Insert an element at a given position [0 based].
Definition dlib.c:576
char * dStrdup(const char *s)
Definition dlib.c:77
Dlist * dList_new(int size)
Create a new empty list.
Definition dlib.c:548
int dList_length(Dlist *lp)
For completing the ADT.
Definition dlib.c:613
void * dList_nth_data(Dlist *lp, int n0)
Return the nth data item, NULL when not found or 'n0' is out of range.
Definition dlib.c:662
void dList_remove_fast(Dlist *lp, const void *data)
Remove a data item without preserving order.
Definition dlib.c:623
void dStr_free(Dstr *ds, int all)
Free a dillo string.
Definition dlib.c:337
int dClose(int fd)
Close a FD handling EINTR.
Definition dlib.c:951
void dStr_append_l(Dstr *ds, const char *s, int l)
Append a C string to a Dstr (providing length).
Definition dlib.c:308
void dStr_append_c(Dstr *ds, int c)
Append one character.
Definition dlib.c:349
void dStr_sprintf(Dstr *ds, const char *format,...)
Printf-like function.
Definition dlib.c:450
Dstr * dStr_new(const char *s)
Create a new string.
Definition dlib.c:325
void dList_append(Dlist *lp, void *data)
Append a data item to the list.
Definition dlib.c:597
void dList_free(Dlist *lp)
Free a list (not its elements)
Definition dlib.c:564
void * dList_find_custom(Dlist *lp, const void *data, dCompareFunc func)
Search a data item using a custom function.
Definition dlib.c:704
const char * dStr_printable(Dstr *in, int maxlen)
Return a printable representation of the provided Dstr, limited to a length of roughly maxlen.
Definition dlib.c:513
void dStr_truncate(Dstr *ds, int len)
Truncate a Dstr to be 'len' bytes long.
Definition dlib.c:368
void dList_remove(Dlist *lp, const void *data)
Definition dlib.c:641
#define dStrerror
Definition dlib.h:95
#define dReturn_if_fail(expr)
Definition dlib.h:72
#define dNew0(type, count)
Definition dlib.h:51
#define dReturn_val_if_fail(expr, val)
Definition dlib.h:76
#define VOIDP2INT(p)
Definition dlib.h:43
#define TRUE
Definition dlib.h:23
#define FALSE
Definition dlib.h:19
#define INT2VOIDP(i)
Definition dlib.h:44
void a_Dns_resolve(const char *hostname, DnsCallback_t cb_func, void *cb_data)
Return the IP for the given hostname using a callback.
Definition dns.c:361
#define MSG_ERR(...)
Definition dpid_common.h:23
static Dstr * Http_make_query_str(DilloWeb *web, bool_t use_proxy)
Make the http query string.
Definition http.c:383
void a_Http_set_proxy_passwd(const char *str)
Activate entered proxy password for HTTP.
Definition http.c:156
static char * HTTP_Language_hdr
Definition http.c:107
static Dlist * fd_map
Definition http.c:113
int a_Http_init(void)
Initialize proxy vars and Accept-Language header.
Definition http.c:118
static int Http_get(ChainLink *Info, void *Data1)
Asynchronously create a new http connection for 'Url'.
Definition http.c:778
static int Http_fd_map_cmp(const void *v1, const void *v2)
Compare by FD.
Definition http.c:177
static Klist_t * ValidSocks
Definition http.c:103
static void Http_fd_map_remove_all(void)
Definition http.c:1110
#define MSG_BW(web, root,...)
Definition http.c:46
static bool_t Http_socket_reuse_compatible(SocketData_t *old, SocketData_t *new)
Can the old socket's fd be reused for the new socket?.
Definition http.c:820
static const int HTTP_SOCKET_TO_BE_FREED
Definition http.c:56
static void Http_server_remove(Server_t *srv)
Definition http.c:1080
static void Http_fd_map_add_entry(SocketData_t *sd)
Definition http.c:185
static const int HTTP_SOCKET_QUEUED
Definition http.c:55
static void Http_socket_reuse(int SKey)
If any entry in the socket data queue can reuse our connection, set it up and send off a new query.
Definition http.c:840
static void Http_connect_socket(ChainLink *Info)
This function is called after the DNS succeeds in solving a hostname.
Definition http.c:566
static void Http_send_query(SocketData_t *S)
Create and submit the HTTP query to the IO engine.
Definition http.c:482
static int Http_must_use_proxy(const char *hostname)
Test proxy settings and check the no_proxy domains list.
Definition http.c:661
static char * Http_get_referer(const DilloUrl *url)
Make the HTTP header's Referer line according to preferences (default is "host" i....
Definition http.c:335
static void Http_socket_free(int SKey)
Free SocketData_t struct.
Definition http.c:296
static DilloUrl * HTTP_Proxy
Definition http.c:105
static void Http_socket_enqueue(Server_t *srv, SocketData_t *sock)
Add socket data to the queue.
Definition http.c:1037
static Dlist * servers
Definition http.c:108
void a_Http_connect_done(int fd, bool_t success)
Definition http.c:214
static void Http_socket_activate(Server_t *srv, SocketData_t *sd)
Definition http.c:241
static int Http_sock_new(void)
Create and init a new SocketData_t struct, insert into ValidSocks, and return a primary key for it.
Definition http.c:167
static void Http_dns_cb(int Status, Dlist *addr_list, void *data)
Callback function for the DNS resolver.
Definition http.c:734
static char * Http_get_connect_str(const DilloUrl *url)
Return a new string for the request used to tunnel HTTPS through a proxy.
Definition http.c:691
static void Http_connect_tls(ChainLink *info)
Prepare an HTTPS connection.
Definition http.c:503
static void Http_fd_map_remove_entry(int fd)
Remove and free entry from fd_map.
Definition http.c:202
static char * HTTP_Proxy_Auth_base64
Definition http.c:106
void a_Http_freeall(void)
Deallocate memory used by http module.
Definition http.c:1126
int a_Http_proxy_auth(void)
Tell whether the proxy auth is already set (user:password).
Definition http.c:148
static Server_t * Http_server_get(const char *host, uint_t port, bool_t https)
Definition http.c:1056
static void Http_connect_socket_cb(int fd, void *data)
connect() couldn't complete before, but now it's ready, so let's try again.
Definition http.c:528
static const int HTTP_SOCKET_USE_PROXY
Definition http.c:54
static const int HTTP_SOCKET_TLS
Definition http.c:57
static Dstr * Http_make_content_type(const DilloUrl *url)
Generate Content-Type header value for a POST query.
Definition http.c:356
void a_Http_ccc(int Op, int Branch, int Dir, ChainLink *Info, void *Data1, void *Data2)
CCC function for the HTTP module.
Definition http.c:881
static void Http_connect_queued_sockets(Server_t *srv)
Definition http.c:249
static void Http_servers_remove_all(void)
Definition http.c:1094
static const int HTTP_SOCKET_IOWATCH_ACTIVE
Definition http.c:58
void a_IOwatch_add_fd(int fd, int when, Fl_FD_Handler Callback, void *usr_data=0)
Hook a Callback for a certain activities in a FD.
Definition iowatch.cc:22
void a_IOwatch_remove_fd(int fd, int when)
Remove a Callback for a given FD (or just remove some events)
Definition iowatch.cc:32
#define DIO_WRITE
Definition iowatch.hh:8
void a_Klist_remove(Klist_t *Klist, int Key)
Remove data by Key.
Definition klist.c:86
void * a_Klist_get_data(Klist_t *Klist, int Key)
Return the data pointer for a given Key (or NULL if not found)
Definition klist.c:43
void a_Klist_free(Klist_t **KlistPtr)
Free a Klist.
Definition klist.c:110
int a_Klist_insert(Klist_t **Klist, void *Data)
Insert a data pointer and return a key for it.
Definition klist.c:56
#define MSG_WARN(...)
Definition msg.h:26
char * a_Misc_encode_base64(const char *in)
Encodes string using base64 encoding.
Definition misc.c:425
DilloPrefs prefs
Global Data.
Definition prefs.c:33
char * a_Cookies_get_query(const DilloUrl *query_url, const DilloUrl *requester)
Return a string containing cookie data for an HTTP query.
Definition cookies.c:185
A convenience data structure for passing data chunks between nodes.
Definition chain.h:52
char * Buf
Definition chain.h:53
char data[DILLO_ADDR_MAX]
Definition dns.h:26
int alen
Definition dns.h:25
int af
Definition dns.h:24
bool_t http_persistent_conns
Definition prefs.h:100
char * http_user_agent
Definition prefs.h:47
int32_t http_max_conns
Definition prefs.h:43
char * no_proxy
Definition prefs.h:48
char * http_proxyuser
Definition prefs.h:45
DilloUrl * http_proxy
Definition prefs.h:44
char * http_referer
Definition prefs.h:46
char * http_language
Definition prefs.h:42
Definition url.h:88
int flags
Definition url.h:98
Definition dlib.h:131
Definition dlib.h:102
Dstr_char_t * str
Definition dlib.h:105
int len
Definition dlib.h:104
int flags
Additional info.
Definition web.hh:29
DilloUrl * url
Requested URL.
Definition web.hh:25
DilloUrl * requester
URL that caused this request, or < NULL if user-initiated.
Definition web.hh:26
void a_Tls_reset_server_state(const DilloUrl *url)
Definition tls.c:115
void a_Tls_connect(int fd, const DilloUrl *url)
Definition tls.c:128
int a_Tls_connect_ready(const DilloUrl *url)
The purpose here is to permit a single initial connection to a server.
Definition tls.c:68
void a_Tls_close_by_fd(int fd)
Definition tls.c:141
#define TLS_CONNECT_NEVER
Definition tls.h:30
#define TLS_CONNECT_READY
Definition tls.h:32
void a_Url_free(DilloUrl *url)
Free a DilloUrl.
Definition url.c:208
DilloUrl * a_Url_new(const char *url_str, const char *base_url)
Transform (and resolve) an URL string into the respective DilloURL.
Definition url.c:371
DilloUrl * a_Url_dup(const DilloUrl *ori)
Duplicate a Url structure.
Definition url.c:477
#define URL_PATH(u)
Definition url.h:72
#define URL_E2EQuery
Definition url.h:35
#define URL_QUERY_(u)
Definition url.h:52
#define URL_FLAGS(u)
Definition url.h:79
#define URL_DATA(u)
Definition url.h:77
#define URL_MultipartEnc
Definition url.h:42
#define URL_STR(u)
Definition url.h:76
#define URL_QUERY(u)
Definition url.h:73
#define URL_SCHEME(u)
Definition url.h:70
#define URL_PATH_(u)
Definition url.h:51
#define URL_AUTHORITY(u)
Definition url.h:71
#define URL_Post
Definition url.h:33
#define URL_PORT(u)
Definition url.h:78
#define URL_HOST(u)
Definition url.h:75
int a_Web_valid(DilloWeb *web)
Validate a DilloWeb pointer.
Definition web.cc:144
#define WEB_Stylesheet
Definition web.hh:18
#define WEB_Image
Definition web.hh:17
#define WEB_RootUrl
Definition web.hh:16