Re: Debugging bad requests with vibe

2018-02-09 Thread tetyys via Digitalmars-d-learn

On Friday, 9 February 2018 at 11:46:31 UTC, Nicholas Wilson wrote:

On Friday, 9 February 2018 at 08:06:53 UTC, Seb wrote:
On Thursday, 8 February 2018 at 17:09:44 UTC, Nicholas Wilson 
wrote:
Is there a way I can see/log what requests are being made? I 
can change both the client and server.


-v and -vv


All that gives me is a bunch of
[FAC3BFF6:FAC451F6 dia] Actively closing TCP connection

is there a way to get the JSON being sent?


Try Fiddler, great tool too


Re: How to convert hex string to string or ubytes? Thanks.

2018-02-05 Thread tetyys via Digitalmars-d-learn

On Monday, 5 February 2018 at 08:41:43 UTC, FrankLike wrote:

On Monday, 5 February 2018 at 06:12:22 UTC, H. S. Teoh wrote:

On Mon, Feb 05, 2018 at 05:48:00AM +, FrankLike via



auto input = "48656c6c6f20776f726c6421";
auto str = input.chunks(2)
	.map!(digits => cast(char) 
digits.to!ubyte(16))

.array;


But,if the input come from here:

import std.digest.md;
auto hash =md5Of("Some Words");
auto input = cast(string)hexString(hash);

 auto str = input.chunks(2)
 .map!(digits => cast(char) digits.to!ubyte(16))
 .array;

Then get an error:
core.exception.UnicodeException@src\rt\util\utf.d(292):invalid 
UTF-8 sequence

--
0x0041B8E6
0x00419530
0x0040796F

Thanks.


Casting unknown bytes to string or char is unsafe, and obviously 
some bytes can be invalid UTF8 sequences.


Re: Need help to get OpenSSL 64 work on Windows x64 | I hate D's GC!

2017-07-15 Thread tetyys via Digitalmars-d-learn

On Friday, 14 July 2017 at 17:24:05 UTC, Suliman wrote:

GC on 32-bit machine show a lot of bugs.


such as..?


Re: mysql-native + vibe.d example

2017-06-30 Thread tetyys via Digitalmars-d-learn

On Friday, 30 June 2017 at 00:52:28 UTC, crimaniak wrote:

Hi!
Moving my project from mysql-lited to mysql-native I faced the 
problem with null pointer error inside of mysql-native:




seems like it's already fixed 
https://github.com/mysql-d/mysql-native/commit/477636ad92a15d504308d1893f987685cd71


Re: Using array slices with C-style fread() from file

2017-06-21 Thread tetyys via Digitalmars-d-learn

On Wednesday, 21 June 2017 at 18:58:58 UTC, tetyys wrote:

On Wednesday, 21 June 2017 at 18:49:01 UTC, uncorroded wrote:
Is there a way of making this work with D slices? Can they be 
used as C-style pointers?


What about this



Or simpler,

while (left)
left -= fread(buf[n-left .. $].ptr, ubyte.sizeof, left, fp);


Re: Using array slices with C-style fread() from file

2017-06-21 Thread tetyys via Digitalmars-d-learn

On Wednesday, 21 June 2017 at 18:49:01 UTC, uncorroded wrote:
Is there a way of making this work with D slices? Can they be 
used as C-style pointers?


What about this:

@nogc ubyte[n] rand_bytes(uint n)() {
import core.stdc.stdio;
FILE *fp;
fp = fopen("/dev/urandom", "r");
ubyte[n] buf;
uint bread = 0;
while (bread < n) {
auto toread = n - bread;
auto read = fread(buf[bread .. $].ptr, ubyte.sizeof, 
toread, fp);

bread += read;
}
fclose(fp);
return buf;
}

?