aboutsummaryrefslogtreecommitdiff
path: root/src/include/microhttpd2.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/microhttpd2.h')
-rw-r--r--src/include/microhttpd2.h156
1 files changed, 94 insertions, 62 deletions
diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h
index 8d89a807..f54d16b2 100644
--- a/src/include/microhttpd2.h
+++ b/src/include/microhttpd2.h
@@ -333,37 +333,51 @@ struct MHD_Connection;
333enum MHD_StatusCode 333enum MHD_StatusCode
334{ 334{
335 335
336 /* 00000-level status codes indicate return values
337 the application must act on. */
338
336 /** 339 /**
337 * Successful operation (not used for logging). 340 * Successful operation (not used for logging).
338 */ 341 */
339 MHD_SC_OK = 0, 342 MHD_SC_OK = 0,
340 343
341 /** 344 /**
342 * Informational event, MHD started. 345 * We were asked to return a timeout, but, there is no timeout.
343 */ 346 */
344 MHD_SC_DAEMON_STARTED = 10000, 347 MHD_SC_NO_TIMEOUT = 1,
345 348
349
350 /* 10000-level status codes indicate intermediate
351 results of some kind. */
352
346 /** 353 /**
347 * Informational event, there is no timeout. 354 * Informational event, MHD started.
348 */ 355 */
349 MHD_SC_NO_TIMEOUT = 10001, 356 MHD_SC_DAEMON_STARTED = 10000,
350 357
351 /** 358 /**
352 * Informational event, we accepted a connection. 359 * Informational event, we accepted a connection.
353 */ 360 */
354 MHD_SC_CONNECTION_ACCEPTED = 10002, 361 MHD_SC_CONNECTION_ACCEPTED = 10001,
355 362
356 /** 363 /**
357 * Informational event, thread processing connection termiantes. 364 * Informational event, thread processing connection termiantes.
358 */ 365 */
359 MHD_SC_THREAD_TERMINATING = 10003, 366 MHD_SC_THREAD_TERMINATING = 10002,
360 367
361 /** 368 /**
362 * Informational event, state machine status for a connection. 369 * Informational event, state machine status for a connection.
363 */ 370 */
364 MHD_SC_STATE_MACHINE_STATUS_REPORT = 10004, 371 MHD_SC_STATE_MACHINE_STATUS_REPORT = 10003,
372
373 /**
374 * accept() returned transient error.
375 */
376 MHD_SC_ACCEPT_FAILED_EAGAIN = 10004,
365 377
366 378
379 /* 20000-level status codes indicate success of some kind. */
380
367 /** 381 /**
368 * MHD is closing a connection after the client closed it 382 * MHD is closing a connection after the client closed it
369 * (perfectly normal end). 383 * (perfectly normal end).
@@ -375,6 +389,11 @@ enum MHD_StatusCode
375 * logic to generate the response data completed. 389 * logic to generate the response data completed.
376 */ 390 */
377 MHD_SC_APPLICATION_DATA_GENERATION_FINISHED = 20001, 391 MHD_SC_APPLICATION_DATA_GENERATION_FINISHED = 20001,
392
393
394 /* 30000-level status codes indicate transient failures
395 that might go away if the client tries again. */
396
378 397
379 /** 398 /**
380 * Resource limit in terms of number of parallel connections 399 * Resource limit in terms of number of parallel connections
@@ -383,129 +402,103 @@ enum MHD_StatusCode
383 MHD_SC_LIMIT_CONNECTIONS_REACHED = 30000, 402 MHD_SC_LIMIT_CONNECTIONS_REACHED = 30000,
384 403
385 /** 404 /**
386 * accept() returned transient error.
387 */
388 MHD_SC_ACCEPT_FAILED_EAGAIN = 30001,
389
390 /**
391 * We failed to allocate memory for poll() syscall. 405 * We failed to allocate memory for poll() syscall.
392 * (May be transient.) 406 * (May be transient.)
393 */ 407 */
394 MHD_SC_POLL_MALLOC_FAILURE = 30002, 408 MHD_SC_POLL_MALLOC_FAILURE = 30001,
395 409
396 /** 410 /**
397 * The operation failed because the respective 411 * The operation failed because the respective
398 * daemon is already too deep inside of the shutdown 412 * daemon is already too deep inside of the shutdown
399 * activity. 413 * activity.
400 */ 414 */
401 MHD_SC_DAEMON_ALREADY_SHUTDOWN = 30003, 415 MHD_SC_DAEMON_ALREADY_SHUTDOWN = 30002,
402 416
403 /** 417 /**
404 * We failed to start a thread. 418 * We failed to start a thread.
405 */ 419 */
406 MHD_SC_THREAD_LAUNCH_FAILURE = 30004, 420 MHD_SC_THREAD_LAUNCH_FAILURE = 30003,
407 421
408 /** 422 /**
409 * The operation failed because we either have no 423 * The operation failed because we either have no
410 * listen socket or were already quiesced. 424 * listen socket or were already quiesced.
411 */ 425 */
412 MHD_SC_DAEMON_ALREADY_QUIESCED = 30005, 426 MHD_SC_DAEMON_ALREADY_QUIESCED = 30004,
413 427
414 /** 428 /**
415 * The operation failed because client disconnected 429 * The operation failed because client disconnected
416 * faster than we could accept(). 430 * faster than we could accept().
417 */ 431 */
418 MHD_SC_ACCEPT_FAST_DISCONNECT = 30006, 432 MHD_SC_ACCEPT_FAST_DISCONNECT = 30005,
419 433
420 /** 434 /**
421 * Operating resource limits hit on accept(). 435 * Operating resource limits hit on accept().
422 */ 436 */
423 MHD_SC_ACCEPT_SYSTEM_LIMIT_REACHED = 30007, 437 MHD_SC_ACCEPT_SYSTEM_LIMIT_REACHED = 30006,
424 438
425 /** 439 /**
426 * Connection was refused by accept policy callback. 440 * Connection was refused by accept policy callback.
427 */ 441 */
428 MHD_SC_ACCEPT_POLICY_REJECTED = 30008, 442 MHD_SC_ACCEPT_POLICY_REJECTED = 30007,
429 443
430 /** 444 /**
431 * We failed to allocate memory for the connection. 445 * We failed to allocate memory for the connection.
432 * (May be transient.) 446 * (May be transient.)
433 */ 447 */
434 MHD_SC_CONNECTION_MALLOC_FAILURE = 30009, 448 MHD_SC_CONNECTION_MALLOC_FAILURE = 30008,
435 449
436 /** 450 /**
437 * We failed to allocate memory for the connection's memory pool. 451 * We failed to allocate memory for the connection's memory pool.
438 * (May be transient.) 452 * (May be transient.)
439 */ 453 */
440 MHD_SC_POOL_MALLOC_FAILURE = 30010, 454 MHD_SC_POOL_MALLOC_FAILURE = 30009,
441 455
442 /** 456 /**
443 * We failed to forward data from a Web socket to the 457 * We failed to forward data from a Web socket to the
444 * application to the remote side due to the socket 458 * application to the remote side due to the socket
445 * being closed prematurely. (May be transient.) 459 * being closed prematurely. (May be transient.)
446 */ 460 */
447 MHD_SC_UPGRADE_FORWARD_INCOMPLETE = 30011, 461 MHD_SC_UPGRADE_FORWARD_INCOMPLETE = 30010,
448
449 /**
450 * MHD is closing a connection because it was reset.
451 */
452 MHD_SC_CONNECTION_RESET_CLOSED = 30012,
453
454 /**
455 * MHD is closing a connection because reading the
456 * request failed.
457 */
458 MHD_SC_CONNECTION_READ_FAIL_CLOSED = 30013,
459
460 /**
461 * MHD is closing a connection because writing the response failed.
462 */
463 MHD_SC_CONNECTION_WRITE_FAIL_CLOSED = 30014,
464
465 /**
466 * MHD is closing a connection because the application
467 * logic to generate the response data failed.
468 */
469 MHD_SC_APPLICATION_DATA_GENERATION_FAILURE_CLOSED = 30015,
470 462
471 /** 463 /**
472 * We failed to allocate memory for generatig the response from our 464 * We failed to allocate memory for generatig the response from our
473 * memory pool. Likely the request header was too large to leave 465 * memory pool. Likely the request header was too large to leave
474 * enough room. 466 * enough room.
475 */ 467 */
476 MHD_SC_CONNECTION_POOL_MALLOC_FAILURE = 30016, 468 MHD_SC_CONNECTION_POOL_MALLOC_FAILURE = 30011,
477 469
478 470
471 /* 40000-level errors are caused by the HTTP client
472 (or the network) */
479 473
480 /** 474 /**
481 * MHD does not support the requested combination of 475 * MHD is closing a connection because parsing the
482 * EPOLL with thread-per-connection mode. 476 * request failed.
483 */
484 MHD_SC_SYSCALL_THREAD_COMBINATION_INVALID = 40000,
485
486 /**
487 * MHD does not support quiescing if ITC was disabled
488 * and threads are used.
489 */ 477 */
490 MHD_SC_SYSCALL_QUIESCE_REQUIRES_ITC = 40001, 478 MHD_SC_CONNECTION_PARSE_FAIL_CLOSED = 40000,
491 479
492 /** 480 /**
493 * We failed to bind the listen socket. 481 * MHD is closing a connection because it was reset.
494 */ 482 */
495 MHD_SC_LISTEN_SOCKET_BIND_FAILED = 40002, 483 MHD_SC_CONNECTION_RESET_CLOSED = 40001,
496 484
497 /** 485 /**
498 * The application requested an unsupported TLS backend to be used. 486 * MHD is closing a connection because reading the
487 * request failed.
499 */ 488 */
500 MHD_SC_TLS_BACKEND_UNSUPPORTED = 40003, 489 MHD_SC_CONNECTION_READ_FAIL_CLOSED = 40002,
501 490
502 /** 491 /**
503 * The application requested a TLS cipher suite which is not 492 * MHD is closing a connection because writing the response failed.
504 * supported by the selected backend.
505 */ 493 */
506 MHD_SC_TLS_CIPHERS_INVALID = 40004, 494 MHD_SC_CONNECTION_WRITE_FAIL_CLOSED = 40003,
507 495
508 496
497
498 /* 50000-level errors are because of an error internal
499 to the MHD logic, possibly including our interaction
500 with the operating system (but not the application) */
501
509 /** 502 /**
510 * This build of MHD does not support TLS, but the application 503 * This build of MHD does not support TLS, but the application
511 * requested TLS. 504 * requested TLS.
@@ -788,7 +781,46 @@ enum MHD_StatusCode
788 * state machine, we closed the connection. 781 * state machine, we closed the connection.
789 */ 782 */
790 MHD_SC_STATEMACHINE_FAILURE_CONNECTION_CLOSED = 50054, 783 MHD_SC_STATEMACHINE_FAILURE_CONNECTION_CLOSED = 50054,
791 784
785
786 /* 60000-level errors are because the application
787 logic did something wrong or generated an error. */
788
789 /**
790 * MHD does not support the requested combination of
791 * EPOLL with thread-per-connection mode.
792 */
793 MHD_SC_SYSCALL_THREAD_COMBINATION_INVALID = 60000,
794
795 /**
796 * MHD does not support quiescing if ITC was disabled
797 * and threads are used.
798 */
799 MHD_SC_SYSCALL_QUIESCE_REQUIRES_ITC = 60001,
800
801 /**
802 * We failed to bind the listen socket.
803 */
804 MHD_SC_LISTEN_SOCKET_BIND_FAILED = 60002,
805
806 /**
807 * The application requested an unsupported TLS backend to be used.
808 */
809 MHD_SC_TLS_BACKEND_UNSUPPORTED = 60003,
810
811 /**
812 * The application requested a TLS cipher suite which is not
813 * supported by the selected backend.
814 */
815 MHD_SC_TLS_CIPHERS_INVALID = 60004,
816
817 /**
818 * MHD is closing a connection because the application
819 * logic to generate the response data failed.
820 */
821 MHD_SC_APPLICATION_DATA_GENERATION_FAILURE_CLOSED = 60005,
822
823
792}; 824};
793 825
794 826