src/http/modules/perl/nginx.pm - nginx source code

Data types defined

Source code

  1. package nginx;

  2. use 5.006001;
  3. use strict;
  4. use warnings;

  5. require Exporter;

  6. our @ISA = qw(Exporter);

  7. our @EXPORT = qw(
  8.     OK
  9.     DECLINED

  10.     HTTP_OK
  11.     HTTP_CREATED
  12.     HTTP_ACCEPTED
  13.     HTTP_NO_CONTENT
  14.     HTTP_PARTIAL_CONTENT

  15.     HTTP_MOVED_PERMANENTLY
  16.     HTTP_MOVED_TEMPORARILY
  17.     HTTP_REDIRECT
  18.     HTTP_SEE_OTHER
  19.     HTTP_NOT_MODIFIED
  20.     HTTP_TEMPORARY_REDIRECT
  21.     HTTP_PERMANENT_REDIRECT

  22.     HTTP_BAD_REQUEST
  23.     HTTP_UNAUTHORIZED
  24.     HTTP_PAYMENT_REQUIRED
  25.     HTTP_FORBIDDEN
  26.     HTTP_NOT_FOUND
  27.     HTTP_NOT_ALLOWED
  28.     HTTP_NOT_ACCEPTABLE
  29.     HTTP_REQUEST_TIME_OUT
  30.     HTTP_CONFLICT
  31.     HTTP_GONE
  32.     HTTP_LENGTH_REQUIRED
  33.     HTTP_REQUEST_ENTITY_TOO_LARGE
  34.     HTTP_REQUEST_URI_TOO_LARGE
  35.     HTTP_UNSUPPORTED_MEDIA_TYPE
  36.     HTTP_RANGE_NOT_SATISFIABLE

  37.     HTTP_INTERNAL_SERVER_ERROR
  38.     HTTP_SERVER_ERROR
  39.     HTTP_NOT_IMPLEMENTED
  40.     HTTP_BAD_GATEWAY
  41.     HTTP_SERVICE_UNAVAILABLE
  42.     HTTP_GATEWAY_TIME_OUT
  43.     HTTP_INSUFFICIENT_STORAGE
  44. );

  45. our $VERSION = '%%VERSION%%';

  46. require XSLoader;
  47. XSLoader::load('nginx', $VERSION);

  48. # Preloaded methods go here.

  49. use constant OK                             => 0;
  50. use constant DECLINED                       => -5;

  51. use constant HTTP_OK                        => 200;
  52. use constant HTTP_CREATED                   => 201;
  53. use constant HTTP_ACCEPTED                  => 202;
  54. use constant HTTP_NO_CONTENT                => 204;
  55. use constant HTTP_PARTIAL_CONTENT           => 206;

  56. use constant HTTP_MOVED_PERMANENTLY         => 301;
  57. use constant HTTP_MOVED_TEMPORARILY         => 302;
  58. use constant HTTP_REDIRECT                  => 302;
  59. use constant HTTP_SEE_OTHER                 => 303;
  60. use constant HTTP_NOT_MODIFIED              => 304;
  61. use constant HTTP_TEMPORARY_REDIRECT        => 307;
  62. use constant HTTP_PERMANENT_REDIRECT        => 308;

  63. use constant HTTP_BAD_REQUEST               => 400;
  64. use constant HTTP_UNAUTHORIZED              => 401;
  65. use constant HTTP_PAYMENT_REQUIRED          => 402;
  66. use constant HTTP_FORBIDDEN                 => 403;
  67. use constant HTTP_NOT_FOUND                 => 404;
  68. use constant HTTP_NOT_ALLOWED               => 405;
  69. use constant HTTP_NOT_ACCEPTABLE            => 406;
  70. use constant HTTP_REQUEST_TIME_OUT          => 408;
  71. use constant HTTP_CONFLICT                  => 409;
  72. use constant HTTP_GONE                      => 410;
  73. use constant HTTP_LENGTH_REQUIRED           => 411;
  74. use constant HTTP_REQUEST_ENTITY_TOO_LARGE  => 413;
  75. use constant HTTP_REQUEST_URI_TOO_LARGE     => 414;
  76. use constant HTTP_UNSUPPORTED_MEDIA_TYPE    => 415;
  77. use constant HTTP_RANGE_NOT_SATISFIABLE     => 416;

  78. use constant HTTP_INTERNAL_SERVER_ERROR     => 500;
  79. use constant HTTP_SERVER_ERROR              => 500;
  80. use constant HTTP_NOT_IMPLEMENTED           => 501;
  81. use constant HTTP_BAD_GATEWAY               => 502;
  82. use constant HTTP_SERVICE_UNAVAILABLE       => 503;
  83. use constant HTTP_GATEWAY_TIME_OUT          => 504;
  84. use constant HTTP_INSUFFICIENT_STORAGE      => 507;


  85. sub rflush {
  86.     my $r = shift;

  87.     $r->flush;
  88. }


  89. 1;
  90. __END__

  91. =head1 NAME

  92. nginx - Perl interface to the nginx HTTP server API

  93. =head1 SYNOPSIS

  94.   use nginx;

  95. =head1 DESCRIPTION

  96. This module provides a Perl interface to the nginx HTTP server API.


  97. =head1 SEE ALSO

  98. http://nginx.org/en/docs/http/ngx_http_perl_module.html

  99. =head1 AUTHOR

  100. Igor Sysoev

  101. =head1 COPYRIGHT AND LICENSE

  102. Copyright (C) Igor Sysoev
  103. Copyright (C) Nginx, Inc.


  104. =cut