patx/mrhttp-asgi
version 0.11
Commit 58217fa · Mark Reed · 2024-03-22T13:25:10-07:00
Comments
No comments yet.
Diff
diff --git a/setup.py b/setup.py
index 52a76bc..1b2771a 100644
--- a/setup.py
+++ b/setup.py
@@ -33,7 +33,7 @@ m1 = Extension(
setup(
name="mrhttp",
- version="0.10",
+ version="0.11",
license='MIT',
description='A python web framework written in C',
long_description=open('README.md').read(),
diff --git a/src/mrhttp/__init__.py b/src/mrhttp/__init__.py
index 9f91411..09c5286 100644
--- a/src/mrhttp/__init__.py
+++ b/src/mrhttp/__init__.py
@@ -21,5 +21,5 @@ from .mrcacheclient import MrcacheClient
from .app import *
from .internals import randint, escape, to64, from64, timesince
-__version__=0.10
+__version__=0.11
diff --git a/src/mrhttp/internals/app.c b/src/mrhttp/internals/app.c
index c5c0501..7d0c576 100644
--- a/src/mrhttp/internals/app.c
+++ b/src/mrhttp/internals/app.c
@@ -213,7 +213,7 @@ void MrhttpApp_setup_error_pages(MrhttpApp* self) {
char *body = PyUnicode_AsUTF8AndSize( u, &l );
char *resp = malloc( l + 1024 );
- sprintf(resp, "HTTP/1.1 404 Not Found\r\nServer: MrHTTP/0.8\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: %zu\r\n\r\n", l);
+ sprintf(resp, "HTTP/1.1 404 Not Found\r\nServer: MrHTTP/0.11\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: %zu\r\n\r\n", l);
char *p = resp + strlen(resp);
memcpy(p, body, l);
@@ -225,7 +225,7 @@ void MrhttpApp_setup_error_pages(MrhttpApp* self) {
body = PyUnicode_AsUTF8AndSize( u, &l );
resp = malloc( l + 1024 );
- sprintf(resp, "HTTP/1.1 400 Bad Request\r\nServer: MrHTTP/0.8\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: %zu\r\n\r\n", l);
+ sprintf(resp, "HTTP/1.1 400 Bad Request\r\nServer: MrHTTP/0.11\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: %zu\r\n\r\n", l);
p = resp + strlen(resp);
memcpy(p, body, l);
diff --git a/src/mrhttp/internals/response.c b/src/mrhttp/internals/response.c
index 5413ecb..ece656a 100644
--- a/src/mrhttp/internals/response.c
+++ b/src/mrhttp/internals/response.c
@@ -36,7 +36,7 @@ void response_setupResponseBuffer(void) {
// Also all 115 and 143s ( updateHeaders )
s = "HTTP/1.1 200 OK\r\n"; memcpy(p, s, strlen(s)); p += strlen(s);
s = "Content-Length: 1 \r\n"; memcpy(p, s, strlen(s)); p += strlen(s);
- s = "Server: MrHTTP/0.10\r\n"; memcpy(p, s, strlen(s)); p += strlen(s);
+ s = "Server: MrHTTP/0.11\r\n"; memcpy(p, s, strlen(s)); p += strlen(s);
s = "Date: Thu, 05 Apr 2018 22:54:19 GMT\r\n"; memcpy(p, s, strlen(s)); p += strlen(s);
s = "Content-Type: text/html; charset=utf-8\r\n\r\n"; memcpy(p, s, strlen(s)); p += strlen(s);
DBG_RESP printf("Init resp buffer:\n%.*s", (int)(p-rbuf), rbuf);
@@ -74,7 +74,7 @@ PyObject *response_updateDate(PyObject *date) {
Py_ssize_t l;
char *d = PyUnicode_AsUTF8AndSize( date, &l );
char *p = rbuf;
- p += strlen("HTTP/1.1 200 OK\r\n") + strlen("Server: MrHTTP/0.10\r\n") + strlen("Content-Length: 1 \r\n");
+ p += strlen("HTTP/1.1 200 OK\r\n") + strlen("Server: MrHTTP/0.11\r\n") + strlen("Content-Length: 1 \r\n");
p += 6;
memcpy(p, d, l);
Py_RETURN_NONE;
@@ -234,10 +234,10 @@ PyObject *response_getErrorResponse(int code, char *reason, char *msg) {
sprintf( body, "<html><head><title>%d %s</title></head><body><h1>%s</h1><p>%s</p></body></html>", code, reason, reason, msg );
int blen = strlen(body);
- sprintf(p, "HTTP/1.1 %d %s\r\nServer: MrHTTP/0.10\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: %d\r\n", code, reason, blen);
+ sprintf(p, "HTTP/1.1 %d %s\r\nServer: MrHTTP/0.11\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: %d\r\n", code, reason, blen);
p += strlen(p);
memcpy(p,
- rbuf + strlen("HTTP/1.1 200 OK\r\n") + strlen("Server: MrHTTP/0.10\r\n") + strlen("Content-Length: 17 \r\n"),
+ rbuf + strlen("HTTP/1.1 200 OK\r\n") + strlen("Server: MrHTTP/0.11\r\n") + strlen("Content-Length: 17 \r\n"),
strlen("Date: Thu, 05 Apr 2018 22:54:19 GMT\r\n"));
p += strlen("Date: Thu, 05 Apr 2018 22:54:19 GMT\r\n");