Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,19 @@
with AWS; use AWS;
with AWS.Response;
with AWS.Server;
with AWS.Status;
with Ada.Text_IO; use Ada.Text_IO;
procedure HelloHTTP is
function CB (Request : Status.Data) return Response.Data is
pragma Unreferenced (Request);
begin
return Response.Build ("text/html", "Goodbye, World!");
end CB;
TheServer : Server.HTTP;
ch : Character;
begin
Server.Start (TheServer, "Rosettacode",
Callback => CB'Unrestricted_Access, Port => 8080);
Put_Line ("Press any key to quit."); Get_Immediate (ch);
Server.Shutdown (TheServer);
end HelloHTTP;

View file

@ -0,0 +1,17 @@
TCPStartup()
$socket = TCPListen("0.0.0.0",8080)
$string = "Goodbye, World!"
While 1
Do
$newConnection = TCPAccept($socket)
Sleep(1)
Until $newConnection <> -1
$content = TCPRecv($newConnection, 2048)
If StringLen($content) > 0 Then
TCPSend($newConnection, Binary("HTTP/1.1 200 OK" & @CRLF))
TCPSend($newConnection, Binary("Content-Type: text/html" & @CRLF))
TCPSend($newConnection, Binary("Content-Length: "& BinaryLen($string) & @CRLF & @CRLF))
TCPSend($newConnection, $string)
EndIf
TCPCloseSocket($newConnection)
WEnd

View file

@ -0,0 +1,14 @@
@echo off
setlocal enableextensions
::net session would not work if the Server service is not started
reg query HKEY_USERS\S-1-5-19\Environment /v TEMP >nul 2>nul || (
>&2 echo Please run this script in an elevated prompt.
exit /b 1
)
dism /online /enable-feature /featurename:IIS-WebServerRole /all
:: https://learn.microsoft.com/en-us/iis/configuration/system.applicationhost/sites/site/bindings/
%windir%\system32\inetsrv\appcmd set site /site.name:"Default Web Site" /+bindings.[protocol='http',bindingInformation='*:8080:']
pushd %SystemDrive%\inetpub\wwwroot
:: ren iisstart.htm iisstart.htm.old %= rename the original iisstart.htm to avoid overwriting it =%
echo ^<html^>^<body^>Goodbye, World!^</body^>^</html^> >iisstart.htm
:: there's no need to popd as setlocal is enabled

View file

@ -0,0 +1 @@
dism /online /disable-feature /featurename:IIS-WebServerRole

View file

@ -0,0 +1,20 @@
$http = New-Object System.Net.HttpListener
$http.Prefixes.Add("http://localhost:8080/")
$http.Start()
[string]$html = "<html><body>Goodbye, World!</body></html>"
try {
while ($http.IsListening) {
$context = $http.GetContext()
if ($context.Request.HttpMethod -eq 'GET' -and $context.Request.RawUrl -eq '/') {
$buffer = [System.Text.Encoding]::UTF8.GetBytes($html) # convert html to bytes
$context.Response.ContentLength64 = $buffer.Length
$context.Response.OutputStream.Write($buffer, 0, $buffer.Length) #stream to broswer
$context.Response.OutputStream.Close() # close the response
}
}
} finally {
# Executes when ctrl-c
# Multiple attempts may be needed to get to this block
$http.Stop()
$http.Close()
}

View file

@ -0,0 +1,5 @@
rye .needs { http }
http-server ":8080"
|Handle "/" fn { w r } { .Write "Goodbye, World!" }
|Serve