File tree Expand file tree Collapse file tree 2 files changed +8
-14
lines changed Expand file tree Collapse file tree 2 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,7 @@ module.exports = function sign(signFunction) {
26
26
, end = res . end
27
27
, stream
28
28
, method
29
- , doSign = req . headers [ 'accept' ] == 'multipart/signed'
30
- , boundary = 'foo' ;
29
+ , doSign = req . headers [ 'accept' ] == 'multipart/msigned' ;
31
30
32
31
// see compress.js #724
33
32
req . on ( 'close' , function ( ) {
@@ -71,10 +70,8 @@ module.exports = function sign(signFunction) {
71
70
stream = new SigningStream ( signFunction , boundary ) ;
72
71
73
72
// header fields
74
- var contentType = 'multipart/signed ;' ;
73
+ var contentType = 'multipart/msigned ;' ;
75
74
contentType += ' boundary=' + boundary + ';' ;
76
- //contentType += ' micalg=pgp-sha1;';
77
- contentType += ' protocol="application/pgp-signature"' ;
78
75
res . setHeader ( 'Content-Type' , contentType ) ;
79
76
res . removeHeader ( 'Content-Length' ) ;
80
77
Original file line number Diff line number Diff line change @@ -23,20 +23,17 @@ SigningStream.prototype.end = function(data) {
23
23
SigningStream . prototype . sign = function ( callback ) {
24
24
var that = this ;
25
25
process . nextTick ( function ( ) {
26
- var body = that . buffer . replace ( / \r \n / g, '\n' ) . replace ( / \n / g, '\r\n' ) ;
27
- var text = body ;
28
- // var start = Date.now();
29
- that . doSign ( body , function ( err , ciphertext ) {
30
- // var end = Date.now();
31
- // console.log("Duration: %sms", (end-start));
26
+ var text = that . buffer . replace ( / \r \n / g, '\n' ) . replace ( / \n / g, '\r\n' ) ;
27
+ that . doSign ( text , function ( err , signature ) {
32
28
var body = '' ;
33
29
body += '--' + that . boundary + '\n' ;
34
- body += text + '\n\n' ;
30
+ body += 'Content-Type: octet-stream\r\n\r\n' ;
31
+ body += text + '\r\n' ;
35
32
if ( ! err ) {
36
- ciphertext = ciphertext . substring ( ciphertext . lastIndexOf ( '-----BEGIN PGP SIGNATURE-----' ) ) ;
33
+ signature = signature . substring ( signature . lastIndexOf ( '-----BEGIN PGP SIGNATURE-----' ) ) ;
37
34
body += '--' + that . boundary + '\n' ;
38
35
body += 'Content-Type: application/pgp-signature\n\n' ;
39
- body += ciphertext + '\n' ;
36
+ body += signature + '\n' ;
40
37
}
41
38
body += '--' + that . boundary + '--\n' ;
42
39
callback ( body ) ;
You can’t perform that action at this time.
0 commit comments