Skip to content

Commit 0a8aa08

Browse files
committed
Merge branch 'cycle-fix' into 'master'
fix: correct edges used for cycle detection when combined files option is false See merge request f5/nginx/crossplane-go!24
2 parents 3841126 + 3b20ccb commit 0a8aa08

File tree

7 files changed

+275
-1
lines changed

7 files changed

+275
-1
lines changed

parse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ func (p *parser) parse(parsing *Config, tokens <-chan NgxToken, ctx blockCtx, co
352352
stmt.Includes = append(stmt.Includes, p.included[fname])
353353
// add edge between the current file and it's included file and
354354
// increase the included file's in degree
355-
p.includeEdges[stmt.File] = append(p.includeEdges[stmt.File], fname)
355+
p.includeEdges[parsing.File] = append(p.includeEdges[parsing.File], fname)
356356
p.includeInDegree[fname]++
357357
}
358358
}

parse_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,3 +1032,10 @@ func TestCombinedIncludes(t *testing.T) {
10321032
}
10331033
}
10341034
}
1035+
1036+
func TestDefaultUbuntu(t *testing.T) {
1037+
t.Parallel()
1038+
path := getTestConfigPath("ubuntu-default", "nginx.conf")
1039+
_, err := Parse(path, &ParseOptions{SingleFile: false, StopParsingOnError: true})
1040+
require.NoError(t, err, "unexpected parsing error when reading test file: %s", path)
1041+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
2+
types {
3+
text/html html htm shtml;
4+
text/css css;
5+
text/xml xml;
6+
image/gif gif;
7+
image/jpeg jpeg jpg;
8+
application/javascript js;
9+
application/atom+xml atom;
10+
application/rss+xml rss;
11+
12+
text/mathml mml;
13+
text/plain txt;
14+
text/vnd.sun.j2me.app-descriptor jad;
15+
text/vnd.wap.wml wml;
16+
text/x-component htc;
17+
18+
image/png png;
19+
image/tiff tif tiff;
20+
image/vnd.wap.wbmp wbmp;
21+
image/x-icon ico;
22+
image/x-jng jng;
23+
image/x-ms-bmp bmp;
24+
image/svg+xml svg svgz;
25+
image/webp webp;
26+
27+
application/font-woff woff;
28+
application/java-archive jar war ear;
29+
application/json json;
30+
application/mac-binhex40 hqx;
31+
application/msword doc;
32+
application/pdf pdf;
33+
application/postscript ps eps ai;
34+
application/rtf rtf;
35+
application/vnd.apple.mpegurl m3u8;
36+
application/vnd.ms-excel xls;
37+
application/vnd.ms-fontobject eot;
38+
application/vnd.ms-powerpoint ppt;
39+
application/vnd.wap.wmlc wmlc;
40+
application/vnd.google-earth.kml+xml kml;
41+
application/vnd.google-earth.kmz kmz;
42+
application/x-7z-compressed 7z;
43+
application/x-cocoa cco;
44+
application/x-java-archive-diff jardiff;
45+
application/x-java-jnlp-file jnlp;
46+
application/x-makeself run;
47+
application/x-perl pl pm;
48+
application/x-pilot prc pdb;
49+
application/x-rar-compressed rar;
50+
application/x-redhat-package-manager rpm;
51+
application/x-sea sea;
52+
application/x-shockwave-flash swf;
53+
application/x-stuffit sit;
54+
application/x-tcl tcl tk;
55+
application/x-x509-ca-cert der pem crt;
56+
application/x-xpinstall xpi;
57+
application/xhtml+xml xhtml;
58+
application/xspf+xml xspf;
59+
application/zip zip;
60+
61+
application/octet-stream bin exe dll;
62+
application/octet-stream deb;
63+
application/octet-stream dmg;
64+
application/octet-stream iso img;
65+
application/octet-stream msi msp msm;
66+
67+
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
68+
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
69+
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;
70+
71+
audio/midi mid midi kar;
72+
audio/mpeg mp3;
73+
audio/ogg ogg;
74+
audio/x-m4a m4a;
75+
audio/x-realaudio ra;
76+
77+
video/3gpp 3gpp 3gp;
78+
video/mp2t ts;
79+
video/mp4 mp4;
80+
video/mpeg mpeg mpg;
81+
video/quicktime mov;
82+
video/webm webm;
83+
video/x-flv flv;
84+
video/x-m4v m4v;
85+
video/x-mng mng;
86+
video/x-ms-asf asx asf;
87+
video/x-ms-wmv wmv;
88+
video/x-msvideo avi;
89+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
load_module modules/ngx_http_image_filter_module.so;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
load_module modules/ngx_http_xslt_filter_module.so;
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
user www-data;
2+
worker_processes auto;
3+
pid /run/nginx.pid;
4+
include modules-enabled/*.conf;
5+
6+
events {
7+
worker_connections 768;
8+
# multi_accept on;
9+
}
10+
11+
http {
12+
13+
##
14+
# Basic Settings
15+
##
16+
17+
sendfile on;
18+
tcp_nopush on;
19+
tcp_nodelay on;
20+
keepalive_timeout 65;
21+
types_hash_max_size 2048;
22+
# server_tokens off;
23+
24+
# server_names_hash_bucket_size 64;
25+
# server_name_in_redirect off;
26+
27+
include mime.types;
28+
default_type application/octet-stream;
29+
30+
##
31+
# SSL Settings
32+
##
33+
34+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
35+
ssl_prefer_server_ciphers on;
36+
37+
##
38+
# Logging Settings
39+
##
40+
41+
access_log /var/log/nginx/access.log;
42+
error_log /var/log/nginx/error.log;
43+
44+
##
45+
# Gzip Settings
46+
##
47+
48+
gzip on;
49+
50+
# gzip_vary on;
51+
# gzip_proxied any;
52+
# gzip_comp_level 6;
53+
# gzip_buffers 16 8k;
54+
# gzip_http_version 1.1;
55+
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
56+
57+
##
58+
# Virtual Host Configs
59+
##
60+
61+
include conf.d/*.conf;
62+
include sites-enabled/*;
63+
}
64+
65+
66+
#mail {
67+
# # See sample authentication script at:
68+
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
69+
#
70+
# # auth_http localhost/auth.php;
71+
# # pop3_capabilities "TOP" "USER";
72+
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
73+
#
74+
# server {
75+
# listen localhost:110;
76+
# protocol pop3;
77+
# proxy on;
78+
# }
79+
#
80+
# server {
81+
# listen localhost:143;
82+
# protocol imap;
83+
# proxy on;
84+
# }
85+
#}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
##
2+
# You should look at the following URL's in order to grasp a solid understanding
3+
# of Nginx configuration files in order to fully unleash the power of Nginx.
4+
# https://www.nginx.com/resources/wiki/start/
5+
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
6+
# https://wiki.debian.org/Nginx/DirectoryStructure
7+
#
8+
# In most cases, administrators will remove this file from sites-enabled/ and
9+
# leave it as reference inside of sites-available where it will continue to be
10+
# updated by the nginx packaging team.
11+
#
12+
# This file will automatically load configuration files provided by other
13+
# applications, such as Drupal or Wordpress. These applications will be made
14+
# available underneath a path with that package name, such as /drupal8.
15+
#
16+
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
17+
##
18+
19+
# Default server configuration
20+
#
21+
server {
22+
listen 80 default_server;
23+
listen [::]:80 default_server;
24+
25+
# SSL configuration
26+
#
27+
# listen 443 ssl default_server;
28+
# listen [::]:443 ssl default_server;
29+
#
30+
# Note: You should disable gzip for SSL traffic.
31+
# See: https://bugs.debian.org/773332
32+
#
33+
# Read up on ssl_ciphers to ensure a secure configuration.
34+
# See: https://bugs.debian.org/765782
35+
#
36+
# Self signed certs generated by the ssl-cert package
37+
# Don't use them in a production server!
38+
#
39+
# include snippets/snakeoil.conf;
40+
41+
root /var/www/html;
42+
43+
# Add index.php to the list if you are using PHP
44+
index index.html index.htm index.nginx-debian.html;
45+
46+
server_name _;
47+
48+
location / {
49+
# First attempt to serve request as file, then
50+
# as directory, then fall back to displaying a 404.
51+
try_files $uri $uri/ =404;
52+
}
53+
54+
# pass PHP scripts to FastCGI server
55+
#
56+
#location ~ \.php$ {
57+
# include snippets/fastcgi-php.conf;
58+
#
59+
# # With php-fpm (or other unix sockets):
60+
# fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
61+
# # With php-cgi (or other tcp sockets):
62+
# fastcgi_pass 127.0.0.1:9000;
63+
#}
64+
65+
# deny access to .htaccess files, if Apache's document root
66+
# concurs with nginx's one
67+
#
68+
#location ~ /\.ht {
69+
# deny all;
70+
#}
71+
}
72+
73+
74+
# Virtual Host configuration for example.com
75+
#
76+
# You can move that to a different file under sites-available/ and symlink that
77+
# to sites-enabled/ to enable it.
78+
#
79+
#server {
80+
# listen 80;
81+
# listen [::]:80;
82+
#
83+
# server_name example.com;
84+
#
85+
# root /var/www/example.com;
86+
# index index.html;
87+
#
88+
# location / {
89+
# try_files $uri $uri/ =404;
90+
# }
91+
#}

0 commit comments

Comments
 (0)