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