1 /* This file is part of Pazpar2.
2 Copyright (C) 2006-2009 Index Data
4 Pazpar2 is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 #include <libxml/parser.h>
28 #include <libxml/tree.h>
29 #include <libxslt/xslt.h>
30 #include <libxslt/transform.h>
31 #include <libxslt/xsltutils.h>
33 #include <yaz/yaz-util.h>
35 #include <yaz/snprintf.h>
36 #include <yaz/tpath.h>
39 #define USE_POSIX_GLOB 1
41 #define USE_POSIX_GLOB 0
48 #include <sys/types.h>
53 #include "pazpar2_config.h"
60 NMEM nmem; /* for conf_config and servers memory */
61 struct conf_server *servers;
66 static char *parse_settings(struct conf_config *config,
67 NMEM nmem, xmlNode *node);
69 static struct conf_targetprofiles *parse_targetprofiles(NMEM nmem,
72 static void conf_metadata_assign(NMEM nmem,
73 struct conf_metadata * metadata,
75 enum conf_metadata_type type,
76 enum conf_metadata_merge merge,
77 enum conf_setting_type setting,
82 enum conf_metadata_mergekey mt)
84 assert(nmem && metadata && name);
86 metadata->name = nmem_strdup(nmem, name);
88 metadata->type = type;
90 // enforcing that type_year is always range_merge
91 if (metadata->type == Metadata_type_year)
92 metadata->merge = Metadata_merge_range;
94 metadata->merge = merge;
96 metadata->setting = setting;
97 metadata->brief = brief;
98 metadata->termlist = termlist;
99 metadata->rank = rank;
100 metadata->sortkey_offset = sortkey_offset;
101 metadata->mergekey = mt;
105 static void conf_sortkey_assign(NMEM nmem,
106 struct conf_sortkey * sortkey,
108 enum conf_sortkey_type type)
110 assert(nmem && sortkey && name);
112 sortkey->name = nmem_strdup(nmem, name);
113 sortkey->type = type;
117 static struct conf_service *service_init(struct conf_config *config,
118 int num_metadata, int num_sortkeys,
119 const char *service_id)
121 struct conf_service * service = 0;
122 NMEM nmem = nmem_create();
124 service = nmem_malloc(nmem, sizeof(struct conf_service));
125 service->nmem = nmem;
127 service->settings = 0;
128 service->databases = 0;
129 service->targetprofiles = 0;
130 service->config = config;
131 service->session_timeout = 60; /* default session timeout */
132 service->z3950_session_timeout = 180;
133 service->z3950_connect_timeout = 15;
135 service->relevance_pct = 0;
136 service->sort_pct = 0;
137 service->mergekey_pct = 0;
139 service->id = service_id ? nmem_strdup(nmem, service_id) : 0;
140 service->num_metadata = num_metadata;
141 service->metadata = 0;
142 if (service->num_metadata)
145 sizeof(struct conf_metadata) * service->num_metadata);
146 service->num_sortkeys = num_sortkeys;
147 service->sortkeys = 0;
148 if (service->num_sortkeys)
151 sizeof(struct conf_sortkey) * service->num_sortkeys);
152 service->dictionary = 0;
156 static struct conf_metadata* conf_service_add_metadata(
157 struct conf_service *service,
160 enum conf_metadata_type type,
161 enum conf_metadata_merge merge,
162 enum conf_setting_type setting,
167 enum conf_metadata_mergekey mt)
169 struct conf_metadata * md = 0;
171 if (!service || !service->metadata || !service->num_metadata
172 || field_id < 0 || !(field_id < service->num_metadata))
175 md = service->metadata + field_id;
176 conf_metadata_assign(service->nmem, md, name, type, merge, setting,
177 brief, termlist, rank, sortkey_offset,
183 static struct conf_sortkey * conf_service_add_sortkey(
184 struct conf_service *service,
187 enum conf_sortkey_type type)
189 struct conf_sortkey * sk = 0;
191 if (!service || !service->sortkeys || !service->num_sortkeys
192 || field_id < 0 || !(field_id < service->num_sortkeys))
195 //sk = &((service->sortkeys)[field_id]);
196 sk = service->sortkeys + field_id;
197 conf_sortkey_assign(service->nmem, sk, name, type);
203 int conf_service_metadata_field_id(struct conf_service *service,
208 if (!service || !service->metadata || !service->num_metadata)
211 for(i = 0; i < service->num_metadata; i++) {
212 if (!strcmp(name, (service->metadata[i]).name))
220 int conf_service_sortkey_field_id(struct conf_service *service,
225 if (!service || !service->sortkeys || !service->num_sortkeys)
228 for(i = 0; i < service->num_sortkeys; i++) {
229 if (!strcmp(name, (service->sortkeys[i]).name))
236 static void conf_dir_path(struct conf_config *config, WRBUF w, const char *src)
238 if (config->confdir && wrbuf_len(config->confdir) > 0 &&
239 !yaz_is_abspath(src))
241 wrbuf_printf(w, "%s/%s", wrbuf_cstr(config->confdir), src);
247 static void service_destroy(struct conf_service *service)
251 pp2_charset_destroy(service->relevance_pct);
252 pp2_charset_destroy(service->sort_pct);
253 pp2_charset_destroy(service->mergekey_pct);
254 nmem_destroy(service->nmem);
258 static int parse_metadata(struct conf_service *service, xmlNode *n,
259 int *md_node, int *sk_node)
261 xmlChar *xml_name = xmlGetProp(n, (xmlChar *) "name");
262 xmlChar *xml_brief = xmlGetProp(n, (xmlChar *) "brief");
263 xmlChar *xml_sortkey = xmlGetProp(n, (xmlChar *) "sortkey");
264 xmlChar *xml_merge = xmlGetProp(n, (xmlChar *) "merge");
265 xmlChar *xml_type = xmlGetProp(n, (xmlChar *) "type");
266 xmlChar *xml_termlist = xmlGetProp(n, (xmlChar *) "termlist");
267 xmlChar *xml_rank = xmlGetProp(n, (xmlChar *) "rank");
268 xmlChar *xml_setting = xmlGetProp(n, (xmlChar *) "setting");
269 xmlChar *xml_mergekey = xmlGetProp(n, (xmlChar *) "mergekey");
271 enum conf_metadata_type type = Metadata_type_generic;
272 enum conf_metadata_merge merge = Metadata_merge_no;
273 enum conf_setting_type setting = Metadata_setting_no;
274 enum conf_sortkey_type sk_type = Metadata_sortkey_relevance;
275 enum conf_metadata_mergekey mergekey_type = Metadata_mergekey_no;
279 int sortkey_offset = 0;
281 // now do the parsing logic
284 yaz_log(YLOG_FATAL, "Must specify name in metadata element");
289 if (!strcmp((const char *) xml_brief, "yes"))
291 else if (strcmp((const char *) xml_brief, "no"))
293 yaz_log(YLOG_FATAL, "metadata/brief must be yes or no");
302 if (!strcmp((const char *) xml_termlist, "yes"))
304 else if (strcmp((const char *) xml_termlist, "no"))
306 yaz_log(YLOG_FATAL, "metadata/termlist must be yes or no");
314 rank = atoi((const char *) xml_rank);
320 if (!strcmp((const char *) xml_type, "generic"))
321 type = Metadata_type_generic;
322 else if (!strcmp((const char *) xml_type, "year"))
323 type = Metadata_type_year;
324 else if (!strcmp((const char *) xml_type, "date"))
325 type = Metadata_type_date;
329 "Unknown value for metadata/type: %s", xml_type);
334 type = Metadata_type_generic;
338 if (!strcmp((const char *) xml_merge, "no"))
339 merge = Metadata_merge_no;
340 else if (!strcmp((const char *) xml_merge, "unique"))
341 merge = Metadata_merge_unique;
342 else if (!strcmp((const char *) xml_merge, "longest"))
343 merge = Metadata_merge_longest;
344 else if (!strcmp((const char *) xml_merge, "range"))
345 merge = Metadata_merge_range;
346 else if (!strcmp((const char *) xml_merge, "all"))
347 merge = Metadata_merge_all;
351 "Unknown value for metadata/merge: %s", xml_merge);
356 merge = Metadata_merge_no;
360 if (!strcmp((const char *) xml_setting, "no"))
361 setting = Metadata_setting_no;
362 else if (!strcmp((const char *) xml_setting, "postproc"))
363 setting = Metadata_setting_postproc;
364 else if (!strcmp((const char *) xml_setting, "parameter"))
365 setting = Metadata_setting_parameter;
369 "Unknown value for medadata/setting: %s", xml_setting);
374 // add a sortkey if so specified
375 if (xml_sortkey && strcmp((const char *) xml_sortkey, "no"))
377 if (merge == Metadata_merge_no)
380 "Can't specify sortkey on a non-merged field");
383 if (!strcmp((const char *) xml_sortkey, "numeric"))
384 sk_type = Metadata_sortkey_numeric;
385 else if (!strcmp((const char *) xml_sortkey, "skiparticle"))
386 sk_type = Metadata_sortkey_skiparticle;
390 "Unknown sortkey in metadata element: %s",
394 sortkey_offset = *sk_node;
396 conf_service_add_sortkey(service, *sk_node,
397 (const char *) xml_name, sk_type);
404 if (xml_mergekey && strcmp((const char *) xml_mergekey, "no"))
406 mergekey_type = Metadata_mergekey_yes;
410 // metadata known, assign values
411 conf_service_add_metadata(service, *md_node,
412 (const char *) xml_name,
413 type, merge, setting,
414 brief, termlist, rank, sortkey_offset,
419 xmlFree(xml_sortkey);
422 xmlFree(xml_termlist);
424 xmlFree(xml_setting);
429 static struct conf_service *service_create(struct conf_config *config,
431 const char *service_id)
437 struct conf_service *service = 0;
438 int num_metadata = 0;
439 int num_sortkeys = 0;
440 int got_settings = 0;
442 // count num_metadata and num_sortkeys
443 for (n = node->children; n; n = n->next)
444 if (n->type == XML_ELEMENT_NODE && !strcmp((const char *)
445 n->name, "metadata"))
447 xmlChar *sortkey = xmlGetProp(n, (xmlChar *) "sortkey");
449 if (sortkey && strcmp((const char *) sortkey, "no"))
454 service = service_init(config, num_metadata, num_sortkeys, service_id);
456 for (n = node->children; n; n = n->next)
458 if (n->type != XML_ELEMENT_NODE)
460 if (!strcmp((const char *) n->name, "timeout"))
462 xmlChar *src = xmlGetProp(n, (xmlChar *) "session");
465 service->session_timeout = atoi((const char *) src);
467 if (service->session_timeout < 9)
469 yaz_log(YLOG_FATAL, "session timeout out of range");
473 src = xmlGetProp(n, (xmlChar *) "z3950_connect");
476 service->z3950_connect_timeout = atoi((const char *) src);
478 if (service->z3950_session_timeout < 9)
480 yaz_log(YLOG_FATAL, "Z39.50 connect timeout out of range");
484 src = xmlGetProp(n, (xmlChar *) "z3950_session");
487 service->z3950_session_timeout = atoi((const char *) src);
489 if (service->z3950_session_timeout < 9)
491 yaz_log(YLOG_FATAL, "Z39.50 session timeout out of range");
496 else if (!strcmp((const char *) n->name, "settings"))
498 else if (!strcmp((const char *) n->name, (const char *) "targetprofiles"))
500 if (service->targetprofiles)
502 yaz_log(YLOG_FATAL, "Can't repeat targetprofiles");
505 if (!(service->targetprofiles =
506 parse_targetprofiles(service->nmem, n)))
509 else if (!strcmp((const char *) n->name, "relevance"))
511 if (service->relevance_pct)
513 yaz_log(YLOG_LOG, "relevance may not repeat in service");
518 service->relevance_pct = pp2_charset_create_xml(n);
519 if (!service->relevance_pct)
523 else if (!strcmp((const char *) n->name, "sort"))
525 if (service->sort_pct)
527 yaz_log(YLOG_LOG, "sort may not repeat in service");
532 service->sort_pct = pp2_charset_create_xml(n);
533 if (!service->sort_pct)
537 else if (!strcmp((const char *) n->name, "mergekey"))
539 if (service->mergekey_pct)
541 yaz_log(YLOG_LOG, "mergekey may not repeat in service");
546 service->mergekey_pct = pp2_charset_create_xml(n);
547 if (!service->mergekey_pct)
551 else if (!strcmp((const char *) n->name, (const char *) "metadata"))
553 if (parse_metadata(service, n, &md_node, &sk_node))
558 yaz_log(YLOG_FATAL, "Bad element: %s", n->name);
565 /* metadata has been read.. Consider now settings */
566 init_settings(service);
567 for (pass = 1; pass <= 2; pass++)
569 for (n = node->children; n; n = n->next)
571 if (n->type != XML_ELEMENT_NODE)
573 if (!strcmp((const char *) n->name, "settings"))
575 xmlChar *src = xmlGetProp(n, (xmlChar *) "src");
578 WRBUF w = wrbuf_alloc();
579 conf_dir_path(config, w, (const char *) src);
580 settings_read_file(service, wrbuf_cstr(w), pass);
586 settings_read_node(service, n, pass);
595 static char *parse_settings(struct conf_config *config,
596 NMEM nmem, xmlNode *node)
598 xmlChar *src = xmlGetProp(node, (xmlChar *) "src");
603 WRBUF w = wrbuf_alloc();
604 conf_dir_path(config, w, (const char *) src);
605 r = nmem_strdup(nmem, wrbuf_cstr(w));
610 yaz_log(YLOG_FATAL, "Must specify src in targetprofile");
617 static void inherit_server_settings(struct conf_server *server)
619 struct conf_service *s;
620 for (s = server->service; s; s = s->next)
622 if (!s->dictionary) /* service has no config settings ? */
624 if (server->server_settings)
626 /* inherit settings from server */
628 settings_read_file(s, server->server_settings, 1);
629 settings_read_file(s, server->server_settings, 2);
633 yaz_log(YLOG_WARN, "service '%s' has no settings",
634 s->id ? s->id : "unnamed");
639 /* use relevance/sort/mergekey from server if not defined
640 for this service.. */
641 if (!s->relevance_pct)
643 if (server->relevance_pct)
645 s->relevance_pct = server->relevance_pct;
646 pp2_charset_incref(s->relevance_pct);
649 s->relevance_pct = pp2_charset_create(0);
654 if (server->sort_pct)
656 s->sort_pct = server->sort_pct;
657 pp2_charset_incref(s->sort_pct);
660 s->sort_pct = pp2_charset_create(0);
663 if (!s->mergekey_pct)
665 if (server->mergekey_pct)
667 s->mergekey_pct = server->mergekey_pct;
668 pp2_charset_incref(s->mergekey_pct);
671 s->mergekey_pct = pp2_charset_create(0);
676 static struct conf_server *server_create(struct conf_config *config,
677 NMEM nmem, xmlNode *node)
680 struct conf_server *server = nmem_malloc(nmem, sizeof(struct conf_server));
684 server->proxy_host = 0;
685 server->proxy_port = 0;
687 server->proxy_addr = 0;
690 server->relevance_pct = 0;
691 server->sort_pct = 0;
692 server->mergekey_pct = 0;
693 server->server_settings = 0;
695 for (n = node->children; n; n = n->next)
697 if (n->type != XML_ELEMENT_NODE)
699 if (!strcmp((const char *) n->name, "listen"))
701 xmlChar *port = xmlGetProp(n, (xmlChar *) "port");
702 xmlChar *host = xmlGetProp(n, (xmlChar *) "host");
704 server->port = atoi((const char *) port);
706 server->host = nmem_strdup(nmem, (const char *) host);
710 else if (!strcmp((const char *) n->name, "proxy"))
712 xmlChar *port = xmlGetProp(n, (xmlChar *) "port");
713 xmlChar *host = xmlGetProp(n, (xmlChar *) "host");
714 xmlChar *myurl = xmlGetProp(n, (xmlChar *) "myurl");
716 server->proxy_port = atoi((const char *) port);
718 server->proxy_host = nmem_strdup(nmem, (const char *) host);
720 server->myurl = nmem_strdup(nmem, (const char *) myurl);
725 else if (!strcmp((const char *) n->name, "settings"))
727 if (server->server_settings)
729 yaz_log(YLOG_FATAL, "Can't repeat 'settings'");
732 if (!(server->server_settings = parse_settings(config, nmem, n)))
735 else if (!strcmp((const char *) n->name, "relevance"))
737 server->relevance_pct = pp2_charset_create_xml(n);
738 if (!server->relevance_pct)
741 else if (!strcmp((const char *) n->name, "sort"))
743 server->sort_pct = pp2_charset_create_xml(n);
744 if (!server->sort_pct)
747 else if (!strcmp((const char *) n->name, "mergekey"))
749 server->mergekey_pct = pp2_charset_create_xml(n);
750 if (!server->mergekey_pct)
753 else if (!strcmp((const char *) n->name, "service"))
755 char *service_id = (char *)
756 xmlGetProp(n, (xmlChar *) "id");
758 struct conf_service **sp = &server->service;
759 for (; *sp; sp = &(*sp)->next)
760 if ((*sp)->id && service_id &&
761 0 == strcmp((*sp)->id, service_id))
763 yaz_log(YLOG_FATAL, "Duplicate service: %s", service_id);
766 else if (!(*sp)->id && !service_id)
768 yaz_log(YLOG_FATAL, "Duplicate unnamed service '%s'",
773 if (*sp) /* service already exist */
780 struct conf_service *s = service_create(config, n,
790 yaz_log(YLOG_FATAL, "Bad element: %s", n->name);
794 inherit_server_settings(server);
798 xsltStylesheet *conf_load_stylesheet(struct conf_config *config,
801 WRBUF w = wrbuf_alloc();
804 conf_dir_path(config, w, fname);
805 s = xsltParseStylesheetFile((xmlChar *) wrbuf_cstr(w));
810 static struct conf_targetprofiles *parse_targetprofiles(NMEM nmem,
813 struct conf_targetprofiles *r = nmem_malloc(nmem, sizeof(*r));
814 xmlChar *type = xmlGetProp(node, (xmlChar *) "type");
815 xmlChar *src = xmlGetProp(node, (xmlChar *) "src");
817 memset(r, 0, sizeof(*r));
821 if (!strcmp((const char *) type, "local"))
822 r->type = Targetprofiles_local;
825 yaz_log(YLOG_FATAL, "Unknown targetprofile type");
831 yaz_log(YLOG_FATAL, "Must specify type for targetprofile");
836 r->src = nmem_strdup(nmem, (const char *) src);
839 yaz_log(YLOG_FATAL, "Must specify src in targetprofile");
847 struct conf_service *locate_service(struct conf_server *server,
848 const char *service_id)
850 struct conf_service *s = server->service;
851 for (; s; s = s->next)
852 if (s->id && service_id && 0 == strcmp(s->id, service_id))
854 else if (!s->id && !service_id)
860 static int parse_config(struct conf_config *config, xmlNode *root)
864 for (n = root->children; n; n = n->next)
866 if (n->type != XML_ELEMENT_NODE)
868 if (!strcmp((const char *) n->name, "server"))
870 struct conf_server *tmp = server_create(config, config->nmem, n);
873 tmp->next = config->servers;
874 config->servers = tmp;
876 else if (!strcmp((const char *) n->name, "targetprofiles"))
878 yaz_log(YLOG_FATAL, "targetprofiles unsupported here. Must be part of service");
884 yaz_log(YLOG_FATAL, "Bad element: %s", n->name);
891 static int process_config_includes(struct conf_config *config, xmlNode *n);
893 static int config_include_one(struct conf_config *config, xmlNode **sib,
897 if (stat(path, &st) < 0)
899 yaz_log(YLOG_FATAL|YLOG_ERRNO, "stat %s", path);
904 if ((st.st_mode & S_IFMT) == S_IFREG)
906 xmlDoc *doc = xmlParseFile(path);
909 xmlNodePtr t = xmlDocGetRootElement(doc);
910 int ret = process_config_includes(config, t);
911 *sib = xmlAddNextSibling(*sib, xmlCopyNode(t, 1));
918 yaz_log(YLOG_FATAL, "Could not parse %s", path);
926 static int config_include_src(struct conf_config *config, xmlNode **np,
929 int ret = 0; /* return code. OK so far */
930 WRBUF w = wrbuf_alloc();
931 xmlNodePtr sib; /* our sibling that we append */
932 xmlNodePtr c; /* tmp node */
934 wrbuf_printf(w, " begin include src=\"%s\" ", src);
936 /* replace include element with a 'begin' comment */
937 sib = xmlNewComment((const xmlChar *) wrbuf_cstr(w));
938 xmlReplaceNode(*np, sib);
943 conf_dir_path(config, w, src);
948 glob(wrbuf_cstr(w), 0 /* flags */, 0 /* errfunc */, &glob_res);
950 for (i = 0; ret == 0 && i < glob_res.gl_pathc; i++)
952 const char *path = glob_res.gl_pathv[i];
953 ret = config_include_one(config, &sib, path);
958 ret = config_include_one(config, &sib, wrbuf_cstr(w));
961 wrbuf_printf(w, " end include src=\"%s\" ", src);
962 c = xmlNewComment((const xmlChar *) wrbuf_cstr(w));
963 sib = xmlAddNextSibling(sib, c);
970 static int process_config_includes(struct conf_config *config, xmlNode *n)
972 for (; n; n = n->next)
974 if (n->type == XML_ELEMENT_NODE)
976 if (!strcmp((const char *) n->name, "include"))
978 xmlChar *src = xmlGetProp(n, (xmlChar *) "src");
981 int ret = config_include_src(config, &n,
991 if (process_config_includes(config, n->children))
999 struct conf_config *config_create(const char *fname, int verbose)
1001 xmlDoc *doc = xmlParseFile(fname);
1005 NMEM nmem = nmem_create();
1006 struct conf_config *config = nmem_malloc(nmem, sizeof(struct conf_config));
1008 xmlSubstituteEntitiesDefault(1);
1009 xmlLoadExtDtdDefaultValue = 1;
1012 yaz_log(YLOG_FATAL, "Failed to read %s", fname);
1017 config->nmem = nmem;
1018 config->servers = 0;
1020 config->confdir = wrbuf_alloc();
1021 if ((p = strrchr(fname,
1029 int len = p - fname;
1030 wrbuf_write(config->confdir, fname, len);
1032 wrbuf_puts(config->confdir, "");
1034 n = xmlDocGetRootElement(doc);
1035 r = process_config_includes(config, n);
1036 if (r == 0) /* OK */
1040 yaz_log(YLOG_LOG, "Configuration %s after include processing",
1042 xmlDocFormatDump(yaz_log_file(), doc, 0);
1044 r = parse_config(config, n);
1050 config_destroy(config);
1056 void server_destroy(struct conf_server *server)
1058 struct conf_service *s = server->service;
1061 struct conf_service *s_next = s->next;
1065 pp2_charset_destroy(server->relevance_pct);
1066 pp2_charset_destroy(server->sort_pct);
1067 pp2_charset_destroy(server->mergekey_pct);
1070 void config_destroy(struct conf_config *config)
1074 struct conf_server *server = config->servers;
1077 struct conf_server *s_next = server->next;
1078 server_destroy(server);
1081 wrbuf_destroy(config->confdir);
1082 nmem_destroy(config->nmem);
1086 void config_stop_listeners(struct conf_config *conf)
1088 struct conf_server *ser;
1089 for (ser = conf->servers; ser; ser = ser->next)
1090 http_close_server(ser);
1093 void config_start_databases(struct conf_config *conf)
1095 struct conf_server *ser;
1096 for (ser = conf->servers; ser; ser = ser->next)
1098 struct conf_service *s = ser->service;
1099 for (;s ; s = s->next)
1100 resolve_databases(s);
1104 int config_start_listeners(struct conf_config *conf,
1105 const char *listener_override)
1107 struct conf_server *ser;
1108 for (ser = conf->servers; ser; ser = ser->next)
1110 WRBUF w = wrbuf_alloc();
1112 if (listener_override)
1114 wrbuf_puts(w, listener_override);
1115 listener_override = 0; /* only first server is overriden */
1120 wrbuf_puts(w, ser->host);
1125 wrbuf_printf(w, "%d", ser->port);
1128 r = http_init(wrbuf_cstr(w), ser);
1134 if (ser->proxy_host || ser->proxy_port)
1136 if (ser->proxy_host)
1137 wrbuf_puts(w, ser->proxy_host);
1138 if (ser->proxy_port)
1142 wrbuf_printf(w, "%d", ser->proxy_port);
1146 http_set_proxyaddr(wrbuf_cstr(w), ser);
1155 * c-file-style: "Stroustrup"
1156 * indent-tabs-mode: nil
1158 * vim: shiftwidth=4 tabstop=8 expandtab