{"id":24575118,"url":"https://github.com/olegkunitsyn/demo-ahttp","last_synced_at":"2025-10-05T03:30:57.700Z","repository":{"id":18357313,"uuid":"21537356","full_name":"OlegKunitsyn/demo-ahttp","owner":"OlegKunitsyn","description":"Asynchronous non-blocking HTTP server","archived":false,"fork":false,"pushed_at":"2014-07-06T11:24:55.000Z","size":704,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-04-03T23:43:34.333Z","etag":null,"topics":["server"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OlegKunitsyn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-06T09:44:19.000Z","updated_at":"2018-09-25T11:16:57.000Z","dependencies_parsed_at":"2022-08-25T12:50:24.849Z","dependency_job_id":null,"html_url":"https://github.com/OlegKunitsyn/demo-ahttp","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OlegKunitsyn%2Fdemo-ahttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OlegKunitsyn%2Fdemo-ahttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OlegKunitsyn%2Fdemo-ahttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OlegKunitsyn%2Fdemo-ahttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OlegKunitsyn","download_url":"https://codeload.github.com/OlegKunitsyn/demo-ahttp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235356196,"owners_count":18976821,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["server"],"created_at":"2025-01-23T21:54:53.285Z","updated_at":"2025-10-05T03:30:56.955Z","avatar_url":"https://github.com/OlegKunitsyn.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Demonstrates of the non-blocking HTTP server in asynchronous mode\n==========\n\nThese 350 lines of Java code were inspired by Jacques Mattheij's [The Several Million Dollar Bug].\nPlease read the article to understand the background of the issue. \n\n\nIn Java technical details are as follows. Since HTTP protocol is synchronous by design (RFC 1945) NIO keeps *OP_READ* mode of the channel even *OP_WRITE* operation set on the first byte received.\nThis is a standard implementation of non-blocking HTTP server you can find in Internet. \n\nThe magic goes on line #118. Comment it out and run the test.\n\n```\n...\nRequested: resources/tiny.gif\nReceived: 255\nReceived: 255\nReceived: 146\nTransmitted: 43\n...\n```\n\nIn order to transmit 43 bytes we need to receive 656 bytes, huh. Now uncomment the line.\n\n```\n...\nRequested: resources/tiny.gif\nReceived: 255\nTransmitted: 43\nReceived: 255\n...\n```\n\nAs we can see Java HTTP client accepts the forced response correctly. As well as the browsers. \nIn your project make the request handler smarter by cutting off GET line only.\n\n\nHave a nice day and several million dollar in a wallet!\n\n[The Several Million Dollar Bug]:http://jacquesmattheij.com/the-several-million-dollar-bug\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folegkunitsyn%2Fdemo-ahttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folegkunitsyn%2Fdemo-ahttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folegkunitsyn%2Fdemo-ahttp/lists"}