Commit 91daa9d
is_cgi() function of http.server library does not currently handle a
cgi script if one of the cgi_directories is located at the
sub-directory of given path. Since is_cgi() in CGIHTTPRequestHandler
class separates given path into (dir, rest) based on the first seen
'/', multi-level directories like /sub/dir/cgi-bin/hello.py is divided
into head=/sub, rest=dir/cgi-bin/hello.py then check whether '/sub'
exists in cgi_directories = [..., '/sub/dir/cgi-bin'].
This patch makes the is_cgi() keep expanding dir part to the next '/'
then checking if that expanded path exists in the cgi_directories.
Signed-off-by: Siwon Kang <[email protected]>
https://bugs.python.org/issue38863
1 parent b4e5eea commit 91daa9d
3 files changed
Lines changed: 30 additions & 2 deletions
File tree
- Lib
- http
- test
- Misc/NEWS.d/next/Library
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1014 | 1014 | | |
1015 | 1015 | | |
1016 | 1016 | | |
1017 | | - | |
1018 | | - | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
1019 | 1021 | | |
1020 | 1022 | | |
1021 | 1023 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
601 | 601 | | |
602 | 602 | | |
603 | 603 | | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
604 | 607 | | |
605 | 608 | | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
606 | 612 | | |
607 | 613 | | |
608 | 614 | | |
609 | 615 | | |
610 | 616 | | |
| 617 | + | |
611 | 618 | | |
612 | 619 | | |
613 | 620 | | |
| |||
652 | 659 | | |
653 | 660 | | |
654 | 661 | | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
655 | 667 | | |
656 | 668 | | |
657 | 669 | | |
| |||
669 | 681 | | |
670 | 682 | | |
671 | 683 | | |
| 684 | + | |
| 685 | + | |
672 | 686 | | |
673 | 687 | | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
674 | 691 | | |
675 | 692 | | |
676 | 693 | | |
| |||
789 | 806 | | |
790 | 807 | | |
791 | 808 | | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
792 | 816 | | |
793 | 817 | | |
794 | 818 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
0 commit comments