patx/mrhttp-asgi

v0.12

Commit 6826f12 · Mark Reed · 2024-03-22T14:21:08-07:00

Changeset
6826f12c65b10e79739fa860d7e4bc8e589acf7a
Parents
ffcf267b142518a60a1484b34537ea9e21bc9c99

View source at this commit

Comments

No comments yet.

Log in to comment

Diff

diff --git a/setup.py b/setup.py
index 1b2771a..d409044 100644
--- a/setup.py
+++ b/setup.py
@@ -33,7 +33,7 @@ m1 = Extension(
 
 setup(
   name="mrhttp", 
-  version="0.11",
+  version="0.12",
   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 09c5286..1cbc8a7 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.11
+__version__=0.12
 
diff --git a/src/mrhttp/internals/app.c b/src/mrhttp/internals/app.c
index 7d0c576..160c7be 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.11\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.12\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.11\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.12\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 ece656a..1d17f53 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.11\r\n"; memcpy(p, s, strlen(s)); p += strlen(s);
+  s = "Server: MrHTTP/0.12\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.11\r\n") + strlen("Content-Length: 1        \r\n");
+  p += strlen("HTTP/1.1 200 OK\r\n") + strlen("Server: MrHTTP/0.12\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.11\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.12\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.11\r\n") + strlen("Content-Length: 17       \r\n"), 
+         rbuf + strlen("HTTP/1.1 200 OK\r\n") + strlen("Server: MrHTTP/0.12\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");