8000 gor/input_http_test.go at master · tbs005/gor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":"byteutils","path":"byteutils","contentType":"directory"},{"name":"examples","path":"examples","contentType":"directory"},{"name":"proto","path":"proto","contentType":"directory"},{"name":"raw_socket_listener","path":"raw_socket_listener","contentType":"directory"},{"name":".dockerignore","path":".dockerignore","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".travis.yml","path":".travis.yml","contentType":"file"},{"name":"Dockerfile","path":"Dockerfile","contentType":"file"},{"name":"ELASTICSEARCH.md","path":"ELASTICSEARCH.md","contentType":"file"},{"name":"LICENSE.txt","path":"LICENSE.txt","contentType":"file"},{"name":"Makefile","path":"Makefile","contentType":"file"},{"name":"Procfile","path":"Procfile","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"elasticsearch.go","path":"elasticsearch.go","contentType":"file"},{"name":"emitter.go","path":"emitter.go","contentType":"file"},{"name":"emitter_test.go","path":"emitter_test.go","contentType":"file"},{"name":"gor.go","path":"gor.go","contentType":"file"},{"name":"gor_stat.go","path":"gor_stat.go","contentType":"file"},{"name":"http_client.go","path":"http_client.go","contentType":"file"},{"name":"http_client_test.go","path":"http_client_test.go","contentType":"file"},{"name":"http_modifier.go","path":"http_modifier.go","contentType":"file"},{"name":"http_modifier_settings.go","path":"http_modifier_settings.go","contentType":"file"},{"name":"http_modifier_settings_test.go","path":"http_modifier_settings_test.go","contentType":"file"},{"name":"http_modifier_test.go","path":"http_modifier_test.go","contentType":"file"},{"name":"input_dummy.go","path":"input_dummy.go","contentType":"file"},{"name":"input_file.go","path":"input_file.go","contentType":"file"},{"name":"input_http.go","path":"input_http.go","contentType":"file"},{"name":"input_http_test.go","path":"input_http_test.go","contentType":"file"},{"name":"input_raw.go","path":"input_raw.go","contentType":"file"},{"name":"input_raw_test.go","path":"input_raw_test.go","contentType":"file"},{"name":"input_tcp.go","path":"input_tcp.go","contentType":"file"},{"name":"input_tcp_test.go","path":"input_tcp_test.go","contentType":"file"},{"name":"limiter.go","path":"limiter.go","contentType":"file"},{"name":"limiter_test.go","path":"limiter_test.go","contentType":"file"},{"name":"middleware.go","path":"middleware.go","contentType":"file"},{"name":"middleware_test.go","path":"middleware_test.go","contentType":"file"},{"name":"output_dummy.go","path":"output_dummy.go","contentType":"file"},{"name":"output_file.go","path":"output_file.go","contentType":"file"},{"name":"output_file_test.go","path":"output_file_test.go","contentType":"file"},{"name":"output_http.go","path":"output_http.go","contentType":"file"},{"name":"output_http_test.go","path":"output_http_test.go","contentType":"file"},{"name":"output_tcp.go","path":"output_tcp.go","contentType":"file"},{"name":"output_tcp_test.go","path":"output_tcp_test.go","contentType":"file"},{"name":"plugins.go","path":"plugins.go","contentType":"file"},{"name":"plugins_test.go","path":"plugins_test.go","contentType":"file"},{"name":"protocol.go","path":"protocol.go","contentType":"file"},{"name":"settings.go","path":"settings.go","contentType":"file"},{"name":"test_input.go","path":"test_input.go","contentType":"file"},{"name":"test_output.go","path":"test_output.go","contentType":"file"}],"totalCount":49}},"fileTreeProcessingTime":10.956184,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":54091096,"defaultBranch":"master","name":"gor","ownerLogin":"tbs005","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2016-03-17T05:26:52.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/3840676?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1616335672.503459","canEdit":false,"refType":"branch","currentOid":"94f066c97a8a7be7ec5db07ed3ba5b8e4ce2033b"},"path":"input_http_test.go","currentUser":null,"blob":{"rawLines":["package main","","import (","\t\"github.com/buger/gor/proto\"","\t\"io\"","\t\"log\"","\t\"net/http\"","\t\"os/exec\"","\t\"strings\"","\t\"sync\"","\t\"testing\"",")","","func TestHTTPInput(t *testing.T) {","\twg := new(sync.WaitGroup)","\tquit := make(chan int)","","\tinput := NewHTTPInput(\":0\")","\toutput := NewTestOutput(func(data []byte) {","\t\twg.Done()","\t})","","\tPlugins.Inputs = []io.Reader{input}","\tPlugins.Outputs = []io.Writer{output}","","\tgo Start(quit)","","\taddress := strings.Replace(input.listener.Addr().String(), \"[::]\", \"127.0.0.1\", -1)","","\tfor i := 0; i \u003c 100; i++ {","\t\twg.Add(1)","\t\thttp.Get(\"http://\" + address + \"/\")","\t}","","\twg.Wait()","","\tclose(quit)","}","","func TestInputHTTPLargePayload(t *testing.T) {","\twg := new(sync.WaitGroup)","\tquit := make(chan int)","","\t// Generate 1000kb file","\tdd := exec.Command(\"dd\", \"if=/dev/urandom\", \"of=/tmp/large\", \"bs=1MB\", \"count=4\")","\terr := dd.Run()","\tif err != nil {","\t\tlog.Fatal(\"dd error:\", err)","\t}","","\tinput := NewHTTPInput(\":0\")","\toutput := NewTestOutput(func(data []byte) {","\t\tif len(proto.Body(payloadBody(data))) != 4000000 {","\t\t\tt.Error(\"Should receive full file\")","\t\t}","\t\twg.Done()","\t})","\tPlugins.Inputs = []io.Reader{input}","\tPlugins.Outputs = []io.Writer{output}","","\tgo Start(quit)","","\twg.Add(1)","\taddress := strings.Replace(input.listener.Addr().String(), \"[::]\", \"127.0.0.1\", -1)","\tcurl := exec.Command(\"curl\", \"http://\"+address, \"--data-binary\", \"@/tmp/large\")","\terr = curl.Run()","\tif err != nil {","\t\tlog.Fatal(\"curl error:\", err)","\t}","","\twg.Wait()","\tclose(quit)","}"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/tbs005/gor/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"input_http_test.go","displayUrl":"https://github.com/tbs005/gor/blob/master/input_http_test.go?raw=true","headerInfo":{"blobSize":"1.39 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"6d1d64c","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Ftbs005%2Fgor%2Fblob%2Fmaster%2Finput_http_test.go","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"73","truncatedSloc":"58"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Go","languageID":132,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/tbs005/gor/blob/master/input_http_test.go","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/tbs005/gor/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/tbs005/gor/raw/refs/heads/master/input_http_test.go","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":false,"symbols":[{"name":"TestHTTPInput","kind":"function","ident_start":127,"ident_end":140,"extent_start":122,"extent_end":588,"fully_qualified_name":"TestHTTPInput","ident_utf16":{"start":{"line_number":13,"utf16_col":5},"end":{"line_number":13,"utf16_col":18}},"extent_utf16":{"start":{"line_number":13,"utf16_col":0},"end":{"line_number":37,"utf16_col":1}}},{"name":"TestInputHTTPLargePayload","kind":"function","ident_start":595,"ident_end":620,"extent_start":590,"extent_end":1418,"fully_qualified_name":"TestInputHTTPLargePayload","ident_utf16":{"start":{"line_number":39,"utf16_col":5},"end":{"line_number":39,"utf16_col":30}},"extent_utf16":{"start":{"line_number":39,"utf16_col":0},"end":{"line_number":72,"utf16_col":1}}}]}},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/tbs005/gor/branches":{"post":"KaWktQstq0D2KxKzBTnvxB-lgmilUVIA72jpa_WQ96PnQem6fHC3PBlYWwwt09JUCLoqVhet1WgxQRBpAgFgAQ"},"/repos/preferences":{"post":"ixzx2l4eLnKqb0fFfOa7pqBcwZyj-IrDG-KMVdb0N4psaAD2c0Wt7jybBfTqIOOE4YGHSwYAh5TvhkN4yuVraQ"}}},"title":"gor/input_http_test.go at master · tbs005/gor","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-7d7eb7c71814.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1ae9fa256942.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true,"github_models_repo_integration":false}}}
0