Skip to content

Commit

Permalink
some fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanocasazza committed Nov 24, 2015
1 parent 89af64a commit 7886a79
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/ulib/net/server/plugin/usp/db.usp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static void usp_end_db()
#endif
-->
<!--#header
Content-Type: application/json; charset=UTF-8
Content-Type: application/json
-->
<!--#code
pworld_db->id = u_get_num_random(10000);
Expand Down
2 changes: 1 addition & 1 deletion src/ulib/net/server/plugin/usp/json.usp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static void usp_end_json()
#endif
-->
<!--#header
Content-Type: application/json; charset=UTF-8
Content-Type: application/json
-->
<!--#code
#ifndef AS_cpoll_cppsp_DO
Expand Down
2 changes: 1 addition & 1 deletion src/ulib/net/server/plugin/usp/query.usp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static void usp_end_query()
queries;
-->
<!--#header
Content-Type: application/json; charset=UTF-8
Content-Type: application/json
-->
<!--#code
int i = 0, num_queries;
Expand Down
2 changes: 1 addition & 1 deletion src/ulib/net/server/plugin/usp/rdb.usp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static void usp_end_rdb()
#endif
-->
<!--#header
Content-Type: application/json; charset=UTF-8
Content-Type: application/json
-->
<!--#code
UStringRep* rep;
Expand Down
2 changes: 1 addition & 1 deletion src/ulib/net/server/plugin/usp/rquery.usp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static void usp_end_rquery()
queries;
-->
<!--#header
Content-Type: application/json; charset=UTF-8
Content-Type: application/json
-->
<!--#code
World* pworld;
Expand Down
2 changes: 1 addition & 1 deletion src/ulib/net/server/plugin/usp/rupdate.usp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static void usp_end_rupdate()
queries;
-->
<!--#header
Content-Type: application/json; charset=UTF-8
Content-Type: application/json
-->
<!--#code
World* pworld;
Expand Down
2 changes: 1 addition & 1 deletion src/ulib/net/server/plugin/usp/update.usp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static void usp_end_update()
queries;
-->
<!--#header
Content-Type: application/json; charset=UTF-8
Content-Type: application/json
-->
<!--#code
int i = 0, num_queries;
Expand Down
25 changes: 12 additions & 13 deletions src/ulib/utility/http2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,18 @@ void UHTTP2::readFrame()

if (sz == UClientImage_Base::rstart)
{
U_INTERNAL_DUMP("settings_ack = %b U_http2_settings_len = %b", settings_ack, U_http2_settings_len)

if (settings_ack &&
U_http2_settings_len)
{
U_DEBUG("HTTP2 upgrade: User-Agent = %.*S", U_HTTP_USER_AGENT_TO_TRACE);

openStream();

goto end;
}

UClientImage_Base::rstart = 0;

UClientImage_Base::rbuffer->setEmpty();
Expand Down Expand Up @@ -1169,19 +1181,6 @@ void UHTTP2::readFrame()
{
// TODO

U_INTERNAL_DUMP("settings_ack = %b UClientImage_Base::rbuffer->size() = %u UClientImage_Base::rstart = %u",
settings_ack, UClientImage_Base::rbuffer->size(), UClientImage_Base::rstart)

if (settings_ack &&
UClientImage_Base::rbuffer->size() == UClientImage_Base::rstart)
{
U_INTERNAL_DUMP("User-Agent: = %.*S", U_HTTP_USER_AGENT_TO_TRACE)

openStream();

goto end;
}

goto loop;
}

Expand Down
14 changes: 13 additions & 1 deletion src/ulib/utility/uhttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6018,22 +6018,34 @@ void UHTTP::setDynamicResponse()

if (u_is_html(mime_index))
{
# if defined(U_LOG_ENABLE) && defined(USE_LIBZ)
u_put_unalignedp64(ptr1, U_MULTICHAR_CONSTANT64('/','h','t','m','l',';',' ','c'));
u_put_unalignedp64(ptr1+8, U_MULTICHAR_CONSTANT64('h','a','r','s','e','t','=','U'));
u_put_unalignedp32(ptr1+16, U_MULTICHAR_CONSTANT32('T','F','-','8'));
u_put_unalignedp16(ptr1+20, U_MULTICHAR_CONSTANT16('\r','\n'));

sz += U_CONSTANT_SIZE("Content-Type: " U_CTYPE_HTML "\r\n");
# else
u_put_unalignedp64(ptr1, U_MULTICHAR_CONSTANT64('/','h','t','m','l','\r','\n','\0'));

sz += U_CONSTANT_SIZE("Content-Type: text/html\r\n");
# endif
}
else
{
# if defined(U_LOG_ENABLE) && defined(USE_LIBZ)
u_put_unalignedp64(ptr1, U_MULTICHAR_CONSTANT64('/','p','l','a','i','n',';',' '));
u_put_unalignedp64(ptr1+8, U_MULTICHAR_CONSTANT64('c','h','a','r','s','e','t','='));
u_put_unalignedp32(ptr1+16, U_MULTICHAR_CONSTANT32('U','T','F','-'));
ptr1[20] = '8';
u_put_unalignedp16(ptr1+21, U_MULTICHAR_CONSTANT16('\r','\n'));

sz += U_CONSTANT_SIZE("Content-Type: " U_CTYPE_TEXT "\r\n");
# else
u_put_unalignedp64(ptr1, U_MULTICHAR_CONSTANT64('/','p','l','a','i','n','\r','\n'));

sz += U_CONSTANT_SIZE("Content-Type: text/plain\r\n");
# endif
}
}

Expand Down Expand Up @@ -9575,7 +9587,7 @@ U_NO_EXPORT void UHTTP::processGetRequest()
{
expire = 0L;

ctype = (mime_index == U_unknow ? U_CTYPE_TEXT
ctype = (mime_index == U_unknow ? "text/plain"
: file->getMimeType());
}

Expand Down
1 change: 1 addition & 0 deletions tests/.function
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ check_for_netcat() {
NC=nc
fi
if [ "$NC_TEST" = "Ncat 6.47 " ] || \
[ "$NC_TEST" = "Ncat 7.00 " ] || \
[ "$NC_TEST" = "usage: nc [-46DdhklnrStUuvzC] [-i interval] [-p source_port]" ] || \
[ "$NC_TEST" = "This is nc from the netcat-openbsd package. An alternative nc is available in the netcat-traditional package." ]; then
NC=nc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static void usp_end_db()
#endif
-->
<!--#header
Content-Type: application/json; charset=UTF-8
Content-Type: application/json
-->
<!--#code
pworld_db->id = u_get_num_random(10000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static void usp_end_json()
#endif
-->
<!--#header
Content-Type: application/json; charset=UTF-8
Content-Type: application/json
-->
<!--#code
#ifndef AS_cpoll_cppsp_DO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static void usp_end_query()
queries;
-->
<!--#header
Content-Type: application/json; charset=UTF-8
Content-Type: application/json
-->
<!--#code
int i = 0, num_queries;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static void usp_end_rdb()
#endif
-->
<!--#header
Content-Type: application/json; charset=UTF-8
Content-Type: application/json
-->
<!--#code
UStringRep* rep;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static void usp_end_rquery()
queries;
-->
<!--#header
Content-Type: application/json; charset=UTF-8
Content-Type: application/json
-->
<!--#code
World* pworld;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static void usp_end_rupdate()
queries;
-->
<!--#header
Content-Type: application/json; charset=UTF-8
Content-Type: application/json
-->
<!--#code
World* pworld;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static void usp_end_update()
queries;
-->
<!--#header
Content-Type: application/json; charset=UTF-8
Content-Type: application/json
-->
<!--#code
int i = 0, num_queries;
Expand Down

0 comments on commit 7886a79

Please sign in to comment.