diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-09-27 22:12:13 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-09-27 22:12:13 +0200 |
commit | beb7fa828c59c31d4a5178b82121435f2069b181 (patch) | |
tree | f5279645b6805e9e33aa1b2edb34df1e2e5c26af /src/examples | |
parent | 1d9f940dca89a5ee95a3247e43440ebd16c903af (diff) | |
download | libmicrohttpd-beb7fa828c59c31d4a5178b82121435f2069b181.tar.gz libmicrohttpd-beb7fa828c59c31d4a5178b82121435f2069b181.zip |
fix transmission stall issue with upgraded TLS connections reported by Nguyen Xuan Viet on the mailinglist
Diffstat (limited to 'src/examples')
-rw-r--r-- | src/examples/connection_close.c | 6 | ||||
-rw-r--r-- | src/examples/demo.c | 6 | ||||
-rw-r--r-- | src/examples/demo_https.c | 6 | ||||
-rw-r--r-- | src/examples/fileserver_example.c | 4 | ||||
-rw-r--r-- | src/examples/websocket_threaded_example.c | 68 |
5 files changed, 45 insertions, 45 deletions
diff --git a/src/examples/connection_close.c b/src/examples/connection_close.c index fb9f77d9..b0314dea 100644 --- a/src/examples/connection_close.c +++ b/src/examples/connection_close.c | |||
@@ -102,10 +102,10 @@ main (int argc, char *const *argv) | |||
102 | return 1; | 102 | return 1; |
103 | } | 103 | } |
104 | d = MHD_start_daemon (/* MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, */ | 104 | d = MHD_start_daemon (/* MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, */ |
105 | /* MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, */ | 105 | /* MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, */ |
106 | /* MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_POLL, */ | 106 | /* MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_POLL, */ |
107 | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | 107 | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD |
108 | | MHD_USE_ERROR_LOG | MHD_USE_POLL, // | MHD_USE_ITC, | 108 | | MHD_USE_ERROR_LOG | MHD_USE_POLL, // | MHD_USE_ITC, |
109 | /* MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, */ | 109 | /* MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, */ |
110 | atoi (argv[1]), | 110 | atoi (argv[1]), |
111 | NULL, NULL, &ahc_echo, PAGE, | 111 | NULL, NULL, &ahc_echo, PAGE, |
diff --git a/src/examples/demo.c b/src/examples/demo.c index 1830d3b0..9f1beda3 100644 --- a/src/examples/demo.c +++ b/src/examples/demo.c | |||
@@ -283,11 +283,11 @@ list_directory (struct ResponseDataContext *rdc, | |||
283 | snprintf (fullname, sizeof (fullname), | 283 | snprintf (fullname, sizeof (fullname), |
284 | "%s/%s", | 284 | "%s/%s", |
285 | dirname, de->d_name)) | 285 | dirname, de->d_name)) |
286 | continue; /* ugh, file too long? how can this be!? */ | 286 | continue; /* ugh, file too long? how can this be!? */ |
287 | if (0 != stat (fullname, &sbuf)) | 287 | if (0 != stat (fullname, &sbuf)) |
288 | continue; /* ugh, failed to 'stat' */ | 288 | continue; /* ugh, failed to 'stat' */ |
289 | if (! S_ISREG (sbuf.st_mode)) | 289 | if (! S_ISREG (sbuf.st_mode)) |
290 | continue; /* not a regular file, skip */ | 290 | continue; /* not a regular file, skip */ |
291 | if (rdc->off + 1024 > rdc->buf_len) | 291 | if (rdc->off + 1024 > rdc->buf_len) |
292 | { | 292 | { |
293 | void *r; | 293 | void *r; |
diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c index 69922136..205bc863 100644 --- a/src/examples/demo_https.c +++ b/src/examples/demo_https.c | |||
@@ -286,11 +286,11 @@ list_directory (struct ResponseDataContext *rdc, | |||
286 | snprintf (fullname, sizeof (fullname), | 286 | snprintf (fullname, sizeof (fullname), |
287 | "%s/%s", | 287 | "%s/%s", |
288 | dirname, de->d_name)) | 288 | dirname, de->d_name)) |
289 | continue; /* ugh, file too long? how can this be!? */ | 289 | continue; /* ugh, file too long? how can this be!? */ |
290 | if (0 != stat (fullname, &sbuf)) | 290 | if (0 != stat (fullname, &sbuf)) |
291 | continue; /* ugh, failed to 'stat' */ | 291 | continue; /* ugh, failed to 'stat' */ |
292 | if (! S_ISREG (sbuf.st_mode)) | 292 | if (! S_ISREG (sbuf.st_mode)) |
293 | continue; /* not a regular file, skip */ | 293 | continue; /* not a regular file, skip */ |
294 | if (rdc->off + 1024 > rdc->buf_len) | 294 | if (rdc->off + 1024 > rdc->buf_len) |
295 | { | 295 | { |
296 | void *r; | 296 | void *r; |
diff --git a/src/examples/fileserver_example.c b/src/examples/fileserver_example.c index 767810f9..94c2ca95 100644 --- a/src/examples/fileserver_example.c +++ b/src/examples/fileserver_example.c | |||
@@ -69,13 +69,13 @@ ahc_echo (void *cls, | |||
69 | *ptr = &aptr; | 69 | *ptr = &aptr; |
70 | return MHD_YES; | 70 | return MHD_YES; |
71 | } | 71 | } |
72 | *ptr = NULL; /* reset when done */ | 72 | *ptr = NULL; /* reset when done */ |
73 | /* WARNING: direct usage of url as filename is for example only! | 73 | /* WARNING: direct usage of url as filename is for example only! |
74 | * NEVER pass received data directly as parameter to file manipulation | 74 | * NEVER pass received data directly as parameter to file manipulation |
75 | * functions. Always check validity of data before using. | 75 | * functions. Always check validity of data before using. |
76 | */ | 76 | */ |
77 | if (NULL != strstr (url, "../")) /* Very simplified check! */ | 77 | if (NULL != strstr (url, "../")) /* Very simplified check! */ |
78 | fd = -1; /* Do not allow usage of parent directories. */ | 78 | fd = -1; /* Do not allow usage of parent directories. */ |
79 | else | 79 | else |
80 | fd = open (url + 1, O_RDONLY); | 80 | fd = open (url + 1, O_RDONLY); |
81 | if (-1 != fd) | 81 | if (-1 != fd) |
diff --git a/src/examples/websocket_threaded_example.c b/src/examples/websocket_threaded_example.c index 44cb3493..13e75dab 100644 --- a/src/examples/websocket_threaded_example.c +++ b/src/examples/websocket_threaded_example.c | |||
@@ -36,40 +36,40 @@ | |||
36 | "<title>WebSocket chat</title>\n" \ | 36 | "<title>WebSocket chat</title>\n" \ |
37 | "<script>\n" \ | 37 | "<script>\n" \ |
38 | "document.addEventListener('DOMContentLoaded', function() {\n" \ | 38 | "document.addEventListener('DOMContentLoaded', function() {\n" \ |
39 | " const ws = new WebSocket('ws://' + window.location.host);\n" \ | 39 | " const ws = new WebSocket('ws:// ' + window.location.host);\n" \ |
40 | " const btn = document.getElementById('send');\n" \ | 40 | // " const btn = document.getElementById('send');\n" \ |
41 | " const msg = document.getElementById('msg');\n" \ | 41 | // " const msg = document.getElementById('msg');\n" \ |
42 | " const log = document.getElementById('log');\n" \ | 42 | // " const log = document.getElementById('log');\n" \ |
43 | " ws.onopen = function() {\n" \ | 43 | // " ws.onopen = function() {\n" \ |
44 | " log.value += 'Connected\\n';\n" \ | 44 | // " log.value += 'Connected\\n';\n" \ |
45 | " };\n" \ | 45 | // " };\n" \ |
46 | " ws.onclose = function() {\n" \ | 46 | // " ws.onclose = function() {\n" \ |
47 | " log.value += 'Disconnected\\n';\n" \ | 47 | // " log.value += 'Disconnected\\n';\n" \ |
48 | " };\n" \ | 48 | // " };\n" \ |
49 | " ws.onmessage = function(ev) {\n" \ | 49 | // " ws.onmessage = function(ev) {\n" \ |
50 | " log.value += ev.data + '\\n';\n" \ | 50 | // " log.value += ev.data + '\\n';\n" \ |
51 | " };\n" \ | 51 | // " };\n" \ |
52 | " btn.onclick = function() {\n" \ | 52 | // " btn.onclick = function() {\n" \ |
53 | " log.value += '<You>: ' + msg.value + '\\n';\n" \ | 53 | // " log.value += '<You>: ' + msg.value + '\\n';\n" \ |
54 | " ws.send(msg.value);\n" \ | 54 | // " ws.send(msg.value);\n" \ |
55 | " };\n" \ | 55 | // " };\n" \ |
56 | " msg.onkeyup = function(ev) {\n" \ | 56 | // " msg.onkeyup = function(ev) {\n" \ |
57 | " if (ev.keyCode === 13) {\n" \ | 57 | // " if (ev.keyCode === 13) {\n" \ |
58 | " ev.preventDefault();\n" \ | 58 | // " ev.preventDefault();\n" \ |
59 | " ev.stopPropagation();\n" \ | 59 | // " ev.stopPropagation();\n" \ |
60 | " btn.click();\n" \ | 60 | // " btn.click();\n" \ |
61 | " msg.value = '';\n" \ | 61 | // " msg.value = '';\n" \ |
62 | " }\n" \ | 62 | // " }\n" \ |
63 | " };\n" \ | 63 | // " };\n" \ |
64 | "});\n" \ | 64 | // "});\n" \ |
65 | "</script>\n" \ | 65 | // "</script>\n" \ |
66 | "</head>\n" \ | 66 | // "</head>\n" \ |
67 | "<body>\n" \ | 67 | // "<body>\n" \ |
68 | "<input type='text' id='msg' autofocus/>\n" \ | 68 | // "<input type='text' id='msg' autofocus/>\n" \ |
69 | "<input type='button' id='send' value='Send' /><br /><br />\n" \ | 69 | // "<input type='button' id='send' value='Send' /><br /><br />\n" \ |
70 | "<textarea id='log' rows='20' cols='28'></textarea>\n" \ | 70 | // "<textarea id='log' rows='20' cols='28'></textarea>\n" \ |
71 | "</body>\n" \ | 71 | // "</body>\n" \ |
72 | "</html>" | 72 | // "</html>" |
73 | #define BAD_REQUEST_PAGE \ | 73 | #define BAD_REQUEST_PAGE \ |
74 | "<html>\n" \ | 74 | "<html>\n" \ |
75 | "<head>\n" \ | 75 | "<head>\n" \ |