mirror of
https://github.com/sigmasternchen/Serwer
synced 2025-03-15 23:28:54 +00:00
rename of functions
This commit is contained in:
parent
f092d584fa
commit
306c8de7b4
3 changed files with 6 additions and 6 deletions
|
@ -15,7 +15,7 @@ int hello_world(method_t method, const char* host, const char* path, headers_t r
|
||||||
int test(method_t method, const char* host, const char* path, headers_t requestHeaders,
|
int test(method_t method, const char* host, const char* path, headers_t requestHeaders,
|
||||||
headers_t* responseHeaders, stream_t request, stream_t response) {
|
headers_t* responseHeaders, stream_t request, stream_t response) {
|
||||||
|
|
||||||
fprintf(response, "Method: %s, URI: %s%s\n", ws_strm(method), host, path);
|
fprintf(response, "Method: %s, URI: %s%s\n", ws_method_string(method), host, path);
|
||||||
fprintf(response, "Request headers:\n");
|
fprintf(response, "Request headers:\n");
|
||||||
for (int i = 0; i < requestHeaders.nrfields; i++) {
|
for (int i = 0; i < requestHeaders.nrfields; i++) {
|
||||||
header_t header = requestHeaders.fields[i];
|
header_t header = requestHeaders.fields[i];
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
method_t ws_meth(const char* string) {
|
method_t ws_method(const char* string) {
|
||||||
if (strcmp(string, "OPTIONS") == 0)
|
if (strcmp(string, "OPTIONS") == 0)
|
||||||
return OPTIONS;
|
return OPTIONS;
|
||||||
else if (strcmp(string, "GET") == 0)
|
else if (strcmp(string, "GET") == 0)
|
||||||
|
@ -27,7 +27,7 @@ method_t ws_meth(const char* string) {
|
||||||
return -1; // unknown method
|
return -1; // unknown method
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* ws_strm(method_t method) {
|
const char* ws_method_string(method_t method) {
|
||||||
switch(method) {
|
switch(method) {
|
||||||
case OPTIONS:
|
case OPTIONS:
|
||||||
return "OPTIONS";
|
return "OPTIONS";
|
||||||
|
@ -263,7 +263,7 @@ int ws_request_parse(char* buffer, const char** path, method_t* method) {
|
||||||
} else {
|
} else {
|
||||||
state++;
|
state++;
|
||||||
lbuffer[position] = '\0';
|
lbuffer[position] = '\0';
|
||||||
*method = ws_meth(lbuffer);
|
*method = ws_method(lbuffer);
|
||||||
if (*method < 0)
|
if (*method < 0)
|
||||||
return -2; // unknown method
|
return -2; // unknown method
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
#include "ws_types.h"
|
#include "ws_types.h"
|
||||||
|
|
||||||
method_t ws_meth(const char*);
|
method_t ws_method(const char*);
|
||||||
const char* ws_strm(method_t);
|
const char* ws_method_string(method_t);
|
||||||
const char* ws_code_reason(int);
|
const char* ws_code_reason(int);
|
||||||
|
|
||||||
bool ws_host_match(const char*, const char*);
|
bool ws_host_match(const char*, const char*);
|
||||||
|
|
Loading…
Reference in a new issue