mirror of
				https://github.com/therootcompany/acme.js.git
				synced 2024-11-16 17:29:00 +00:00 
			
		
		
		
	add User-Agent string as per RFC 8555 and RFC 7231
This commit is contained in:
		
							parent
							
								
									7f868f350b
								
							
						
					
					
						commit
						161e9183c6
					
				
							
								
								
									
										6
									
								
								lib/browser/client-user-agent.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								lib/browser/client-user-agent.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | ||||
| 'use strict'; | ||||
| 
 | ||||
| var UserAgent = module.exports; | ||||
| UserAgent.get = function () { | ||||
|   return false; | ||||
| }; | ||||
							
								
								
									
										34
									
								
								lib/node/client-user-agent.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								lib/node/client-user-agent.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,34 @@ | ||||
| 'use strict'; | ||||
| 
 | ||||
| var os = require('os'); | ||||
| 
 | ||||
| var UserAgent = module.exports; | ||||
| UserAgent.get = function(me) { | ||||
| 	// ACME clients MUST have an RFC7231-compliant User-Agent
 | ||||
| 	// ex: Greenlock/v3 ACME.js/v3 node/v12.0.0 darwin/17.7.0 Darwin/x64
 | ||||
| 	//
 | ||||
| 	// See https://tools.ietf.org/html/rfc8555#section-6.1
 | ||||
| 	// And https://tools.ietf.org/html/rfc7231#section-5.5.3
 | ||||
| 	// And https://community.letsencrypt.org/t/user-agent-flag-explained/3843/2
 | ||||
| 
 | ||||
| 	var ua = | ||||
| 		'ACME.js/v3 ' + | ||||
| 		process.release.name + | ||||
| 		'/' + | ||||
| 		process.version + | ||||
| 		' ' + | ||||
| 		os.platform() + | ||||
| 		'/' + | ||||
| 		os.release() + | ||||
| 		' ' + | ||||
| 		os.type() + | ||||
| 		'/' + | ||||
| 		process.arch; | ||||
| 
 | ||||
| 	var pkg = me.packageAgent; | ||||
| 	if (pkg) { | ||||
| 		ua = pkg + ' ' + ua; | ||||
| 	} | ||||
| 
 | ||||
| 	return ua; | ||||
| }; | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user