summaryrefslogtreecommitdiff
path: root/lib/extv.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/extv.h')
-rw-r--r--lib/extv.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/extv.h b/lib/extv.h
index 9f13f7a2ce..c791d9bba9 100644
--- a/lib/extv.h
+++ b/lib/extv.h
@@ -48,9 +48,11 @@ int _gnutls_extv_append_init(gnutls_buffer_st *buf)
return pos;
}
-/* its input is the buffer and the return value of _gnutls_extv_append_init() */
+/* its input is the buffer and the return value of _gnutls_extv_append_init()
+ * @is_hello: should be true for client and server hello messages.
+ */
inline static
-int _gnutls_extv_append_final(gnutls_buffer_st *buf, unsigned init)
+int _gnutls_extv_append_final(gnutls_buffer_st *buf, unsigned init, unsigned is_hello)
{
unsigned size = buf->length - init - 2;
@@ -59,6 +61,11 @@ int _gnutls_extv_append_final(gnutls_buffer_st *buf, unsigned init)
if (size > 0)
_gnutls_write_uint16(size, &buf->data[init]);
+ else if (is_hello && size == 0) {
+ /* there is no point to send empty extension bytes, and
+ * they are known to break certain clients */
+ buf->length -= 2;
+ }
return 0;
}