Dillo v3.1.1-119-g140d9ebd
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, bool_t use_tls)
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 && !use_tls) {
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",
411 URL_PATH_(url) ? URL_PATH(url) : "/",
412 URL_QUERY_(url) ? "?" : "",
413 URL_QUERY(url));
414 }
415
416 cookies = a_Cookies_get_query(url, web->requester);
417 auth = a_Auth_get_auth_str(url, request_uri->str);
418 referer = Http_get_referer(url);
419 if (URL_FLAGS(url) & URL_Post) {
420 Dstr *content_type = Http_make_content_type(url);
422 query,
423 "POST %s HTTP/1.1\r\n"
424 "Host: %s\r\n"
425 "User-Agent: %s\r\n"
426 "Accept: %s\r\n"
427 "%s" /* language */
428 "Accept-Encoding: gzip, deflate\r\n"
429 "%s" /* auth */
430 "DNT: 1\r\n"
431 "%s" /* proxy auth */
432 "%s" /* referer */
433 "Connection: %s\r\n"
434 "Content-Type: %s\r\n"
435 "Content-Length: %ld\r\n"
436 "%s" /* cookies */
437 "\r\n",
438 request_uri->str, URL_AUTHORITY(url), prefs.http_user_agent,
439 accept_hdr_value, HTTP_Language_hdr, auth ? auth : "",
440 proxy_auth->str, referer, connection_hdr_val, content_type->str,
441 (long)URL_DATA(url)->len, cookies);
442 dStr_append_l(query, URL_DATA(url)->str, URL_DATA(url)->len);
443 dStr_free(content_type, TRUE);
444 } else {
446 query,
447 "GET %s HTTP/1.1\r\n"
448 "Host: %s\r\n"
449 "User-Agent: %s\r\n"
450 "Accept: %s\r\n"
451 "%s" /* language */
452 "Accept-Encoding: gzip, deflate\r\n"
453 "%s" /* auth */
454 "DNT: 1\r\n"
455 "%s" /* proxy auth */
456 "%s" /* referer */
457 "Connection: %s\r\n"
458 "%s" /* cache control */
459 "%s" /* cookies */
460 "\r\n",
461 request_uri->str, URL_AUTHORITY(url), prefs.http_user_agent,
462 accept_hdr_value, HTTP_Language_hdr, auth ? auth : "",
463 proxy_auth->str, referer, connection_hdr_val,
464 (URL_FLAGS(url) & URL_E2EQuery) ?
465 "Pragma: no-cache\r\nCache-Control: no-cache\r\n" : "",
466 cookies);
467 }
468 dFree(referer);
469 dFree(cookies);
470 dFree(auth);
471
472 dStr_free(request_uri, TRUE);
473 dStr_free(proxy_auth, TRUE);
474 _MSG("Query: {%s}\n", dStr_printable(query, 8192));
475 return query;
476}
477
481static void Http_send_query(SocketData_t *S)
482{
483 Dstr *query;
484 DataBuf *dbuf;
485
486 /* Create the query */
487 query = Http_make_query_str(S->web,
488 S->flags & HTTP_SOCKET_USE_PROXY,
489 S->flags & HTTP_SOCKET_TLS);
490 dbuf = a_Chain_dbuf_new(query->str, query->len, 0);
491
492 MSG_BW(S->web, 1, "Sending query%s...",
493 S->flags & HTTP_SOCKET_USE_PROXY ? " through proxy" : "");
494
495 /* send query */
496 a_Chain_bcb(OpSend, S->Info, dbuf, NULL);
497 dFree(dbuf);
498 dStr_free(query, 1);
499}
500
504static void Http_connect_tls(ChainLink *info)
505{
506 int SKey = VOIDP2INT(info->LocalKey);
507 SocketData_t *S = a_Klist_get_data(ValidSocks, SKey);
508
509 if (S->flags & HTTP_SOCKET_USE_PROXY) {
510 char *connect_str = Http_get_connect_str(S->url);
511 DataBuf *dbuf = a_Chain_dbuf_new(connect_str, strlen(connect_str), 0);
512
513 MSG_BW(S->web, 1, "Tunnel secure connection through proxy...");
514 a_Chain_bfcb(OpSend, info, &S->SockFD, "FD");
515 S->https_proxy_reply = dStr_new(NULL);
516 a_Chain_bcb(OpSend, info, dbuf, NULL);
517
518 dFree(dbuf);
519 dFree(connect_str);
520 } else {
521 MSG_BW(S->web, 1, "Secure connection negotiation...");
522 a_Tls_connect(S->SockFD, S->url);
523 }
524}
525
529static void Http_connect_socket_cb(int fd, void *data)
530{
531 int SKey = VOIDP2INT(data);
532 SocketData_t *S = a_Klist_get_data(ValidSocks, SKey);
533
534 if (S) {
535 int ret, connect_ret;
536 uint_t connect_ret_size = sizeof(connect_ret);
537
538 a_IOwatch_remove_fd(fd, -1);
539 S->flags &= ~HTTP_SOCKET_IOWATCH_ACTIVE;
540
541 ret = getsockopt(S->SockFD, SOL_SOCKET, SO_ERROR, &connect_ret,
542 &connect_ret_size);
543
544 if (ret < 0 || connect_ret != 0) {
545 if (ret < 0) {
546 MSG("Http_connect_socket_cb getsockopt ERROR: %s.\n",
547 dStrerror(errno));
548 } else {
549 MSG("Http_connect_socket_cb connect ERROR: %s.\n",
550 dStrerror(connect_ret));
551 }
552 MSG("Http_connect_socket() will try another IP address.\n");
553 S->addr_list_idx++;
554 Http_connect_socket(S->Info);
555 } else if (S->flags & HTTP_SOCKET_TLS) {
556 Http_connect_tls(S->Info);
557 } else {
558 a_Http_connect_done(S->SockFD, TRUE);
559 }
560 }
561}
562
568{
569 DilloHost *dh;
570 SocketData_t *S = a_Klist_get_data(ValidSocks, VOIDP2INT(Info->LocalKey));
571
572 for (; (dh = dList_nth_data(S->addr_list, S->addr_list_idx));
573 S->addr_list_idx++) {
574#ifdef ENABLE_IPV6
575 struct sockaddr_in6 name;
576#else
577 struct sockaddr_in name;
578#endif
579 socklen_t socket_len = 0;
580
581 if (S->addr_list_idx > 0 && S->SockFD >= 0) {
582 /* clean up the previous one that failed */
583 Http_fd_map_remove_entry(S->SockFD);
584 dClose(S->SockFD);
585 }
586 if ((S->SockFD = socket(dh->af, SOCK_STREAM, IPPROTO_TCP)) < 0) {
587 MSG("Http_connect_socket socket() ERROR: %s\n", dStrerror(errno));
588 continue;
589 }
591
592 /* set NONBLOCKING and close on exec. */
593 fcntl(S->SockFD, F_SETFL, O_NONBLOCK | fcntl(S->SockFD, F_GETFL));
594 fcntl(S->SockFD, F_SETFD, FD_CLOEXEC | fcntl(S->SockFD, F_GETFD));
595
596 /* Some OSes require this... */
597 memset(&name, 0, sizeof(name));
598 /* Set remaining parms. */
599 switch (dh->af) {
600 case AF_INET:
601 {
602 struct sockaddr_in *sin = (struct sockaddr_in *)&name;
603 socket_len = sizeof(struct sockaddr_in);
604 sin->sin_family = dh->af;
605 sin->sin_port = htons(S->connect_port);
606 memcpy(&sin->sin_addr, dh->data, (size_t)dh->alen);
607 if (a_Web_valid(S->web) && (S->web->flags & WEB_RootUrl))
608 MSG("Connecting to %s:%u\n", inet_ntoa(sin->sin_addr),
609 S->connect_port);
610 break;
611 }
612#ifdef ENABLE_IPV6
613 case AF_INET6:
614 {
615 char buf[128];
616 struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&name;
617 socket_len = sizeof(struct sockaddr_in6);
618 sin6->sin6_family = dh->af;
619 sin6->sin6_port = htons(S->connect_port);
620 memcpy(&sin6->sin6_addr, dh->data, dh->alen);
621 inet_ntop(dh->af, dh->data, buf, sizeof(buf));
622 if (a_Web_valid(S->web) && (S->web->flags & WEB_RootUrl))
623 MSG("Connecting to [%s]:%u\n", buf, S->connect_port);
624 break;
625 }
626#endif
627 } /* switch */
628 MSG_BW(S->web, 1, "Contacting host...");
629
630 if (connect(S->SockFD, (struct sockaddr *)&name, socket_len) == 0) {
631 /* probably never succeeds immediately on any system */
632 if (S->flags & HTTP_SOCKET_TLS) {
633 Http_connect_tls(Info);
634 break;
635 } else {
636 a_Http_connect_done(S->SockFD, TRUE);
637 break;
638 }
639 } else {
640 if (errno == EINPROGRESS) {
642 Info->LocalKey);
643 S->flags |= HTTP_SOCKET_IOWATCH_ACTIVE;
644 break;
645 } else {
646 MSG("Http_connect_socket connect ERROR: %s\n", dStrerror(errno));
647 MSG("We will try another IP address.\n");
648 }
649 }
650 } /* for */
651
652 if (S->addr_list_idx >= dList_length(S->addr_list) ) {
653 MSG("Http_connect_socket ran out of IP addrs to try.\n");
654 a_Http_connect_done(S->SockFD, FALSE);
655 }
656}
657
662static int Http_must_use_proxy(const char *hostname)
663{
664 char *np, *p, *tok;
665 int ret = 0;
666
667 if (HTTP_Proxy) {
668 ret = 1;
669 if (prefs.no_proxy) {
670 size_t host_len = strlen(hostname);
671
672 np = dStrdup(prefs.no_proxy);
673 for (p = np; (tok = dStrsep(&p, " ")); ) {
674 int start = host_len - strlen(tok);
675
676 if (start >= 0 && dStrAsciiCasecmp(hostname + start, tok) == 0) {
677 /* no_proxy token is suffix of host string */
678 ret = 0;
679 break;
680 }
681 }
682 dFree(np);
683 }
684 }
685 _MSG("Http_must_use_proxy: %s\n %s\n", hostname, ret ? "YES":"NO");
686 return ret;
687}
688
692static char *Http_get_connect_str(const DilloUrl *url)
693{
694 Dstr *dstr;
695 const char *auth1;
696 int auth_len;
697 char *auth2, *proxy_auth, *retstr;
698
700
701 dstr = dStr_new("");
702 auth1 = URL_AUTHORITY(url);
703 auth_len = strlen(auth1);
704 if (auth_len > 0 && !isdigit(auth1[auth_len - 1]))
705 /* if no port number, add HTTPS port */
706 auth2 = dStrconcat(auth1, ":443", NULL);
707 else
708 auth2 = dStrdup(auth1);
709 proxy_auth = HTTP_Proxy_Auth_base64 ?
710 dStrconcat ("Proxy-Authorization: Basic ",
711 HTTP_Proxy_Auth_base64, "\r\n", NULL) :
712 dStrdup("");
714 dstr,
715 "CONNECT %s HTTP/1.1\r\n"
716 "Host: %s\r\n"
717 "%s"
718 "\r\n",
719 auth2,
720 auth2,
721 proxy_auth);
722
723 dFree(auth2);
724 dFree(proxy_auth);
725 retstr = dstr->str;
726 dStr_free(dstr, 0);
727 return retstr;
728}
729
735static void Http_dns_cb(int Status, Dlist *addr_list, void *data)
736{
737 int SKey = VOIDP2INT(data);
738 bool_t clean_up = TRUE;
739 SocketData_t *S;
740 Server_t *srv;
741
742 S = a_Klist_get_data(ValidSocks, SKey);
743 if (S) {
744 const char *host = URL_HOST((S->flags & HTTP_SOCKET_USE_PROXY) ?
745 HTTP_Proxy : S->url);
746 if (a_Web_valid(S->web)) {
747 if (Status == 0 && addr_list) {
748
749 /* Successful DNS answer; save the IP */
750 S->addr_list = addr_list;
751 S->addr_list_idx = 0;
752 clean_up = FALSE;
753 srv = Http_server_get(host, S->connect_port,
754 (S->flags & HTTP_SOCKET_TLS));
755 Http_socket_enqueue(srv, S);
757 } else {
758 /* DNS wasn't able to resolve the hostname */
759 MSG_BW(S->web, 0, "ERROR: DNS can't resolve %s", host);
760 }
761 }
762 if (clean_up) {
763 ChainLink *info = S->Info;
764
765 Http_socket_free(SKey);
766 a_Chain_bfcb(OpAbort, info, NULL, "Both");
767 dFree(info);
768 }
769 }
770}
771
779static int Http_get(ChainLink *Info, void *Data1)
780{
781 SocketData_t *S;
782 char *hostname;
783 const DilloUrl *url;
784
786 /* Reference Web data */
787 S->web = Data1;
788 /* Reference Info data */
789 S->Info = Info;
790
791 /* Proxy support */
792 if (Http_must_use_proxy(URL_HOST(S->web->url))) {
793 url = HTTP_Proxy;
795 } else {
796 url = S->web->url;
797 }
798 hostname = dStrdup(URL_HOST(url));
799 S->connect_port = URL_PORT(url);
800 S->url = a_Url_dup(S->web->url);
801 if (!dStrAsciiCasecmp(URL_SCHEME(S->url), "https"))
802 S->flags |= HTTP_SOCKET_TLS;
803
804 /* Let the user know what we'll do */
805 MSG_BW(S->web, 1, "DNS resolving %s", hostname);
806
807 /* Let the DNS engine resolve the hostname, and when done,
808 * we'll try to connect the socket from the callback function */
809 a_Dns_resolve(hostname, Http_dns_cb, Info->LocalKey);
810
811 dFree(hostname);
812 return 0;
813}
814
821static bool_t Http_socket_reuse_compatible(SocketData_t *old,
822 SocketData_t *new)
823{
824 /*
825 * If we are using TLS through a proxy, we need to ensure that old and new
826 * are going through to the same host:port.
827 */
828 if (a_Web_valid(new->web) &&
829 ((old->flags & HTTP_SOCKET_TLS) == 0 ||
830 (old->flags & HTTP_SOCKET_USE_PROXY) == 0 ||
831 ((URL_PORT(old->url) == URL_PORT(new->url)) &&
832 !dStrAsciiCasecmp(URL_HOST(old->url), URL_HOST(new->url)))))
833 return TRUE;
834 return FALSE;
835}
836
841static void Http_socket_reuse(int SKey)
842{
843 SocketData_t *new_sd, *old_sd = a_Klist_get_data(ValidSocks, SKey);
844
845 if (old_sd) {
846 Server_t *srv = Http_server_get(old_sd->connected_to,
847 old_sd->connect_port,
848 (old_sd->flags & HTTP_SOCKET_TLS));
849 int i, n = dList_length(srv->queue);
850
851 for (i = 0; i < n; i++) {
852 new_sd = dList_nth_data(srv->queue, i);
853
854 if (!(new_sd->flags & HTTP_SOCKET_TO_BE_FREED) &&
855 Http_socket_reuse_compatible(old_sd, new_sd)) {
856 const bool_t success = TRUE;
857
858 new_sd->SockFD = old_sd->SockFD;
859
860 old_sd->connected_to = NULL;
861 srv->active_conns--;
862 Http_socket_free(SKey);
863
864 _MSG("Reusing fd %d for %s\n",new_sd->SockFD,URL_STR(new_sd->url));
865 Http_socket_activate(srv, new_sd);
866 Http_fd_map_add_entry(new_sd);
867 a_Http_connect_done(new_sd->SockFD, success);
868 return;
869 }
870 }
871 /* Free the connection before closing the file descriptor, so more data
872 * can be written. */
873 int old_fd = old_sd->SockFD;
874 Http_socket_free(SKey);
875 dClose(old_fd);
876 }
877}
878
882void a_Http_ccc(int Op, int Branch, int Dir, ChainLink *Info,
883 void *Data1, void *Data2)
884{
885 int SKey = VOIDP2INT(Info->LocalKey);
886 SocketData_t *sd;
887 DataBuf *dbuf;
888
889 dReturn_if_fail( a_Chain_check("a_Http_ccc", Op, Branch, Dir, Info) );
890
891 if (Branch == 1) {
892 if (Dir == BCK) {
893 /* HTTP query branch */
894 switch (Op) {
895 case OpStart:
896 /* ( Data1 = Web ) */
897 SKey = Http_sock_new();
898 Info->LocalKey = INT2VOIDP(SKey);
899 /* link IO */
901 a_Chain_bcb(OpStart, Info, NULL, NULL);
902 /* async. connection */
903 Http_get(Info, Data1);
904 break;
905 case OpEnd:
906 /* finished the HTTP query branch */
907 a_Chain_bcb(OpEnd, Info, NULL, NULL);
908 dFree(Info);
909 break;
910 case OpAbort:
911 _MSG("ABORT 1B\n");
912 Http_socket_free(SKey);
913 a_Chain_bcb(OpAbort, Info, NULL, NULL);
914 dFree(Info);
915 break;
916 default:
917 MSG_WARN("Unused CCC 1B Op %d\n", Op);
918 break;
919 }
920 } else { /* 1 FWD */
921 /* HTTP send-query status branch */
922 switch (Op) {
923 case OpAbort:
924 _MSG("ABORT 1F\n");
925 if ((sd = a_Klist_get_data(ValidSocks, SKey)))
926 MSG_BW(sd->web, 1, "Can't get %s", URL_STR(sd->url));
927 Http_socket_free(SKey);
928 a_Chain_fcb(OpAbort, Info, NULL, "Both");
929 dFree(Info);
930 break;
931 default:
932 MSG_WARN("Unused CCC 1F Op %d\n", Op);
933 break;
934 }
935 }
936 } else if (Branch == 2) {
937 if (Dir == FWD) {
938 sd = a_Klist_get_data(ValidSocks, SKey);
939 assert(sd);
940 /* Receiving from server */
941 switch (Op) {
942 case OpSend:
943 if (sd->https_proxy_reply) {
944 dbuf = Data1;
945 dStr_append(sd->https_proxy_reply, dbuf->Buf);
946 if (strstr(sd->https_proxy_reply->str, "\r\n\r\n")) {
947 if (sd->https_proxy_reply->len >= 12 &&
948 sd->https_proxy_reply->str[9] == '2') {
949 /* e.g. "HTTP/1.1 200 Connection established[...]" */
950 MSG("CONNECT through proxy succeeded. Reply:\n%s\n",
951 sd->https_proxy_reply->str);
952 dStr_free(sd->https_proxy_reply, 1);
953 sd->https_proxy_reply = NULL;
954 MSG_BW(sd->web, 1, "Secure connection negotiation...");
955 a_Tls_connect(sd->SockFD, sd->url);
956 } else {
957 MSG_BW(sd->web, 1, "Can't connect through proxy to %s",
958 URL_HOST(sd->url));
959 MSG("CONNECT through proxy failed. Server sent:\n%s\n",
960 sd->https_proxy_reply->str);
961 Http_socket_free(SKey);
962 a_Chain_bfcb(OpAbort, Info, NULL, "Both");
963 dFree(Info);
964 }
965 }
966 } else {
967 /* Data1 = dbuf */
968 a_Chain_fcb(OpSend, Info, Data1, "send_page_2eof");
969 }
970 break;
971 case OpEnd:
972 if (sd->https_proxy_reply) {
973 MSG("CONNECT through proxy failed. "
974 "Full reply not received:\n%s\n",
975 sd->https_proxy_reply->len ? sd->https_proxy_reply->str :
976 "(nothing)");
977 Http_socket_free(SKey);
978 a_Chain_bfcb(OpAbort, Info, NULL, "Both");
979 } else {
980 Http_socket_free(SKey);
981 a_Chain_fcb(OpEnd, Info, NULL, NULL);
982 }
983 dFree(Info);
984 break;
985 case OpAbort:
986 if (sd->https_proxy_reply) {
987 MSG("CONNECT through proxy failed. "
988 "Full reply not received:\n%s\n",
989 sd->https_proxy_reply->len ? sd->https_proxy_reply->str :
990 "(nothing)");
991 }
992 Http_socket_free(SKey);
993 a_Chain_fcb(OpAbort, Info, NULL, "Both");
994 dFree(Info);
995 break;
996 default:
997 MSG_WARN("Unused CCC 2F Op %d\n", Op);
998 break;
999 }
1000 } else { /* 2 BCK */
1001 switch (Op) {
1002 case OpStart:
1003 a_Chain_link_new(Info, a_Http_ccc, BCK, a_IO_ccc, 2, 2);
1004 a_Chain_bcb(OpStart, Info, NULL, NULL); /* IORead */
1005 break;
1006 case OpSend:
1007 if (Data2) {
1008 if (!strcmp(Data2, "FD")) {
1009 int fd = *(int*)Data1;
1010 FdMapEntry_t *fme = dList_find_custom(fd_map, INT2VOIDP(fd),
1012 Info->LocalKey = INT2VOIDP(fme->skey);
1013 a_Chain_bcb(OpSend, Info, Data1, Data2);
1014 } else if (!strcmp(Data2, "reply_complete")) {
1015 a_Chain_bfcb(OpEnd, Info, NULL, NULL);
1016 Http_socket_reuse(SKey);
1017 dFree(Info);
1018 }
1019 }
1020 break;
1021 case OpAbort:
1022 Http_socket_free(SKey);
1023 a_Chain_bcb(OpAbort, Info, NULL, NULL);
1024 dFree(Info);
1025 break;
1026 default:
1027 MSG_WARN("Unused CCC 2B Op %d\n", Op);
1028 break;
1029 }
1030 }
1031 }
1032}
1033
1038static void Http_socket_enqueue(Server_t *srv, SocketData_t* sock)
1039{
1040 sock->flags |= HTTP_SOCKET_QUEUED;
1041
1042 if ((sock->web->flags & WEB_Image) == 0) {
1043 int i, n = dList_length(srv->queue);
1044
1045 for (i = 0; i < n; i++) {
1046 SocketData_t *curr = dList_nth_data(srv->queue, i);
1047
1048 if (a_Web_valid(curr->web) && (curr->web->flags & WEB_Image)) {
1049 dList_insert_pos(srv->queue, sock, i);
1050 return;
1051 }
1052 }
1053 }
1054 dList_append(srv->queue, sock);
1055}
1056
1057static Server_t *Http_server_get(const char *host, uint_t port, bool_t https)
1058{
1059 int i;
1060 Server_t *srv;
1061
1062 for (i = 0; i < dList_length(servers); i++) {
1063 srv = (Server_t*) dList_nth_data(servers, i);
1064
1065 if (port == srv->port && https == srv->https &&
1066 !dStrAsciiCasecmp(host, srv->host))
1067 return srv;
1068 }
1069
1070 srv = dNew0(Server_t, 1);
1071 srv->queue = dList_new(10);
1072 srv->running_the_queue = 0;
1073 srv->host = dStrdup(host);
1074 srv->port = port;
1075 srv->https = https;
1076 dList_append(servers, srv);
1077
1078 return srv;
1079}
1080
1081static void Http_server_remove(Server_t *srv)
1082{
1083 SocketData_t *sd;
1084
1085 while ((sd = dList_nth_data(srv->queue, 0))) {
1086 dList_remove_fast(srv->queue, sd);
1087 dFree(sd);
1088 }
1089 dList_free(srv->queue);
1091 dFree(srv->host);
1092 dFree(srv);
1093}
1094
1096{
1097 Server_t *srv;
1098 SocketData_t *sd;
1099
1100 while (dList_length(servers) > 0) {
1101 srv = (Server_t*) dList_nth_data(servers, 0);
1102 while ((sd = dList_nth_data(srv->queue, 0))) {
1103 dList_remove(srv->queue, sd);
1104 dFree(sd);
1105 }
1106 Http_server_remove(srv);
1107 }
1109}
1110
1111static void Http_fd_map_remove_all(void)
1112{
1113 FdMapEntry_t *fme;
1114 int i, n = dList_length(fd_map);
1115
1116 for (i = 0; i < n; i++) {
1117 fme = (FdMapEntry_t *) dList_nth_data(fd_map, i);
1118 dFree(fme);
1119 }
1121}
1122
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
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:779
static Dstr * Http_make_query_str(DilloWeb *web, bool_t use_proxy, bool_t use_tls)
Make the http query string.
Definition http.c:383
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:1111
#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:821
static const int HTTP_SOCKET_TO_BE_FREED
Definition http.c:56
static void Http_server_remove(Server_t *srv)
Definition http.c:1081
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:841
static void Http_connect_socket(ChainLink *Info)
This function is called after the DNS succeeds in solving a hostname.
Definition http.c:567
static void Http_send_query(SocketData_t *S)
Create and submit the HTTP query to the IO engine.
Definition http.c:481
static int Http_must_use_proxy(const char *hostname)
Test proxy settings and check the no_proxy domains list.
Definition http.c:662
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:1038
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:735
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:692
static void Http_connect_tls(ChainLink *info)
Prepare an HTTPS connection.
Definition http.c:504
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:1127
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:1057
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:529
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:882
static void Http_connect_queued_sockets(Server_t *srv)
Definition http.c:249
static void Http_servers_remove_all(void)
Definition http.c:1095
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:104
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:131
void a_Tls_connect(int fd, const DilloUrl *url)
Definition tls.c:144
int a_Tls_connect_ready(const DilloUrl *url)
The purpose here is to permit a single initial connection to a server.
Definition tls.c:84
void a_Tls_close_by_fd(int fd)
Definition tls.c:157
#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