Commit Diff


commit - 5cf5039df1f7526a79b6067417efe594e9c685bd
commit + a3e4d56b6d9bcfca48f3d8c8f1e526e95b0c2f64
blob - 7b3309eb7c60b587980e11a74ce5e00de7724c73
blob + 51d8a65fcb5359ea11f7ba67630934522cd5c7e6
--- imsgev.h
+++ imsgev.h
@@ -28,6 +28,7 @@ enum imsg_type {
 	IMSG_ERR,
 	IMSG_CHECK_CERT,
 	IMSG_CERT_STATUS,
+	IMSG_FAULTY_GEMSERVER,
 	IMSG_REPLY,		/* reply code (int) + meta string */
 	IMSG_PROCEED,
 	IMSG_STOP,
blob - c892b6b9639d0a5658a1aff25591beebb10294d4
blob + 024d7a5796113050461798068c61a5727e1c96dd
--- net.c
+++ net.c
@@ -472,9 +472,9 @@ net_ev(int fd, int ev, void *d)
 
 	if (ev & EV_READ) {
 		read = bufio_read(&req->bio);
-		if (read == -1 && errno != EAGAIN) {			
-			close_with_errf(req, "Read error");
-			return;
+		if (read == -1 && errno != EAGAIN) {
+			req->eof = 1;
+			net_send_ui(IMSG_FAULTY_GEMSERVER, req->id, NULL, 0);
 		}
 		if (read == 0)
 			req->eof = 1;
blob - e54a1de144252e239ec403f04af538d4a2638175
blob + 0ab6bdcd5603e3fd5e515711da30ba7edfbac905
--- telescope.1
+++ telescope.1
@@ -76,11 +76,18 @@ It contains the current page and optionally a side win
 .Pp
 The modeline is the second to last row of the screen.
 It shows some information about the page: a spinner when the page is
-loading, the trust level, whether a client certificate is in use, the
-document type, the scroll offset and the URL.
+loading, the trust level, whether a client certificate is in use, a
+warning indicator for faulty Gemini servers, document type, the
+scroll offset and the URL.
 When a client certificate is in use, a
 .Sq C
 character is showed.
+Some Gemini servers have buggy TLS handling but some information might
+still be available.
+This information could be truncated.
+In those circumstances, a
+.Sq W
+character is shown.
 .Pp
 The echoarea is usually the last line of the screen.
 Messages are often showed there, and link addresses too.
blob - 3b5c0156989123d3b9cf4cb87275d5dcf65c95fd
blob + 51793ce48e26b6d9b70a334e18db68748d725d94
--- telescope.c
+++ telescope.c
@@ -517,6 +517,16 @@ handle_dispatch_imsg(int fd, int event, void *data)
 				ui_on_download_refresh();
 			}
 			break;
+		case IMSG_FAULTY_GEMSERVER:
+			if ((tab = tab_by_id(imsg_get_id(&imsg))) == NULL &&
+			    ((d = download_by_id(imsg_get_id(&imsg)))) == NULL)
+				return;
+
+			if (tab) {
+				tab->faulty_gemserver = 1;
+				ui_on_tab_refresh(tab);
+			}
+			break;
 		case IMSG_EOF:
 			if ((tab = tab_by_id(imsg_get_id(&imsg))) == NULL &&
 			    ((d = download_by_id(imsg_get_id(&imsg)))) == NULL)
@@ -714,6 +724,7 @@ make_request(struct tab *tab, struct get_req *req, int
 
 	stop_tab(tab);
 	tab->id = tab_new_id();
+	tab->faulty_gemserver = 0;
 	req->proto = proto;
 
 	if (r != NULL) {
blob - c510cc27deff21895a2b1771955e9edbb4ff39b8
blob + 2a6e252eb25b696d48f5c82bda10a0cdacbd0123
--- telescope.h
+++ telescope.h
@@ -165,6 +165,7 @@ struct tab {
 
 	char			*cert;
 	enum trust_state	 trust;
+	int			 faulty_gemserver;
 	const char		*client_cert;
 	int			 client_cert_temp;
 	struct proxy		*proxy;
blob - 6ec9314b6ce98bc82f7a80268211c1c4012e5d32
blob + d7c77490d1fef81b810f1a8aec2d0729c548baf8
--- ui.c
+++ ui.c
@@ -846,10 +846,11 @@ redraw_modeline(struct tab *tab)
 	wattr_on(modeline, modeline_face.background, NULL);
 	wmove(modeline, 0, 0);
 
-	wprintw(modeline, "-%c%c%c %s ",
+	wprintw(modeline, "-%c%c%c%c %s ",
 	    spin[tab->loading_anim_step],
 	    trust_status_char(tab->trust),
 	    tab->client_cert ? 'C' : '-',
+	    tab->faulty_gemserver ? 'W' : '-',
 	    mode == NULL ? "(none)" : mode);
 
 	pct = (buffer->line_off + buffer->curs_y) * 100.0