mirror of
https://github.com/nghttp2/nghttp2.git
synced 2025-12-07 18:48:54 +08:00
src: Implement per-frame DATA compression
Currently, nghttpd server only compresses files whose extensions are one of .html, .js, .css and .txt. nghttp advertises its support of per-frame compression in SETTINGS frame. To implement this feature, we added 2 public API: nghttp2_session_get_remote_settings() and nghttp2_gzip_inflate_finished().
This commit is contained in:
@@ -2080,6 +2080,14 @@ int32_t nghttp2_session_get_stream_remote_window_size(nghttp2_session* session,
|
||||
int nghttp2_session_terminate_session(nghttp2_session *session,
|
||||
nghttp2_error_code error_code);
|
||||
|
||||
/**
|
||||
* @function
|
||||
*
|
||||
* Returns the value of SETTINGS |id| notified by a remote endpoint.
|
||||
*/
|
||||
uint32_t nghttp2_session_get_remote_settings(nghttp2_session *session,
|
||||
nghttp2_settings_id id);
|
||||
|
||||
/**
|
||||
* @function
|
||||
*
|
||||
@@ -2799,6 +2807,15 @@ int nghttp2_gzip_inflate(nghttp2_gzip *inflater,
|
||||
uint8_t *out, size_t *outlen_ptr,
|
||||
const uint8_t *in, size_t *inlen_ptr);
|
||||
|
||||
/**
|
||||
* @function
|
||||
*
|
||||
* Returns nonzero if |inflater| sees the end of deflate stream.
|
||||
* After this function returns nonzero, `nghttp2_gzip_inflate()` with
|
||||
* |inflater| gets to return error.
|
||||
*/
|
||||
int nghttp2_gzip_inflate_finished(nghttp2_gzip *inflater);
|
||||
|
||||
/**
|
||||
* @function
|
||||
*
|
||||
|
||||
@@ -89,3 +89,8 @@ int nghttp2_gzip_inflate(nghttp2_gzip *inflater,
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int nghttp2_gzip_inflate_finished(nghttp2_gzip *inflater)
|
||||
{
|
||||
return inflater->finished;
|
||||
}
|
||||
|
||||
@@ -5779,6 +5779,16 @@ int32_t nghttp2_session_get_stream_remote_window_size(nghttp2_session* session,
|
||||
return nghttp2_session_next_data_read(session, stream);
|
||||
}
|
||||
|
||||
uint32_t nghttp2_session_get_remote_settings(nghttp2_session *session,
|
||||
nghttp2_settings_id id)
|
||||
{
|
||||
if(id > NGHTTP2_SETTINGS_MAX) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return session->remote_settings[id];
|
||||
}
|
||||
|
||||
int nghttp2_session_upgrade(nghttp2_session *session,
|
||||
const uint8_t *settings_payload,
|
||||
size_t settings_payloadlen,
|
||||
|
||||
Reference in New Issue
Block a user