rename of functions

This commit is contained in:
overflowerror 2017-01-02 22:36:40 +01:00
parent f092d584fa
commit 306c8de7b4
3 changed files with 6 additions and 6 deletions

View file

@ -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];

View file

@ -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
} }

View file

@ -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*);