Lines Matching refs:socket

213 			   nghttp2_session *ngsession, isc_nmsocket_t *socket);
229 server_call_cb(isc_nmsocket_t *socket, const isc_result_t result,
530 /* detach from server socket */
672 * the socket gets marked as inactive, allowing the HTTP/2 data
675 * An HTTP/2 stream socket will normally be marked as inactive in
981 * Read callback from TLS socket.
1688 isc_nmsocket_t *socket = NULL;
1707 socket = isc_mempool_get(worker->nmsocket_pool);
1709 isc__nmsocket_init(socket, worker, isc_nm_httpsocket, &local, NULL);
1710 http_initsocket(socket);
1711 socket->peer = isc_nmhandle_peeraddr(session->handle);
1712 *socket->h2 = (isc_nmsocket_h2_t){
1713 .psock = socket,
1720 isc_buffer_initnull(&socket->h2->rbuf);
1721 isc_buffer_initnull(&socket->h2->wbuf);
1723 http_get_listener_endpoints(session->serversocket, socket->tid),
1724 &socket->h2->peer_endpoints);
1726 isc__nm_httpsession_attach(session, &socket->h2->session);
1727 ISC_LIST_APPEND(session->sstreams, socket->h2, link);
1730 socket);
1735 server_handle_path_header(isc_nmsocket_t *socket, const uint8_t *value,
1746 if (socket->h2->request_path != NULL) {
1747 isc_mem_free(socket->worker->mctx, socket->h2->request_path);
1749 socket->h2->request_path = isc_mem_strndup(
1750 socket->worker->mctx, (const char *)value, vlen + 1);
1752 if (!isc_nm_http_path_isvalid(socket->h2->request_path)) {
1753 isc_mem_free(socket->worker->mctx, socket->h2->request_path);
1754 socket->h2->request_path = NULL;
1758 handler = http_endpoints_find(socket->h2->request_path,
1759 socket->h2->peer_endpoints);
1761 socket->h2->cb = handler->cb;
1762 socket->h2->cbarg = handler->cbarg;
1764 isc_mem_free(socket->worker->mctx, socket->h2->request_path);
1765 socket->h2->request_path = NULL;
1778 if (socket->h2->query_data != NULL) {
1779 isc_mem_free(socket->worker->mctx,
1780 socket->h2->query_data);
1782 socket->h2->query_data =
1784 socket->worker->mctx, dns_value,
1786 &socket->h2->query_data_len);
1788 socket->h2->query_too_large = true;
1799 server_handle_method_header(isc_nmsocket_t *socket, const uint8_t *value,
1805 socket->h2->request_type = ISC_HTTP_REQ_GET;
1807 socket->h2->request_type = ISC_HTTP_REQ_POST;
1815 server_handle_scheme_header(isc_nmsocket_t *socket, const uint8_t *value,
1821 socket->h2->request_scheme = ISC_HTTP_SCHEME_HTTP_SECURE;
1823 socket->h2->request_scheme = ISC_HTTP_SCHEME_HTTP;
1831 server_handle_content_length_header(isc_nmsocket_t *socket,
1839 socket->h2->content_length = strtoul(tmp, NULL, 10);
1840 if (socket->h2->content_length > MAX_DNS_MESSAGE_SIZE) {
1842 } else if (socket->h2->content_length == 0) {
1849 server_handle_content_type_header(isc_nmsocket_t *socket, const uint8_t *value,
1854 UNUSED(socket);
1863 server_handle_header(isc_nmsocket_t *socket, const uint8_t *name,
1874 was_error = socket->h2->headers_error_code != ISC_HTTP_ERROR_SUCCESS;
1880 code = server_handle_content_length_header(socket, value,
1883 code = server_handle_path_header(socket, value, valuelen);
1885 code = server_handle_method_header(socket, value, valuelen);
1887 code = server_handle_scheme_header(socket, value, valuelen);
1889 code = server_handle_content_type_header(socket, value,
1901 isc_nmsocket_t *socket = NULL;
1907 socket = nghttp2_session_get_stream_user_data(session,
1909 if (socket == NULL) {
1913 socket->h2->headers_data_processed += (namelen + valuelen);
1920 code = server_handle_header(socket, name, namelen, value,
1925 INSIST(socket != NULL);
1927 if (socket->h2->headers_data_processed > MAX_ALLOWED_DATA_IN_HEADERS) {
1929 } else if (socket->h2->content_length > MAX_ALLOWED_DATA_IN_POST) {
1936 socket->h2->headers_error_code = code;
1947 isc_nmsocket_t *socket = (isc_nmsocket_t *)source->ptr;
1950 REQUIRE(socket->h2->stream_id == stream_id);
1955 buflen = isc_buffer_remaininglength(&socket->h2->wbuf);
1961 (void)memmove(buf, isc_buffer_current(&socket->h2->wbuf),
1963 isc_buffer_forward(&socket->h2->wbuf, buflen);
1966 if (isc_buffer_remaininglength(&socket->h2->wbuf) == 0) {
1976 isc_nmsocket_t *socket) {
1980 if (socket->h2->response_submitted) {
1989 data_prd.source.ptr = socket;
1998 socket->h2->response_submitted = true;
2027 log_server_error_response(const isc_nmsocket_t *socket,
2037 isc_sockaddr_format(&socket->peer, client_sabuf, sizeof(client_sabuf));
2038 isc_sockaddr_format(&socket->iface, local_sabuf, sizeof(local_sabuf));
2039 isc__nmsocket_log(socket, log_level,
2047 nghttp2_session *ngsession, isc_nmsocket_t *socket) {
2052 base = isc_buffer_base(&socket->h2->rbuf);
2054 isc_mem_free(socket->h2->session->mctx, base);
2055 isc_buffer_initnull(&socket->h2->rbuf);
2059 socket->h2->min_ttl = 0;
2065 log_server_error_response(socket, &error_responses[i]);
2067 ngsession, socket->h2->stream_id,
2068 &error_responses[i].header, 1, socket);
2073 socket);
2077 server_call_cb(isc_nmsocket_t *socket, const isc_result_t result,
2081 REQUIRE(VALID_NMSOCK(socket));
2088 if (socket->h2->cb == NULL) {
2092 handle = isc__nmhandle_get(socket, NULL, NULL);
2096 socket->h2->cb(handle, result, data, socket->h2->cbarg);
2116 server_on_request_recv(nghttp2_session *ngsession, isc_nmsocket_t *socket) {
2122 code = socket->h2->headers_error_code;
2127 if (socket->h2->request_path == NULL || socket->h2->cb == NULL) {
2129 } else if (socket->h2->request_type == ISC_HTTP_REQ_POST &&
2130 socket->h2->content_length == 0)
2133 } else if (socket->h2->request_type == ISC_HTTP_REQ_POST &&
2134 isc_buffer_usedlength(&socket->h2->rbuf) >
2135 socket->h2->content_length)
2138 } else if (socket->h2->request_type == ISC_HTTP_REQ_POST &&
2139 isc_buffer_usedlength(&socket->h2->rbuf) !=
2140 socket->h2->content_length)
2143 } else if (socket->h2->request_type == ISC_HTTP_REQ_POST &&
2144 socket->h2->query_data != NULL)
2153 } else if (socket->h2->request_type == ISC_HTTP_REQ_GET &&
2154 socket->h2->content_length > 0)
2157 } else if (socket->h2->request_type == ISC_HTTP_REQ_GET &&
2158 socket->h2->query_data == NULL)
2162 INSIST(socket->h2->query_data_len == 0);
2170 if (socket->h2->request_type == ISC_HTTP_REQ_GET) {
2173 if (isc_base64_decodestring(socket->h2->query_data,
2180 } else if (socket->h2->request_type == ISC_HTTP_REQ_POST) {
2181 INSIST(socket->h2->content_length > 0);
2182 isc_buffer_usedregion(&socket->h2->rbuf, &data);
2187 server_call_cb(socket, ISC_R_SUCCESS, &data);
2192 result = server_send_error_response(code, ngsession, socket);
2374 isc_nmsocket_t *socket = NULL;
2383 socket = nghttp2_session_get_stream_user_data(
2394 if (socket == NULL) {
2398 return server_on_request_recv(ngsession, socket);
2713 * The socket is going to be closed too early without been
2819 isc_nmsocket_h2_t *h2data = NULL; /* stream socket */
2834 /* Cleanup socket in place */