0

I have an HTTP server which is returning a response with set-cookie headers and a redirect.

I've written a client using libwebsocket v3.2.3 and I don't see how I'm supposed to fetch the cookie(s) sent by the server.

I've tried the following code to see if there is any callback stage at which I can see the set-cookie headers. There is none. I do see that somewhere between the stages, these headers are added to the internal header map and wsi->http.ah->frag_index[WSI_TOKEN_HTTP_SET_COOKIE] == 14 but I don't see how I'm supposed to get this before it disappears since it does not exist at any callback stage. i.e. at all callback stages wsi->http.ah->frag_index[WSI_TOKEN_HTTP_SET_COOKIE] == 0

static int
callback_http(struct lws *wsi, enum lws_callback_reasons reason,
          void *user, void *in, size_t len) {
    int len2 = lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_SET_COOKIE);
    if (len2)
        fprintf(stderr, "reason=%d len=%d\n", reason, len2);
GroovyDotCom
  • 1,304
  • 2
  • 15
  • 29

0 Answers0