{"action":"created","comment":{"url":"https://api.github.com/repos/m-lab/ndt/pulls/comments/29972924","id":29972924,"diff_hunk":"@@ -208,29 +211,39 @@ int test_c2s(int ctlsockfd, tcp_stat_agent* agent, TestOptions* testOptions,\n \n       // If a valid connection request is received, client has connected.\n       // Proceed.  Note the new socket fd - recvsfd- used in the throughput test\n-      recvsfd = accept(testOptions->c2ssockfd,\n-                       (struct sockaddr *) &cli_addr, &clilen);\n-      if (recvsfd > 0) {\n-        log_println(6, \"accept() for %d completed\",\n-                    testOptions->child0);\n+      c2s_conn.socket = accept(testOptions->c2ssockfd,\n+                               (struct sockaddr *)&cli_addr, &clilen);\n+      if (c2s_conn.socket > 0) {\n+        log_println(6, \"accept() for %d completed\", testOptions->child0);\n \n         // log protocol validation indicating client accept\n         procstatusenum = PROCESS_STARTED;\n         proctypeenum = CONNECT_TYPE;\n         protolog_procstatus(testOptions->child0, testids, proctypeenum,\n-                            procstatusenum, recvsfd);\n-\t// To preserve user privacy, make sure that the HTTP header\n-\t// processing is done prior to the start of packet capture, as many\n-\t// browsers have headers that uniquely identitfy a single user.\n-        if (testOptions->connection_flags & WEBSOCKET_SUPPORT) {\n-          if (initialize_websocket_connection(recvsfd, 0, \"c2s\") != 0) {\n-            recvsfd = 0;\n-          } \n+                            procstatusenum, c2s_conn.socket);\n+        if (testOptions->connection_flags & TLS_SUPPORT) {\n+          c2s_conn.ssl = SSL_new(ctx);\n+          if (c2s_conn.ssl == NULL) return ENOMEM;\n+          if (SSL_set_fd(c2s_conn.ssl, c2s_conn.socket) == 0) return EIO;\n+          if (SSL_accept(c2s_conn.ssl) != 1) return EIO;\n         }\n+        // To preserve user privacy, make sure that the HTTP header\n+        // processing is done prior to the start of packet capture, as many\n+        // browsers have headers that uniquely identitfy a single user.\n+        if (testOptions->connection_flags & WEBSOCKET_SUPPORT) {\n+          if (initialize_websocket_connection(&c2s_conn, 0, \"c2s\") != 0) {\n+            log_println(2, \"Child %d failed to init websocket\", getpid());\n+            if (c2s_conn.ssl != NULL) {\n+              SSL_free(c2s_conn.ssl);\n+              c2s_conn.ssl = NULL;\n+            }\n+            c2s_conn.socket = 0;\n+          }\n+        } ","path":"src/test_c2s_srv.c","position":null,"original_position":129,"commit_id":"20e059c394a9d8bc39953e9dd69916fdbb319b05","original_commit_id":"07c29aa5506a4eaaae5c6dcc097938456f438a26","user":{"login":"pboothe","id":143798,"avatar_url":"https://avatars.githubusercontent.com/u/143798?v=3","gravatar_id":"","url":"https://api.github.com/users/pboothe","html_url":"https://github.com/pboothe","followers_url":"https://api.github.com/users/pboothe/followers","following_url":"https://api.github.com/users/pboothe/following{/other_user}","gists_url":"https://api.github.com/users/pboothe/gists{/gist_id}","starred_url":"https://api.github.com/users/pboothe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pboothe/subscriptions","organizations_url":"https://api.github.com/users/pboothe/orgs","repos_url":"https://api.github.com/users/pboothe/repos","events_url":"https://api.github.com/users/pboothe/events{/privacy}","received_events_url":"https://api.github.com/users/pboothe/received_events","type":"User","site_admin":false},"body":"I figured you have a trailing whitespace highlighter in your diff tool?","created_at":"2015-05-08T20:18:22Z","updated_at":"2015-05-08T20:18:22Z","html_url":"https://github.com/m-lab/ndt/pull/5#discussion_r29972924","pull_request_url":"https://api.github.com/repos/m-lab/ndt/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/m-lab/ndt/pulls/comments/29972924"},"html":{"href":"https://github.com/m-lab/ndt/pull/5#discussion_r29972924"},"pull_request":{"href":"https://api.github.com/repos/m-lab/ndt/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/m-lab/ndt/pulls/5","id":34864626,"html_url":"https://github.com/m-lab/ndt/pull/5","diff_url":"https://github.com/m-lab/ndt/pull/5.diff","patch_url":"https://github.com/m-lab/ndt/pull/5.patch","issue_url":"https://api.github.com/repos/m-lab/ndt/issues/5","number":5,"state":"open","locked":false,"title":"Change 3 of N of adding SSL support to NDT.","user":{"login":"pboothe","id":143798,"avatar_url":"https://avatars.githubusercontent.com/u/143798?v=3","gravatar_id":"","url":"https://api.github.com/users/pboothe","html_url":"https://github.com/pboothe","followers_url":"https://api.github.com/users/pboothe/followers","following_url":"https://api.github.com/users/pboothe/following{/other_user}","gists_url":"https://api.github.com/users/pboothe/gists{/gist_id}","starred_url":"https://api.github.com/users/pboothe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pboothe/subscriptions","organizations_url":"https://api.github.com/users/pboothe/orgs","repos_url":"https://api.github.com/users/pboothe/repos","events_url":"https://api.github.com/users/pboothe/events{/privacy}","received_events_url":"https://api.github.com/users/pboothe/received_events","type":"User","site_admin":false},"body":"All the changes to the tests.","created_at":"2015-05-06T21:56:41Z","updated_at":"2015-05-08T20:18:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f9c0ca32513d8249b747335ba553634985cbcf41","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/m-lab/ndt/pulls/5/commits","review_comments_url":"https://api.github.com/repos/m-lab/ndt/pulls/5/comments","review_comment_url":"https://api.github.com/repos/m-lab/ndt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/m-lab/ndt/issues/5/comments","statuses_url":"https://api.github.com/repos/m-lab/ndt/statuses/20e059c394a9d8bc39953e9dd69916fdbb319b05","head":{"label":"m-lab:tls","ref":"tls","sha":"20e059c394a9d8bc39953e9dd69916fdbb319b05","user":{"login":"m-lab","id":3496264,"avatar_url":"https://avatars.githubusercontent.com/u/3496264?v=3","gravatar_id":"","url":"https://api.github.com/users/m-lab","html_url":"https://github.com/m-lab","followers_url":"https://api.github.com/users/m-lab/followers","following_url":"https://api.github.com/users/m-lab/following{/other_user}","gists_url":"https://api.github.com/users/m-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/m-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-lab/subscriptions","organizations_url":"https://api.github.com/users/m-lab/orgs","repos_url":"https://api.github.com/users/m-lab/repos","events_url":"https://api.github.com/users/m-lab/events{/privacy}","received_events_url":"https://api.github.com/users/m-lab/received_events","type":"Organization","site_admin":false},"repo":{"id":33625942,"name":"ndt","full_name":"m-lab/ndt","owner":{"login":"m-lab","id":3496264,"avatar_url":"https://avatars.githubusercontent.com/u/3496264?v=3","gravatar_id":"","url":"https://api.github.com/users/m-lab","html_url":"https://github.com/m-lab","followers_url":"https://api.github.com/users/m-lab/followers","following_url":"https://api.github.com/users/m-lab/following{/other_user}","gists_url":"https://api.github.com/users/m-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/m-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-lab/subscriptions","organizations_url":"https://api.github.com/users/m-lab/orgs","repos_url":"https://api.github.com/users/m-lab/repos","events_url":"https://api.github.com/users/m-lab/events{/privacy}","received_events_url":"https://api.github.com/users/m-lab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/m-lab/ndt","description":"Network Diagnostic Tool","fork":true,"url":"https://api.github.com/repos/m-lab/ndt","forks_url":"https://api.github.com/repos/m-lab/ndt/forks","keys_url":"https://api.github.com/repos/m-lab/ndt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/m-lab/ndt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/m-lab/ndt/teams","hooks_url":"https://api.github.com/repos/m-lab/ndt/hooks","issue_events_url":"https://api.github.com/repos/m-lab/ndt/issues/events{/number}","events_url":"https://api.github.com/repos/m-lab/ndt/events","assignees_url":"https://api.github.com/repos/m-lab/ndt/assignees{/user}","branches_url":"https://api.github.com/repos/m-lab/ndt/branches{/branch}","tags_url":"https://api.github.com/repos/m-lab/ndt/tags","blobs_url":"https://api.github.com/repos/m-lab/ndt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/m-lab/ndt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/m-lab/ndt/git/refs{/sha}","trees_url":"https://api.github.com/repos/m-lab/ndt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/m-lab/ndt/statuses/{sha}","languages_url":"https://api.github.com/repos/m-lab/ndt/languages","stargazers_url":"https://api.github.com/repos/m-lab/ndt/stargazers","contributors_url":"https://api.github.com/repos/m-lab/ndt/contributors","subscribers_url":"https://api.github.com/repos/m-lab/ndt/subscribers","subscription_url":"https://api.github.com/repos/m-lab/ndt/subscription","commits_url":"https://api.github.com/repos/m-lab/ndt/commits{/sha}","git_commits_url":"https://api.github.com/repos/m-lab/ndt/git/commits{/sha}","comments_url":"https://api.github.com/repos/m-lab/ndt/comments{/number}","issue_comment_url":"https://api.github.com/repos/m-lab/ndt/issues/comments{/number}","contents_url":"https://api.github.com/repos/m-lab/ndt/contents/{+path}","compare_url":"https://api.github.com/repos/m-lab/ndt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/m-lab/ndt/merges","archive_url":"https://api.github.com/repos/m-lab/ndt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/m-lab/ndt/downloads","issues_url":"https://api.github.com/repos/m-lab/ndt/issues{/number}","pulls_url":"https://api.github.com/repos/m-lab/ndt/pulls{/number}","milestones_url":"https://api.github.com/repos/m-lab/ndt/milestones{/number}","notifications_url":"https://api.github.com/repos/m-lab/ndt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/m-lab/ndt/labels{/name}","releases_url":"https://api.github.com/repos/m-lab/ndt/releases{/id}","created_at":"2015-04-08T18:54:07Z","updated_at":"2015-05-06T21:54:03Z","pushed_at":"2015-05-08T20:17:20Z","git_url":"git://github.com/m-lab/ndt.git","ssh_url":"git@github.com:m-lab/ndt.git","clone_url":"https://github.com/m-lab/ndt.git","svn_url":"https://github.com/m-lab/ndt","homepage":null,"size":4136,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"m-lab:master","ref":"master","sha":"8c8f6feed28c64dbb54552ac4b34d848716a7991","user":{"login":"m-lab","id":3496264,"avatar_url":"https://avatars.githubusercontent.com/u/3496264?v=3","gravatar_id":"","url":"https://api.github.com/users/m-lab","html_url":"https://github.com/m-lab","followers_url":"https://api.github.com/users/m-lab/followers","following_url":"https://api.github.com/users/m-lab/following{/other_user}","gists_url":"https://api.github.com/users/m-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/m-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-lab/subscriptions","organizations_url":"https://api.github.com/users/m-lab/orgs","repos_url":"https://api.github.com/users/m-lab/repos","events_url":"https://api.github.com/users/m-lab/events{/privacy}","received_events_url":"https://api.github.com/users/m-lab/received_events","type":"Organization","site_admin":false},"repo":{"id":33625942,"name":"ndt","full_name":"m-lab/ndt","owner":{"login":"m-lab","id":3496264,"avatar_url":"https://avatars.githubusercontent.com/u/3496264?v=3","gravatar_id":"","url":"https://api.github.com/users/m-lab","html_url":"https://github.com/m-lab","followers_url":"https://api.github.com/users/m-lab/followers","following_url":"https://api.github.com/users/m-lab/following{/other_user}","gists_url":"https://api.github.com/users/m-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/m-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-lab/subscriptions","organizations_url":"https://api.github.com/users/m-lab/orgs","repos_url":"https://api.github.com/users/m-lab/repos","events_url":"https://api.github.com/users/m-lab/events{/privacy}","received_events_url":"https://api.github.com/users/m-lab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/m-lab/ndt","description":"Network Diagnostic Tool","fork":true,"url":"https://api.github.com/repos/m-lab/ndt","forks_url":"https://api.github.com/repos/m-lab/ndt/forks","keys_url":"https://api.github.com/repos/m-lab/ndt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/m-lab/ndt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/m-lab/ndt/teams","hooks_url":"https://api.github.com/repos/m-lab/ndt/hooks","issue_events_url":"https://api.github.com/repos/m-lab/ndt/issues/events{/number}","events_url":"https://api.github.com/repos/m-lab/ndt/events","assignees_url":"https://api.github.com/repos/m-lab/ndt/assignees{/user}","branches_url":"https://api.github.com/repos/m-lab/ndt/branches{/branch}","tags_url":"https://api.github.com/repos/m-lab/ndt/tags","blobs_url":"https://api.github.com/repos/m-lab/ndt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/m-lab/ndt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/m-lab/ndt/git/refs{/sha}","trees_url":"https://api.github.com/repos/m-lab/ndt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/m-lab/ndt/statuses/{sha}","languages_url":"https://api.github.com/repos/m-lab/ndt/languages","stargazers_url":"https://api.github.com/repos/m-lab/ndt/stargazers","contributors_url":"https://api.github.com/repos/m-lab/ndt/contributors","subscribers_url":"https://api.github.com/repos/m-lab/ndt/subscribers","subscription_url":"https://api.github.com/repos/m-lab/ndt/subscription","commits_url":"https://api.github.com/repos/m-lab/ndt/commits{/sha}","git_commits_url":"https://api.github.com/repos/m-lab/ndt/git/commits{/sha}","comments_url":"https://api.github.com/repos/m-lab/ndt/comments{/number}","issue_comment_url":"https://api.github.com/repos/m-lab/ndt/issues/comments{/number}","contents_url":"https://api.github.com/repos/m-lab/ndt/contents/{+path}","compare_url":"https://api.github.com/repos/m-lab/ndt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/m-lab/ndt/merges","archive_url":"https://api.github.com/repos/m-lab/ndt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/m-lab/ndt/downloads","issues_url":"https://api.github.com/repos/m-lab/ndt/issues{/number}","pulls_url":"https://api.github.com/repos/m-lab/ndt/pulls{/number}","milestones_url":"https://api.github.com/repos/m-lab/ndt/milestones{/number}","notifications_url":"https://api.github.com/repos/m-lab/ndt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/m-lab/ndt/labels{/name}","releases_url":"https://api.github.com/repos/m-lab/ndt/releases{/id}","created_at":"2015-04-08T18:54:07Z","updated_at":"2015-05-06T21:54:03Z","pushed_at":"2015-05-08T20:17:20Z","git_url":"git://github.com/m-lab/ndt.git","ssh_url":"git@github.com:m-lab/ndt.git","clone_url":"https://github.com/m-lab/ndt.git","svn_url":"https://github.com/m-lab/ndt","homepage":null,"size":4136,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/m-lab/ndt/pulls/5"},"html":{"href":"https://github.com/m-lab/ndt/pull/5"},"issue":{"href":"https://api.github.com/repos/m-lab/ndt/issues/5"},"comments":{"href":"https://api.github.com/repos/m-lab/ndt/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/m-lab/ndt/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/m-lab/ndt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/m-lab/ndt/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/m-lab/ndt/statuses/20e059c394a9d8bc39953e9dd69916fdbb319b05"}}}}