Mercurial > hg > nginx
view src/os/win32/ngx_event_log.c @ 8795:278ab0ed24f2 quic
HTTP/3: generate more H3_FRAME_UNEXPECTED.
As per quic-http-34, these are the cases when this error should be generated:
If an endpoint receives a second SETTINGS frame
on the control stream, the endpoint MUST respond with a connection
error of type H3_FRAME_UNEXPECTED
SETTINGS frames MUST NOT be sent on any stream other than the control
stream. If an endpoint receives a SETTINGS frame on a different
stream, the endpoint MUST respond with a connection error of type
H3_FRAME_UNEXPECTED.
A client MUST NOT send a PUSH_PROMISE frame. A server MUST treat the
receipt of a PUSH_PROMISE frame as a connection error of type
H3_FRAME_UNEXPECTED; see Section 8.
The MAX_PUSH_ID frame is always sent on the control stream. Receipt
of a MAX_PUSH_ID frame on any other stream MUST be treated as a
connection error of type H3_FRAME_UNEXPECTED.
Receipt of an invalid sequence of frames MUST be treated as a
connection error of type H3_FRAME_UNEXPECTED; see Section 8. In
particular, a DATA frame before any HEADERS frame, or a HEADERS or
DATA frame after the trailing HEADERS frame, is considered invalid.
A CANCEL_PUSH frame is sent on the control stream. Receiving a
CANCEL_PUSH frame on a stream other than the control stream MUST be
treated as a connection error of type H3_FRAME_UNEXPECTED.
The GOAWAY frame is always sent on the control stream.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Fri, 11 Jun 2021 12:11:08 +0300 |
parents | d620f497c50f |
children |
line wrap: on
line source
/* * Copyright (C) Igor Sysoev * Copyright (C) Nginx, Inc. */ #include <ngx_config.h> #include <ngx_core.h> #define NGX_MAX_ERROR_STR 2048 void ngx_cdecl ngx_event_log(ngx_err_t err, const char *fmt, ...) { u_char *p, *last; long types; HKEY key; HANDLE ev; va_list args; u_char text[NGX_MAX_ERROR_STR]; const char *msgarg[9]; static u_char netmsg[] = "%SystemRoot%\\System32\\netmsg.dll"; last = text + NGX_MAX_ERROR_STR; p = text + GetModuleFileName(NULL, (char *) text, NGX_MAX_ERROR_STR - 50); *p++ = ':'; ngx_linefeed(p); va_start(args, fmt); p = ngx_vslprintf(p, last, fmt, args); va_end(args); if (err) { p = ngx_log_errno(p, last, err); } if (p > last - NGX_LINEFEED_SIZE - 1) { p = last - NGX_LINEFEED_SIZE - 1; } ngx_linefeed(p); *p = '\0'; /* * we do not log errors here since we use * Event Log only to log our own logs open errors */ if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\nginx", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &key, NULL) != 0) { return; } if (RegSetValueEx(key, "EventMessageFile", 0, REG_EXPAND_SZ, netmsg, sizeof(netmsg) - 1) != 0) { return; } types = EVENTLOG_ERROR_TYPE; if (RegSetValueEx(key, "TypesSupported", 0, REG_DWORD, (u_char *) &types, sizeof(long)) != 0) { return; } RegCloseKey(key); ev = RegisterEventSource(NULL, "nginx"); msgarg[0] = (char *) text; msgarg[1] = NULL; msgarg[2] = NULL; msgarg[3] = NULL; msgarg[4] = NULL; msgarg[5] = NULL; msgarg[6] = NULL; msgarg[7] = NULL; msgarg[8] = NULL; /* * the 3299 event id in netmsg.dll has the generic message format: * "%1 %2 %3 %4 %5 %6 %7 %8 %9" */ ReportEvent(ev, EVENTLOG_ERROR_TYPE, 0, 3299, NULL, 9, 0, msgarg, NULL); DeregisterEventSource(ev); }