#ifdef NGHTTP2_STATICLIB
#define NGHTTP2_EXTERN
#elif defined(WIN32)
+#ifdef BUILDING_NGHTTP2
#define NGHTTP2_EXTERN __declspec(dllexport)
-#else /* !defined(WIN32) */
+#else /* !BUILDING_NGHTTP2 */
+#define NGHTTP2_EXTERN __declspec(dllimport)
+#endif /* !BUILDING_NGHTTP2 */
+#else /* !defined(WIN32) */
#define NGHTTP2_EXTERN
#endif /* !defined(WIN32) */
*
* To set this callback to :type:`nghttp2_session_callbacks`, use
* `nghttp2_session_callbacks_set_send_callback()`.
+ *
+ * .. note::
+ *
+ * The |length| may be very small. If that is the case, and
+ * application disables Nagle algorithm (``TCP_NODELAY``), then just
+ * writing |data| to the network stack leads to very small packet,
+ * and it is very inefficient. An application should be responsible
+ * to buffer up small chunks of data as necessary to avoid this
+ * situation.
*/
typedef ssize_t (*nghttp2_send_callback)(nghttp2_session *session,
const uint8_t *data, size_t length,
*
* :enum:`NGHTTP2_ERR_NOMEM`
* Out of memory.
+ *
+ * .. note::
+ *
+ * This function may produce very small byte string. If that is the
+ * case, and application disables Nagle algorithm (``TCP_NODELAY``),
+ * then writing this small chunk leads to very small packet, and it
+ * is very inefficient. An application should be responsible to
+ * buffer up small chunks of data as necessary to avoid this
+ * situation.
*/
NGHTTP2_EXTERN ssize_t nghttp2_session_mem_send(nghttp2_session *session,
const uint8_t **data_ptr);
return 0;
fail2:
- if (flags & NGHTTP2_HD_FLAG_NAME_ALLOC) {
+ if ((flags & NGHTTP2_HD_FLAG_NAME_ALLOC) &&
+ (flags & NGHTTP2_HD_FLAG_NAME_GIFT) == 0) {
nghttp2_mem_free(mem, ent->nv.name);
}
fail:
return 0;
}
- nghttp2_mem_free(mem, nv.value);
+ if (inflater->index < NGHTTP2_STATIC_TABLE_LENGTH) {
+ nghttp2_mem_free(mem, nv.value);
+ } else {
+ nghttp2_mem_free(mem, nv.name);
+ }
return NGHTTP2_ERR_NOMEM;
}
* @macro
* Version number of the nghttp2 library release
*/
-#define NGHTTP2_VERSION "1.0.0"
+#define NGHTTP2_VERSION "1.0.4"
/**
* @macro
* release. This is a 24 bit number with 8 bits for major number, 8 bits
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
*/
-#define NGHTTP2_VERSION_NUM 0x010000
+#define NGHTTP2_VERSION_NUM 0x010004
#endif /* NGHTTP2VER_H */