User Profile

Collapse

Profile Sidebar

Collapse
Sieira
Sieira
Last Activity: Sep 7 '15, 07:03 PM
Joined: May 30 '07
Location: Paris, France
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Actually I was doing it properly at the beginning, and the problem was that I was "clearing" my context with done() before the post data arrived. The solution is:

    Code:
      var req = http.request(options, function(res) {
        res.statusCode.should.equal(200);
    
        res.on('data', function(data) {
          encryptedMessage = JSON.parse(data).message;
          encryptedMessage.should.not.equal(message);
    ...
    See more | Go to post

    Leave a comment:


  • Thank you for your kind help

    Actually, this is not the complete code, just a simplification. All the variables are defined, otherwise I'd be getting an ECCONREFUSED or similar. As far as I know, the tests are properly configured. I can perform GETS without problems, following the same method, and my POST is sending an answer, but not the data within. You can take a look at the complete code here:

    Test (from line 375) ->...
    See more | Go to post

    Leave a comment:


  • How to retrieve JSON response data from POST request in nodejs

    I'm performing some encryption in my server (express routing in node) through a post request:

    Code:
    app.post('/encrypt', encrypt);
    Encrypt is doing:

    Code:
    function encrypt(req,res) {
            if(req.body.key && req.body.message) {
                var encryptedMessage = Encrypter.encrypt(req.body.key,req.body.message);
    
                return res.status(200).json({ message: encryptedMessage
    ...
    See more | Go to post
    Last edited by Sieira; Aug 25 '15, 03:20 PM. Reason: Corrected bad formatting

  • Sieira
    replied to Openssl RSA public encryption problem
    in C
    Finally, I've solved it.

    The solution is not to change it at all, the function was working properly, I just didn't know a thing about "padding", so I expected to have always the same output for the same input.

    Approximately this was my problem:

    It can be dangerous to use RSA with short strings, because blocks (modulus,input and output) have to be the same length, so when input is shorter it gets...
    See more | Go to post

    Leave a comment:


  • Sieira
    replied to Openssl RSA public encryption problem
    in C
    So, trying again, the function bellow doesn't work.

    It is, as explained before, a function to wrap OpenSSL's RSA_public_encr ypt function.

    Output parameter "encrypted" , which is an (unsigned char *), gets different values each time the function is called.

    This behaviour is the same inside the function (i.e. if i print it's value inside it, instead after calling it)

    [CODE=C]
    ...
    See more | Go to post

    Leave a comment:


  • Sieira
    replied to Openssl RSA public encryption problem
    in C
    Sorry, I forgot that point. I'm getting a different result on each encryption of the same string, some kind of memory corruption, something must be wrong with the initialisations of bignums, or the key, I guess
    See more | Go to post

    Leave a comment:


  • Sieira
    started a topic Openssl RSA public encryption problem
    in C

    Openssl RSA public encryption problem

    Hello, I'm having a problem with the code below, I've spent the last two days checking it, but somehow, I cannot see where my mistake is. It's a simple function which objective is to wrap OpenSSL's RSA_public_encr ypt taking two bignums (modulus and exponent) instead of an RSA key.

    About the other two functions, only have test purposes.

    I'd also like to find some good documentation of OpenSSL, since the UNIX manpages...
    See more | Go to post
    Last edited by sicarie; Jul 8 '08, 01:22 AM. Reason: Full code removed per Posting Guidelines, please post the specific snippett causing the issue

  • Sieira
    started a topic realloc for (char **) doesn't seem to work
    in C

    realloc for (char **) doesn't seem to work

    I have a list of strings, and a function which is supposed to add one in the tail of it.

    List is initialised this way:

    Code:
    char **Istate=NULL;
    
    Istate=malloc(sizeof (char *));
    Istate[0]=NULL;
    Function called like this (nIstate is an integer I'll use later in order to manipulate other lists):

    Code:
    nIstate=appendList(&Istate,buff);
    And finally, this is the function:...
    See more | Go to post

  • Sieira
    started a topic How to print unusual characters
    in C

    How to print unusual characters

    While programming a mini-shell for linux, I wanted to use an original PROMPT, and I remembered that there did exist two smileys in ASCII code.

    I couldn't use it since these characters are 001(SOH) and 002(STX).

    I tried to find these characters written anywhere (you know... traditional copy/paste method), but again failed.

    then I thought about '€'.

    I have this

    [CODE=c]#declare...
    See more | Go to post

  • Sieira
    replied to Count frequency of prepositions from input text
    in C
    one list of prepositions cannot become large, Anyway, Tom's solution looks much more elegant...
    See more | Go to post

    Leave a comment:


  • Sieira
    replied to Count frequency of prepositions from input text
    in C
    For instance, you can take each word, one by one from the text file, and compare it with a list of english prepositions, you have to count how many have been found, think about something that serves as a list and a counter of each member...



    (I DIDN'T WANT TO REPORT, I MISSED THE LINK FOR THE REPLY, SO SORRY)...
    See more | Go to post

    Leave a comment:


  • My mother is single.

    I looked at my watch, i got 12:30 a.m
    Doing the same i got 12:31 a.m
    Doing the same i got 12:35 a.m
    Doing the same i got 1:31 p.m
    Doing the same i got 1:39 p.m
    and so on......
    See more | Go to post

    Leave a comment:


  • Sieira
    replied to tutorials related to dlls
    in C
    _______________ _______________ _______________ _______________ _____

    Since you use the spanish syntax, and "gud" and "thru" are written like it would be written as spanish words... i'm going to suppose that you will understand these:

    Creando una librería con C++ (ejemplo práctico)

    Crear y utilizar una biblioteca de vínculos dinámicos



    Also in english you...
    See more | Go to post

    Leave a comment:


  • Sieira
    replied to Coolest letter
    Hipopotomonstro sesquipedalifob ia

    In english might be Hipopotomonstro sesquipedalioph obia (one letter longer)

    "La hipopotomonstro sesquipedaliofo bia es un miedo irracional (o fobia) a la pronunciación de palabras largas y complicadas. "

    TRANSLATION-> hipopotomonstro sesquipedalioph obia is an irrational fear to pronounce long and complex words
    See more | Go to post

    Leave a comment:


  • Sieira
    replied to Problem with gcc build - #including files
    in C
    Thank you, I was not getting crazy. I was stupid...

    I wondered "why didn't compile for me if the code has no errors?"

    Obviously the problem was in my Makefile

    Code:
    CC=gcc
    CXX=gcc
    INCLUDES=-I ./include
    CFLAGS=-g -c -Wall
    LDFLAGS=
    SOURCES=./src/IFTI_P2_automat.c ./src/TX_automat_SW.c ./src/TX_SW.c
    OBJECTS=$(SOURCES:.c=.o)
    EXECUTABLE1=./bin/TX_SW
    ...
    See more | Go to post

    Leave a comment:


  • Sieira
    replied to Coolest letter
    me too :p (an this makes 20 characters)...
    See more | Go to post

    Leave a comment:


  • Sieira
    replied to Problem with gcc build - #including files
    in C
    Entiendo (o eso creo), gracias... But I couldn't solve my problem

    I've replaced <> with "" around my .h files.

    TX_automat_SW.c includes this:

    [CODE=c]
    #include "TX_automat_SW. h"
    #include "netfunc.h"

    #include <unistd.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>...
    See more | Go to post

    Leave a comment:


  • Sieira
    replied to Simple rule of three
    Every little kid respond right*

    Most of matematicians and engineers do not :p


    *I don't know if this phrase has any sense... i tried to mean
    "Answer from little kids is -nearly- always correct"...
    See more | Go to post

    Leave a comment:


  • Sieira
    started a topic Problem with gcc build - #including files
    in C

    Problem with gcc build - #including files

    I have the following files:


    netfunc.h:

    [CODE=c]typedef struct{
    char data[MAX];
    int n;
    }packet;

    typedef struct
    {
    char flag_s;
    char address;
    unsigned char control;
    char data[MAX];
    unsigned char FCS1;
    unsigned char FCS2;
    char flag_e;
    }frame;

    typedef struct{...
    See more | Go to post

  • Sieira
    replied to Simple rule of three
    correct. this one was easy......
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...