Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanocasazza committed Jan 30, 2017
1 parent ada26bd commit dfbb912
Show file tree
Hide file tree
Showing 30 changed files with 1,413 additions and 877 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ It include as application example a powerful search engine with relative [web in

The current version offers the following features :

* HTTP/1.0 and 1.1 protocols supported and experimental implementations of HTTP/2.
* HTTP/1.0 and 1.1 protocols supported and experimental implementations of HTTP/2 ([h2spec compliant](https://github.com/summerwind/h2spec)).
* Persistent connections for HTTP/1.1 and Keep-Alive support for HTTP/1.0.
* Browser cache management (headers: If-Modified-Since/Last-modified).
* Chunk-encoding transfers support.
Expand Down
2 changes: 2 additions & 0 deletions include/ulib/container/hash_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,8 @@ template <> class U_EXPORT UHashMap<UString> : public UHashMap<UStringRep*> {
UHashMap<UStringRep*>::insertAfterFind(_key, str.rep);
}

uint32_t getSpaceToDump() const;

// OPERATOR

bool operator==(const UHashMap<UString>& v) __pure;
Expand Down
15 changes: 15 additions & 0 deletions include/ulib/container/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,21 @@ template <> class U_EXPORT UVector<UString> : public UVector<UStringRep*> {
bool contains(UVector<UString>& vec, bool ignore_case = false);
bool isContained(const UString& str, bool ignore_case = false) { return (contains(str, ignore_case) != U_NOT_FOUND); }

uint32_t getSpaceToDump() const
{
U_TRACE_NO_PARAM(0, "UVector<UString>::getSpaceToDump()")

U_CHECK_MEMORY

U_INTERNAL_DUMP("_length = %u", _length)

uint32_t space = U_CONSTANT_SIZE("( )");

for (uint32_t i = 0; i < _length; ++i) space += at(i).getSpaceToDump() + 1;

U_RETURN(space);
}

// OPERATOR

bool operator==(const UVector<UString>& v) const __pure;
Expand Down
6 changes: 3 additions & 3 deletions include/ulib/debug/macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

// Design by contract - if (expr == false) then stop

#ifdef DEBUG // NB: we need to save the status on the stack because of thread (ex. time resolution optimation)
#ifdef DEBUG // NB: we need to save the status on the stack because of thread (ex. time resolution optimizatio)
# define U_ASSERT(expr) { int _s = u_trace_suspend; u_trace_suspend = 1; U_INTERNAL_ASSERT(expr); u_trace_suspend = _s; }
# define U_ASSERT_MINOR(a,b) { int _s = u_trace_suspend; u_trace_suspend = 1; U_INTERNAL_ASSERT_MINOR(a,b); u_trace_suspend = _s; }
# define U_ASSERT_MAJOR(a,b) { int _s = u_trace_suspend; u_trace_suspend = 1; U_INTERNAL_ASSERT_MAJOR(a,b); u_trace_suspend = _s; }
Expand Down Expand Up @@ -186,8 +186,8 @@ if (envp) \
U_NEW(CLASS,obj,args), \
UObjectDB::flag_ulib_object = false)

# define U_DUMP_OBJECT(obj) { u_trace_dump(U_CONSTANT_TO_PARAM(#obj" = %S"), (obj).dump(true)); }
# define U_DUMP_CONTAINER(obj) { if (utr.active[0]) u_trace_dump(U_CONSTANT_TO_PARAM(#obj" = %O"), U_OBJECT_TO_TRACE((obj))); }
# define U_DUMP_OBJECT(obj) { if (utr.active[0]) u_trace_dump(U_CONSTANT_TO_PARAM(#obj" = %S"), U_OBJECT_TO_TRACE((obj))); }
# define U_DUMP_CONTAINER(obj) { if (utr.active[0] && (obj).getSpaceToDump() < U_MAX_SIZE_PREALLOCATE) u_trace_dump(U_CONSTANT_TO_PARAM(#obj" = %O"), U_OBJECT_TO_TRACE((obj))); }

# define U_DUMP_OBJECT_TO_TMP(obj,fname) \
{ char _buffer[2 * 1024 * 1024]; \
Expand Down
10 changes: 5 additions & 5 deletions include/ulib/internal/chttp.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,10 @@ enum HttpRequestType {
#define U_HTTP_METHOD_NUM_TO_PARAM(num) u_clientimage_info.http_method_list[num].name, u_clientimage_info.http_method_list[num].len
#define U_HTTP_METHOD_NUM_TO_TRACE(num) u_clientimage_info.http_method_list[num].len, u_clientimage_info.http_method_list[num].name

#define U_HTTP_HOST_STREQ(str) (U_http_host_len ? U_STREQ(u_clientimage_info.http_info.host, U_http_host_len, str) : false)

#define U_HTTP_HOST_STREQ(str) (U_http_host_len ? U_STREQ(u_clientimage_info.http_info.host, U_http_host_len, str) : false)
#define U_HTTP_REFERER_STREQ(str) (u_clientimage_info.http_info.referer_len ? U_STREQ(u_clientimage_info.http_info.referer,u_clientimage_info.http_info.referer_len, str) : false)

#define U_HTTP_USER_AGENT_STREQ(str) (u_clientimage_info.http_info.user_agent_len ? U_STREQ(u_clientimage_info.http_info.user_agent,u_clientimage_info.http_info.user_agent_len, str) : false)

#define U_HTTP_URI_MEMEQ(str) memcmp(u_clientimage_info.http_info.uri, U_CONSTANT_TO_PARAM(str)) == 0
#define U_HTTP_URI_MEMEQ(str) (memcmp(u_clientimage_info.http_info.uri, U_CONSTANT_TO_PARAM(str)) == 0)
#define U_HTTP_URI_STREQ(str) U_STREQ(u_clientimage_info.http_info.uri, u_clientimage_info.http_info.uri_len, str)

#define U_HTTP_CTYPE_MEMEQ(str) (U_http_content_type_len ? memcmp(u_clientimage_info.http_info.content_type, U_CONSTANT_TO_PARAM(str)) == 0 : false)
Expand All @@ -317,6 +314,9 @@ enum HttpRequestType {
#define U_HTTP_QUERY_MEMEQ(str) (u_clientimage_info.http_info.query_len ? memcmp(u_clientimage_info.http_info.query, U_CONSTANT_TO_PARAM(str)) == 0 : false)
#define U_HTTP_QUERY_STREQ(str) (u_clientimage_info.http_info.query_len ? U_STREQ(u_clientimage_info.http_info.query, u_clientimage_info.http_info.query_len, str) : false)

#define U_HTTP_USER_AGENT_MEMEQ(str) (u_clientimage_info.http_info.user_agent_len ? memcmp(u_clientimage_info.http_info.user_agent,U_CONSTANT_TO_PARAM(str)) == 0 : false)
#define U_HTTP_USER_AGENT_STREQ(str) (u_clientimage_info.http_info.user_agent_len ? U_STREQ(u_clientimage_info.http_info.user_agent,u_clientimage_info.http_info.user_agent_len, str) : false)

/**
* The hostname of your server from header's request.
* The difference between U_HTTP_HOST_.. and U_HTTP_VHOST_.. is that
Expand Down
Loading

0 comments on commit dfbb912

Please sign in to comment.