Index: include/libroar/vio_dstr.h
===================================================================
--- include/libroar/vio_dstr.h	(revision 1333)
+++ include/libroar/vio_dstr.h	(revision 1349)
@@ -89,4 +89,5 @@
 #define ROAR_VIO_DSTR_OBJT_HTTP           ROAR_VIO_DSTR_OBJT_HTTP11
 #define ROAR_VIO_DSTR_OBJT_GOPHER         (0x21|ROAR_VIO_DSTR_OBJGT_PROTO)
+#define ROAR_VIO_DSTR_OBJT_GOPHER_PLUS    (0x22|ROAR_VIO_DSTR_OBJGT_PROTO)
 
 /*
Index: include/libroar/vio_proto.h
===================================================================
--- include/libroar/vio_proto.h	(revision 1347)
+++ include/libroar/vio_proto.h	(revision 1349)
@@ -38,4 +38,17 @@
 #include "libroar.h"
 
+struct roar_vio_defaults;
+
+#define ROAR_VIO_PROTO_P_NONE      0
+#define ROAR_VIO_PROTO_P_HTTP      1
+#define ROAR_VIO_PROTO_P_GOPHER    2
+
+int roar_vio_proto_init_def  (struct roar_vio_defaults * def, char * dstr, int proto, struct roar_vio_defaults * odef);
+
+int roar_vio_open_proto      (struct roar_vio_calls * calls, struct roar_vio_calls * dst,
+                              char * dstr, int proto, struct roar_vio_defaults * odef);
+
+int roar_vio_open_proto_http   (struct roar_vio_calls * calls, struct roar_vio_calls * dst, char * host, char * file);
+int roar_vio_open_proto_gopher (struct roar_vio_calls * calls, struct roar_vio_calls * dst, char * host, char * file);
 #endif
 
Index: libroar/vio_dstr.c
===================================================================
--- libroar/vio_dstr.c	(revision 1337)
+++ libroar/vio_dstr.c	(revision 1349)
@@ -96,4 +96,6 @@
  {ROAR_VIO_DSTR_OBJT_GOPHER,     "gopher",
       {ROAR_VIO_DEF_TYPE_EOL}},
+ {ROAR_VIO_DSTR_OBJT_GOPHER_PLUS,"gopher+",
+      {ROAR_VIO_DEF_TYPE_EOL}},
 
  {ROAR_VIO_DSTR_OBJT_GZIP,       "gzip",
@@ -496,4 +498,21 @@
     break;
 #endif
+   case ROAR_VIO_DSTR_OBJT_HTTP09:
+   case ROAR_VIO_DSTR_OBJT_HTTP10:
+   case ROAR_VIO_DSTR_OBJT_HTTP11:
+     c->need_vio = 1;
+     next->def = &(next->store_def);
+
+     if ( roar_vio_proto_init_def(next->def, c->dst, ROAR_VIO_PROTO_P_HTTP, c->def) == -1 )
+      return -1;
+    break;
+   case ROAR_VIO_DSTR_OBJT_GOPHER:
+   case ROAR_VIO_DSTR_OBJT_GOPHER_PLUS:
+     c->need_vio = 1;
+     next->def = &(next->store_def);
+
+     if ( roar_vio_proto_init_def(next->def, c->dst, ROAR_VIO_PROTO_P_GOPHER, c->def) == -1 )
+      return -1;
+    break;
    default:
     return -1;
@@ -501,9 +520,14 @@
 
   if ( next != NULL ) {
-   ROAR_DBG("roar_vio_dstr_set_defaults(*): i=%i, c->type=0x%.4x(%s): next->def=%p, next->def->type=%i", i,
+   ROAR_WARN("roar_vio_dstr_set_defaults(*): i=%i, c->type=0x%.4x(%s): next->def=%p, next->def->type=%i", i,
                     c->type & 0xFFFF, roar_vio_dstr_get_name(c->type),
                     next->def, next->def == NULL ? -1 : next->def->type);
+   if ( next->def != NULL ) {
+    ROAR_WARN("roar_vio_dstr_set_defaults(*): i=%i, c->type=0x%.4x(%s): next->def->o_flags=%i", i,
+                     c->type & 0xFFFF, roar_vio_dstr_get_name(c->type),
+                     next->def->o_flags);
+   }
   } else {
-   ROAR_DBG("roar_vio_dstr_set_defaults(*): i=%i, c->type=0x%.4x(%s): next=NULL", i,
+   ROAR_WARN("roar_vio_dstr_set_defaults(*): i=%i, c->type=0x%.4x(%s): next=NULL", i,
                     c->type & 0xFFFF, roar_vio_dstr_get_name(c->type));
   }
@@ -558,4 +582,7 @@
 
  for (i = 0; (c = &chain[i])->type != ROAR_VIO_DSTR_OBJT_EOL; i++) {
+  ROAR_WARN("roar_vio_dstr_build_chain(*): i=%i, c->type=0x%.4x(%s): need_vio=%i", i,
+                   c->type & 0xFFFF, roar_vio_dstr_get_name(c->type), c->need_vio);
+
   if ( c->need_vio ) {
    if ( (tc = malloc(sizeof(struct roar_vio_calls))) == NULL ) {
@@ -572,4 +599,5 @@
    }
 
+
    switch (c->type) {
     case ROAR_VIO_DSTR_OBJT_PASS:
@@ -591,4 +619,19 @@
     case ROAR_VIO_DSTR_OBJT_PGP:
       if ( roar_vio_open_pgp_decrypt(tc, prev, NULL) == -1 ) {
+       _ret(-1);
+      }
+     break;
+    case ROAR_VIO_DSTR_OBJT_HTTP09:
+    case ROAR_VIO_DSTR_OBJT_HTTP10:
+    case ROAR_VIO_DSTR_OBJT_HTTP11:
+      ROAR_WARN("roar_vio_dstr_build_chain(*): HTTP*");
+      if ( roar_vio_open_proto(tc, prev, c->dst, ROAR_VIO_PROTO_P_HTTP, i == 0 ? NULL : chain[i-1].def) == -1 ) {
+       _ret(-1);
+      }
+     break;
+    case ROAR_VIO_DSTR_OBJT_GOPHER:
+    case ROAR_VIO_DSTR_OBJT_GOPHER_PLUS:
+      ROAR_WARN("roar_vio_dstr_build_chain(*): GOPHER*");
+      if ( roar_vio_open_proto(tc, prev, c->dst, ROAR_VIO_PROTO_P_GOPHER, i == 0 ? NULL : chain[i-1].def) == -1 ) {
        _ret(-1);
       }
Index: libroar/vio_proto.c
===================================================================
--- libroar/vio_proto.c	(revision 1347)
+++ libroar/vio_proto.c	(revision 1349)
@@ -35,3 +35,104 @@
 #include "libroar.h"
 
+int roar_vio_proto_init_def  (struct roar_vio_defaults * def, char * dstr, int proto, struct roar_vio_defaults * odef) {
+ int                        port = 0;
+ int                        ret;
+ char                     * ed;
+
+ if ( def == NULL )
+  return -1;
+
+ switch (proto) {
+  case ROAR_VIO_PROTO_P_HTTP:    port = 80; break;
+  case ROAR_VIO_PROTO_P_GOPHER:  port = 70; break;
+  default:
+    return -1;
+ }
+
+ if ( roar_vio_dstr_init_defaults(def, ROAR_VIO_DEF_TYPE_SOCKET, O_RDWR, 0644) == -1 )
+  return -1;
+
+ if ( roar_vio_socket_init_tcp4_def(def, "localhost", port) == -1 )
+  return -1;
+
+ if ( !strncmp(dstr, "//", 2) )
+  dstr += 2;
+
+ if ( (ed = strstr(dstr, "/")) != NULL )
+  *ed = 0;
+
+ ret = roar_vio_socket_init_dstr_def(def, dstr, -1, SOCK_STREAM, def);
+
+ if ( ed != NULL )
+  *ed = '/';
+
+ return ret;
+}
+
+int roar_vio_open_proto      (struct roar_vio_calls * calls, struct roar_vio_calls * dst,
+                              char * dstr, int proto, struct roar_vio_defaults * odef) {
+ char * host;
+ char * tmp;
+
+ ROAR_WARN("roar_vio_open_proto(calls=%p, dst=%p, dstr='%s', proto=%i, odef=%p) = ?", calls, dst, dstr, proto, odef);
+
+ if ( calls == NULL || dst == NULL || dstr == NULL )
+  return -1;
+
+ ROAR_DBG("roar_vio_open_proto(*) = ?");
+
+ if ( roar_vio_open_pass(calls, dst) == -1 )
+  return -1;
+
+ dstr += 2;
+ host  = dstr;
+
+ if ( (tmp = strstr(dstr, "/")) == NULL )
+  return -1;
+
+ *tmp++ = 0;
+ dstr   = tmp;
+
+ if ( (tmp = strstr(dstr, "#")) != NULL )
+  *tmp = 0;
+
+ ROAR_DBG("roar_vio_open_proto(*) = ?");
+
+ switch (proto) {
+  case ROAR_VIO_PROTO_P_HTTP:
+    return roar_vio_open_proto_http(calls, dst, host, dstr);
+   break;
+  case ROAR_VIO_PROTO_P_GOPHER:
+    return roar_vio_open_proto_gopher(calls, dst, host, dstr);
+   break;
+ }
+
+ return -1;
+}
+
+int roar_vio_open_proto_http   (struct roar_vio_calls * calls, struct roar_vio_calls * dst, char * host, char * file) {
+ return -1;
+}
+
+int roar_vio_open_proto_gopher (struct roar_vio_calls * calls, struct roar_vio_calls * dst, char * host, char * file) {
+ int len;
+
+ if ( calls == NULL || dst == NULL || host == NULL || file == NULL )
+  return -1;
+
+ ROAR_DBG("roar_vio_open_proto_gopher(calls=%p, dst=%p, host='%s', file='%s') = ?", calls, dst, host, file);
+
+ len = strlen(file);
+
+ if ( roar_vio_write(dst, file, len) != len )
+  return -1;
+
+ if ( roar_vio_write(dst, "\n", 1) != 1 )
+  return -1;
+
+ roar_vio_sync(dst); // for encryption/compression layers
+
+ return 0;
+}
+
 //ll
Index: libroar/vio_socket.c
===================================================================
--- libroar/vio_socket.c	(revision 1348)
+++ libroar/vio_socket.c	(revision 1349)
@@ -200,5 +200,7 @@
  if ( hint == -1 && odef != NULL ) { // if we still don't know what this is we try
                                      // to use the parent objects request
+  ROAR_WARN("roar_vio_socket_init_dstr_def(*): hint=-1 && odef!=NULL");
   if ( odef->type == ROAR_VIO_DEF_TYPE_SOCKET ) {
+   ROAR_WARN("roar_vio_socket_init_dstr_def(*): hint=-1 && odef!=NULL, using hint from odef");
    hint = odef->d.socket.domain;
   }
@@ -411,4 +413,5 @@
 int     roar_vio_socket_init_inet4host_def(struct roar_vio_defaults * def) {
  struct hostent     * he;
+ char               * ed;
 
  if ( def == NULL )
@@ -417,10 +420,16 @@
  if ( def->d.socket.host == NULL )
   return -1;
+
+ if ( (ed = strstr(def->d.socket.host, "/")) != NULL )
+  *ed = 0;
 
  if ( (he = gethostbyname(def->d.socket.host)) == NULL ) {
   ROAR_ERR("roar_vio_socket_init_inet4host_def(*): Can\'t resolve host name '%s'",
                     def->d.socket.host);
-  return -1;
- }
+  if ( ed != NULL ) *ed = '/';
+  return -1;
+ }
+
+ if ( ed != NULL ) *ed = '/';
 
  memcpy((struct in_addr *)&def->d.socket.sa.in.sin_addr, he->h_addr, sizeof(struct in_addr));
