Skip to content

Instantly share code, notes, and snippets.

View odeke-em's full-sized avatar

Emmanuel T Odeke odeke-em

View GitHub Profile

Keybase proof

I hereby claim:

  • I am odeke-em on github.
  • I am emmtodeke (https://keybase.io/emmtodeke) on keybase.
  • I have a public key whose fingerprint is B4C1 3DEC 5C12 70DF ECFA 4F93 638B AA7D 15E5 9951

To claim this, I am signing this object:

@odeke-em
odeke-em / env-load.go
Created November 30, 2015 00:20
Env vars don't change within running program in various langs
package main
import (
"fmt"
"os"
)
func cwd() string {
wd, _ := os.Getwd()
return wd
diff --git a/src/net/http/client_test.go b/src/net/http/client_test.go
index e59ab2c..ba0beff 100644
--- a/src/net/http/client_test.go
+++ b/src/net/http/client_test.go
@@ -65,12 +65,15 @@ func (w chanWriter) Write(p []byte) (n int, err error) {
return len(p), nil
}
-func TestClient(t *testing.T) {
+func TestClient_h1(t *testing.T) { testClient(t, false) }
$ go test --cover
2015/12/04 14:37:37 http: TLS handshake error from 127.0.0.1:63573: remote error: bad certificate
--- FAIL: TestTransportConnectionCloseOnRequestDisableKeepAlive_h2 (0.00s)
	transport_test.go:282: Get https://127.0.0.1:63572: x509: certificate signed by unknown authority
FAIL
coverage: 77.3% of statements
exit status 1
FAIL	net/http	22.478s
@odeke-em
odeke-em / mux-demo.go
Last active December 21, 2015 06:37
Demonstrating blocking and non-blocking channels in Go
package main
import (
"fmt"
"math/rand"
"time"
)
func fillUp(id int) chan string {
content := make(chan string)
diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go
index 4d5bcd0..356bae0 100644
--- a/src/net/http/serve_test.go
+++ b/src/net/http/serve_test.go
@@ -2786,24 +2786,32 @@ func TestContentTypeOkayOn204(t *testing.T) {
// proxy). So then two people own that Request.Body (both the server
// and the http client), and both think they can close it on failure.
// Therefore, all incoming server requests Bodies need to be thread-safe.
-func TestTransportAndServerSharedBodyRace(t *testing.T) {
+func TestTransportAndServerSharedBodyRace_h1(t *testing.T) {
var tls = require('tls');
    var fs = require('fs');

    var options = {
      // These are necessary only if using the client certificate authentication
      key: fs.readFileSync('client-key.pem'),
      cert: fs.readFileSync('client-cert.pem'),

 // This is necessary only if the server uses the self-signed certificate
@odeke-em
odeke-em / client.go
Created December 19, 2015 16:05
http*-default-user-agent checks while fixing bug https://github.com/golang/go/issues/13685
package main
import (
"crypto/tls"
"io/ioutil"
"log"
"net/http"
)
func main() {
@odeke-em
odeke-em / excludes.py
Created December 28, 2015 03:24
drive-issue-535 contrast with other langs
#!/usr/bin/env python3
import re
reComp = re.compile('^\.(?!(mydotfile1|mydotfile2))$', re.UNICODE)
def main():
tests = ['.git', '.mydotfile', '.', '.mydotfile1', '.mydotfile2', 'other']
regexs = dict(provided=reComp)
for key, regex in regexs.items():
@odeke-em
odeke-em / coverage-diff.diff
Created December 29, 2015 11:06
diff between h2 file server coverage and tip c7c7c7031d7876f6821dd1be6e8e2a24e5ff97b8
```diff
--- h2-coverage.txt 2015-12-29 03:59:30.000000000 -0700
+++ master-coverage.txt 2015-12-29 04:03:45.000000000 -0700
@@ -196,7 +196,7 @@
net/http/h2_bundle.go:2415: CloseConn 0.0%
net/http/h2_bundle.go:2417: Flush 100.0%
net/http/h2_bundle.go:2419: HeaderEncoder 100.0%
-net/http/h2_bundle.go:2423: state 66.7%
+net/http/h2_bundle.go:2423: state 0.0%
net/http/h2_bundle.go:2439: setConnState 100.0%