Project

General

Profile

Actions

Bug #874

closed

Failed to get actual QueryString

Added by Mamadou Babaei almost 13 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
Start date:
06/27/2011
Due date:
% Done:

0%

Estimated time:

Description

I have an application written in Wt that I was not touched for about 8 months. During this time many things happens to both: my production server and my development machine.

  1. I changed my DataCenter and got a new VPS (the old one and the new one are FreeBSD based boxes).
  2. I got a new development machine based on FreeBSD and replaced Gentoo by Funtoo on my old development machine.

(3 Clean Install.)

Production Machine: FreeBSD + NGINX 1.0.X

Devel Machine 1: FreeBSD + NGINX 1.0.X

Devel Machine 2: Funtoo + NGINX .0.8.X

My app built fine on the production server (FreeBSD) and both my devel machines (FreeBSD & Funtoo). But had some strange behavior which I did not experienced in the past.

Finally after 3 days of testing and debugging, I found the problem.

Since my app heavily uses Raw QUERY_STRING (extracted using WEnvironment::getCgiValue) and something screwed-up that variable, my application is broken now.

I know there are plenty of ways to get param-value pairs using getParameterMap(), getParameterValues() and getParameter() through Wt::WEnvironment; But I need to get the raw query-string for my own purpose (I can't describe it's usage since I supposed to be brief).

Let's say we call the Wt app in browser like this:

http://www.my.domain/?lang=ku

env.getCgiValue("QUERY_STRING"), must return (based on ex-experiences I had with Wt) lang=ku, instead it returns something like wtd=mlxdZBSf1qAOomCI&request=script&rand=446599800 (which I'm sure used by Wt-Ajax calls) no matter what actual query string is. Subsequently affects REQUEST_URI too.

I saw queryString() method in Wt::Http::Request class, and it's purpose is obvious I think; But I found noting other than a brief note (Returns the request query string.) of it's usage. I didn't know how to get running instance of Wt::Http::Request (Maybe I must subclass it, I saw it's primary usage in classes that extends WResource).

From what I understand (plz correct me if I'm wrong), as an end-user I'm not suppose to use this advanced class directly and it used internally by Wt itself.

Thanks in advance.

Actions #1

Updated by Koen Deforche almost 13 years ago

  • Status changed from New to Feedback
  • Assignee set to Koen Deforche

Hey,

Are you deploying using FastCGI?

The way I understand your problem, you want to have env.getCgiValue("QUERY_STRING") return the query string of the initial request (which, given how the environment is defined), is indeed what one would expect?

I believe we can fix this quite easily. Depending on your application, it could also be that enabling the progressive bootstrap mode is a valid workaround ?

Regards,

koen

Actions #2

Updated by Mamadou Babaei almost 13 years ago

Hi Koen,

Thanks for the answer,

Yes I'm deploying using FastCGI since I'm using nginx instead of built-in whttpd.

Yes, exactly!! I need to get the query string of the initial request as Wt provide it to me in the past using the same method.

Thanks for the suggestion, I'll try enabling progressive bootstrap mode and post back here.

Thanks again.

Actions #3

Updated by Mamadou Babaei almost 13 years ago

Thanks, you are my savior.

It worked.

Setting progressive-bootstrap>true in config file solved the problem.

Is Wt using this method on older versions like 3.1.4??

Best regards,

M.S. Babaei

Actions #4

Updated by Mamadou Babaei almost 13 years ago

Is Wt using this method on older versions like 3.1.4??

I mean by default?

Actions #5

Updated by Koen Deforche almost 13 years ago

Hey,

No. But the bootstrapping method has evolved, and I believe the change was an artifact of this. I will try to fix it for the next version (to return the original query string in WEnvironment).

Progressive bootstrap is quite special in the sense that it will render your application first as HTML within the very first response, and then upgrade to Ajax if the browser has scripting support.

Regards,

koen

Actions #6

Updated by Mamadou Babaei almost 13 years ago

Hi,

Thanks for you're comment and clarifying me.

Perfect job Wt Guys!! :)

Actions #7

Updated by Koen Deforche almost 13 years ago

  • Status changed from Feedback to Resolved
  • Target version set to 3.1.11

Hey,

We've fixed it now in git so that env.getCgiValue("QUERY_STRING") will work consistently regardless of bootstrap method.

Regards,

koen

Actions #8

Updated by Mamadou Babaei almost 13 years ago

Hi, Thank you so much!!

Good Job!

Actions #9

Updated by Koen Deforche over 12 years ago

  • Status changed from Resolved to Closed

Resolved in Wt 3.1.11

Actions

Also available in: Atom PDF