<ul dir="auto">
<li>Electron Version: 3.0 Beta 4</li>
<li>Operating System (Platform and Version): Windows10, 8 (x86 and x64)</li>
<li>Last known working Electron version: 2.x</li>
</ul>
<p dir="auto"><strong>Expected Behavior</strong><br>
PDF should be displayed.</p>
<p dir="auto"><strong>Actual behavior</strong><br>
"Save As.." dialog for download appears and pdf will not be displayed, even when downloaded.</p>
<p dir="auto"><strong>To Reproduce</strong><br>
Create a BrowserWindow and load an URL with a pdf or iframes with pdfs.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const win = new BrowserWindow({
	width: 800,
	height: 600,
	webPreferences: {
		plugins: true
	}
});

win.webContents.loadURL(URL_TO_PDF);"><pre class="notranslate"><code class="notranslate">const win = new BrowserWindow({
	width: 800,
	height: 600,
	webPreferences: {
		plugins: true
	}
});

win.webContents.loadURL(URL_TO_PDF);
</code></pre></div>
<ul dir="auto">
<li>Electron version: 0.36.7</li>
<li>Operating system: OS X</li>
</ul>
<p dir="auto">My electron app needs to make an HTTP request to a service that returns malformed headers:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ curl -IS 'http://192.168.0.1/getdeviceinfo/info.bin'
HTTP/1.1 200 OK
Date: Wed, 02 Dec 2015 16:42:45 GMT
Server: nostradamus 1.9.5
Connection: close
Etag: Aug 28 2015, 07:57:20
Transfer-Encoding: chunked
HTTP/1.0 200 OK
Content-Type: text/html"><pre class="notranslate"><code class="notranslate">$ curl -IS 'http://192.168.0.1/getdeviceinfo/info.bin'
HTTP/1.1 200 OK
Date: Wed, 02 Dec 2015 16:42:45 GMT
Server: nostradamus 1.9.5
Connection: close
Etag: Aug 28 2015, 07:57:20
Transfer-Encoding: chunked
HTTP/1.0 200 OK
Content-Type: text/html
</code></pre></div>
<p dir="auto">Notice the duplicate <code class="notranslate">200 OK</code> header? Yeah, so does the native Node.js parser and it chokes. In a standalone test script, I've found that I can use the <code class="notranslate">http-parser-js</code> library to make the same request and it handles the bad headers gracefully.</p>
<p dir="auto">Now I need to make that work within the Electron app that needs to actually make the call and retrieve the data and it's failing with the same <code class="notranslate">HPE_INVALID_HEADER_TOKEN</code> I've been getting all along. I assume, for that reason, that the native HTTP parser is not getting overridden the way that it does in the test script.</p>
<p dir="auto">In my electron app's main process, I have the same code I used in my test script:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="process.binding('http_parser').HTTPParser = require('http-parser-js').HTTPParser;
var http = require('http');

var req = http.request( ... )"><pre class="notranslate"><code class="notranslate">process.binding('http_parser').HTTPParser = require('http-parser-js').HTTPParser;
var http = require('http');

var req = http.request( ... )
</code></pre></div>
<p dir="auto">Is there an alternate process binding syntax I can use within Electron? Or some other means of making an HTTP request without taxing the Node parser?</p>