Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
889d3425
Commit
889d3425
authored
Jan 13, 2005
by
travis%sedsystems.ca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 275108 : Content-disposition header is incorrect, violates RFC
Patch by byron jones (glob) <bugzilla@glob.com.au> r=mkanat a=justdave
parent
a037f115
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
35 deletions
+35
-35
CGI.pm
Bugzilla/CGI.pm
+29
-33
buglist.cgi
buglist.cgi
+6
-2
No files found.
Bugzilla/CGI.pm
View file @
889d3425
...
@@ -18,13 +18,13 @@
...
@@ -18,13 +18,13 @@
# Rights Reserved.
# Rights Reserved.
#
#
# Contributor(s): Bradley Baetz <bbaetz@student.usyd.edu.au>
# Contributor(s): Bradley Baetz <bbaetz@student.usyd.edu.au>
# Byron Jones <bugzilla@glob.com.au>
use
strict
;
use
strict
;
package
Bugzilla::
CGI
;
package
Bugzilla::
CGI
;
use
CGI
qw(-no_xhtml -oldstyle_urls :private_tempfiles :unique_headers SERVER_PUSH)
;
use
CGI
qw(-no_xhtml -oldstyle_urls :private_tempfiles :unique_headers SERVER_PUSH)
;
use
CGI::
Util
qw(rearrange)
;
use
base
qw(CGI)
;
use
base
qw(CGI)
;
...
@@ -111,20 +111,34 @@ sub canonicalise_query {
...
@@ -111,20 +111,34 @@ sub canonicalise_query {
return
join
(
"&"
,
@parameters
);
return
join
(
"&"
,
@parameters
);
}
}
# Overwrite to handle nph parameter. This should stay here until perl 5.8.1 CGI
# Overwrite to ensure nph doesn't get set, and unset HEADERS_ONCE
# has been fixed to support -nph as a parameter
#
sub
multipart_init
{
sub
multipart_init
{
my
(
$self
,
@p
)
=
@_
;
my
$self
=
shift
;
my
(
$boundary
,
$nph
,
@other
)
=
rearrange
([
'BOUNDARY'
,
'NPH'
],
@p
);
$boundary
=
$boundary
||
'------- =_aaaaaaaaaa0'
;
# Keys are case-insensitive, map to lowercase
my
%
args
=
@_
;
my
%
param
;
foreach
my
$key
(
keys
%
args
)
{
$param
{
lc
$key
}
=
$args
{
$key
};
}
# Set the MIME boundary and content-type
my
$boundary
=
$param
{
'-boundary'
}
||
'------- =_aaaaaaaaaa0'
;
delete
$param
{
'-boundary'
};
$self
->
{
'separator'
}
=
"\r\n--$boundary\r\n"
;
$self
->
{
'separator'
}
=
"\r\n--$boundary\r\n"
;
$self
->
{
'final_separator'
}
=
"\r\n--$boundary--\r\n"
;
$self
->
{
'final_separator'
}
=
"\r\n--$boundary--\r\n"
;
my
$type
=
SERVER_PUSH
(
$boundary
);
$param
{
'-type'
}
=
SERVER_PUSH
(
$boundary
);
# Note: CGI.pm::multipart_init up to v3.04 explicitly set nph to 0
# CGI.pm::multipart_init v3.05 explicitly sets nph to 1
# CGI.pm's header() sets nph according to a param or $CGI::NPH, which
# is the desired behavour.
# Allow multiple calls to $cgi->header()
$
CGI::
HEADERS_ONCE
=
0
;
return
$self
->
header
(
return
$self
->
header
(
-
nph
=>
0
,
%
param
,
-
type
=>
$type
,
(
map
{
split
"="
,
$_
,
2
}
@other
),
)
.
"WARNING: YOUR BROWSER DOESN'T SUPPORT THIS SERVER-PUSH TECHNOLOGY."
.
$self
->
multipart_end
;
)
.
"WARNING: YOUR BROWSER DOESN'T SUPPORT THIS SERVER-PUSH TECHNOLOGY."
.
$self
->
multipart_end
;
}
}
...
@@ -145,29 +159,11 @@ sub header {
...
@@ -145,29 +159,11 @@ sub header {
return
$self
->
SUPER::
header
(
@_
)
||
""
;
return
$self
->
SUPER::
header
(
@_
)
||
""
;
}
}
# We override the entirety of multipart_start instead of falling through to
# Override multipart_start to ensure our cookies are added and avoid bad quoting of
# SUPER because the built-in one can't deal with cookies in any kind of sane
# CGI's multipart_start (bug 275108)
# way. This sub is gratuitously swiped from the real CGI.pm, but fixed so
# it actually works (but only as much as we need it to).
sub
multipart_start
{
sub
multipart_start
{
my
(
@header
);
my
$self
=
shift
;
my
(
$self
,
@p
)
=
@_
;
return
$self
->
header
(
@_
);
my
(
$type
,
@other
)
=
rearrange
([[
'TYPE'
,
'CONTENT_TYPE'
,
'CONTENT-TYPE'
]],
@p
);
my
$charset
=
$self
->
charset
;
$type
=
$type
||
'text/html'
;
$type
.=
"; charset=$charset"
if
$type
ne
''
and
$type
=~
m!^text/!
and
$type
!~
/\bcharset\b/
and
$charset
ne
''
;
push
(
@header
,
"Content-Type: $type"
);
# Add the cookies in if we have any
if
(
scalar
(
@
{
$self
->
{
Bugzilla_cookie_list
}}))
{
foreach
my
$cookie
(
@
{
$self
->
{
Bugzilla_cookie_list
}})
{
push
@header
,
"Set-Cookie: $cookie"
;
}
}
my
$header
=
join
(
$
CGI::
CRLF
,
@header
)
.
"${CGI::CRLF}${CGI::CRLF}"
;
return
$header
;
}
}
# The various parts of Bugzilla which create cookies don't want to have to
# The various parts of Bugzilla which create cookies don't want to have to
...
...
buglist.cgi
View file @
889d3425
...
@@ -740,9 +740,13 @@ if ($::FORM{'debug'}) {
...
@@ -740,9 +740,13 @@ if ($::FORM{'debug'}) {
# Time to use server push to display an interim message to the user until
# Time to use server push to display an interim message to the user until
# the query completes and we can display the bug list.
# the query completes and we can display the bug list.
my
$disposition
=
''
;
if
(
$serverpush
)
{
if
(
$serverpush
)
{
print
$cgi
->
multipart_init
(
-
content_disposition
=>
"inline; filename=$filename"
);
$filename
=~
s/\\/\\\\/g
;
# escape backslashes
$filename
=~
s/"/\\"/g
;
# escape quotes
$disposition
=
qq#inline; filename="$filename"#
;
print
$cgi
->
multipart_init
(
-
content_disposition
=>
$disposition
);
print
$cgi
->
multipart_start
();
print
$cgi
->
multipart_start
();
# Generate and return the UI (HTML page) from the appropriate template.
# Generate and return the UI (HTML page) from the appropriate template.
...
@@ -992,7 +996,7 @@ if ($format->{'extension'} eq "csv") {
...
@@ -992,7 +996,7 @@ if ($format->{'extension'} eq "csv") {
if
(
$serverpush
)
{
if
(
$serverpush
)
{
# close the "please wait" page, then open the buglist page
# close the "please wait" page, then open the buglist page
print
$cgi
->
multipart_end
();
print
$cgi
->
multipart_end
();
print
$cgi
->
multipart_start
(
-
type
=>
$contenttype
);
print
$cgi
->
multipart_start
(
-
type
=>
$contenttype
,
-
content_disposition
=>
$disposition
);
}
else
{
}
else
{
# Suggest a name for the bug list if the user wants to save it as a file.
# Suggest a name for the bug list if the user wants to save it as a file.
# If we are doing server push, then we did this already in the HTTP headers
# If we are doing server push, then we did this already in the HTTP headers
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment