Rename HttpStream() to HttpServerStream() to match HttpClientStream()

This commit is contained in:
Jordan Bancino 2023-03-16 02:17:48 +00:00
parent ff52cc78dc
commit 65f4c90df3
10 changed files with 14 additions and 11 deletions

View file

@ -13,11 +13,14 @@ Milestone: v0.3.0
[~] Stream API
[~] Implementation
[ ] Convert all HTTP code and JSON code
[ ] Convert all code that deals with I/O
[ ] Multi-output (proof of concept)
[ ] Memory streams (proof of concept)
[ ] TLS
[ ] SOCKS
[x] Move/convert UtilStreamCopy()
[ ] Io man page
[ ] Stream man page
[~] HTTP Client API
[x] Document HttpParseHeaders()
[ ] HttpClient man page

View file

@ -230,7 +230,7 @@ HttpResponseStatus(HttpServerContext * c, HttpStatus status)
}
FILE *
HttpStream(HttpServerContext * c)
HttpServerStream(HttpServerContext * c)
{
if (!c)
{

View file

@ -128,7 +128,7 @@ MatrixHttpHandler(HttpServerContext * context, void *argp)
HttpResponseHeader(context, "Content-Type", "application/json");
HttpSendHeaders(context);
stream = HttpStream(context);
stream = HttpServerStream(context);
JsonEncode(response, stream, JSON_DEFAULT);
JsonFree(response);

View file

@ -74,7 +74,7 @@ ROUTE_IMPL(RouteLogin, args)
HashMapSet(response, "flows", JsonValueArray(enabledFlows));
break;
case HTTP_POST:
request = JsonDecode(HttpStream(args->context));
request = JsonDecode(HttpServerStream(args->context));
if (!request)
{
HttpResponseStatus(args->context, HTTP_BAD_REQUEST);

View file

@ -63,7 +63,7 @@ ROUTE_IMPL(RouteRefresh, args)
return MatrixErrorCreate(M_UNRECOGNIZED);
}
request = JsonDecode(HttpStream(args->context));
request = JsonDecode(HttpServerStream(args->context));
if (!request)
{
HttpResponseStatus(args->context, HTTP_BAD_REQUEST);

View file

@ -81,7 +81,7 @@ ROUTE_IMPL(RouteRegister, args)
return MatrixErrorCreate(M_UNRECOGNIZED);
}
request = JsonDecode(HttpStream(args->context));
request = JsonDecode(HttpServerStream(args->context));
if (!request)
{
HttpResponseStatus(args->context, HTTP_BAD_REQUEST);

View file

@ -27,7 +27,7 @@
ROUTE_IMPL(RouteStatic, args)
{
FILE *stream = HttpStream(args->context);
FILE *stream = HttpServerStream(args->context);
char *pathPart = MATRIX_PATH_POP(args->path);
HttpResponseHeader(args->context, "Content-Type", "text/html");

View file

@ -46,7 +46,7 @@ ROUTE_IMPL(RouteTokenValid, args)
HttpResponseStatus(args->context, HTTP_BAD_REQUEST);
return MatrixErrorCreate(M_UNRECOGNIZED);
}
request = JsonDecode(HttpStream(args->context));
request = JsonDecode(HttpServerStream(args->context));
if (!request)
{
HttpResponseStatus(args->context, HTTP_BAD_REQUEST);

View file

@ -69,7 +69,7 @@ extern void
HttpResponseStatus(HttpServerContext *, HttpStatus);
extern FILE *
HttpStream(HttpServerContext *);
HttpServerStream(HttpServerContext *);
extern void
HttpSendHeaders(HttpServerContext *);

View file

@ -59,14 +59,14 @@ HttpHandle(HttpServerContext * cx, void *args)
printf("\n");
bytes = UtilStreamCopy(HttpStream(cx), stdout);
bytes = UtilStreamCopy(HttpServerStream(cx), stdout);
printf("\n");
printf("(%lu bytes)\n", bytes);
HttpSendHeaders(cx);
fprintf(HttpStream(cx), "{}\n");
fprintf(HttpServerStream(cx), "{}\n");
}
int