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