CFHTTP: Imitating a Browser

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default CFHTTP: Imitating a Browser

    I want to send a cfhttp request whose header contains the following fields AND
    ONLY the following fields:

    Host
    User-Agent
    Keep-Alive (value=300)
    Connection (value=keep-alive)
    Accept
    Accept-Language
    Accept-Encoding
    Accept-Charset

    My problem is that I can't tell if my cfhttpparams are working. Eg,

    <cfhttpparam type = "cgi" name="connection" value="keep-alive">
    <cfhttpparam type = "cgi" name="xxxxxxxxxxxx" value="whatever">

    will both be sent in the header if I put them in the cfhttp tag. But the fact
    that "xxxxxxxxxx" is sent makes me wonder if the connection header is even
    correct. That is, it might be that for the browser to recognize the
    "connection" header I need to write something like this:

    <cfhttpparam type = "cgi" name="connection_type" value="keep-alive">

    or something else like that. Anyway, does anyone know what all the correct
    cfhttpparam tags would be for the headers I listed above?

    Also, coldfusion seems to automatically add a header call TE, whose value is
    "trailers, deflate, gzip, compress". What does this do and can I get rid of it?

    TIA,
    lurisia


    lurisia Guest

  2. Similar Questions and Discussions

    1. CFHTTP
      Hello, I need to send data from a CF page to an asp.net page for processing via a URL string. The ASP page takes three parameters. Those being...
    2. Help with cfhttp and links
      I am retrieving a list of documents from another server after sending login params and displaying them. Now I need to convert each of these...
    3. CFHTTP Put Method
      Scenario is one in which I am moving image files from a local laptop running CF Developer Server to a centralized CF Enterprise server. Have been...
    4. CFHTTP help
      We have an in-house built publication system that creates .htm files from database content. For a specific project, I need to modify the way that...
    5. Imitating a virtual dir with a querystring parameter
      Can someone give me an idea of how the technique that lets a querystring parameter look like a virtual directory reference works. You can see...
  3. #2

    Default Re: CFHTTP: Imitating a Browser

    > I want to send a cfhttp request whose header contains the following fields
    AND
    > ONLY the following fields:
    >
    > Host
    > User-Agent
    > Keep-Alive (value=300)
    > Connection (value=keep-alive)
    > Accept
    > Accept-Language
    > Accept-Encoding
    > Accept-Charset
    >
    > My problem is that I can't tell if my cfhttpparams are working. Eg,
    Request a page from your own server. In the CGI scope the variables prefixed
    with HTTP_ are headers sent by client.

    > <cfhttpparam type = "cgi" name="connection" value="keep-alive">
    > <cfhttpparam type = "cgi" name="xxxxxxxxxxxx" value="whatever">
    >
    > will both be sent in the header if I put them in the cfhttp tag. But the
    fact
    > that "xxxxxxxxxx" is sent makes me wonder if the connection header is even
    > correct.
    Connection is "correct". There is a set of headers that are standardized,
    but each app can add her own headers. An application can for example extend
    the HTTP protocol to use it's own X-Command header.

    That is, it might be that for the browser to recognize the
    > "connection" header I need to write something like this:
    I think you meant the server...

    > <cfhttpparam type = "cgi" name="connection_type" value="keep-alive">
    >
    > or something else like that. Anyway, does anyone know what all the
    correct
    > cfhttpparam tags would be for the headers I listed above?
    The header names are correct in your list.
    > Also, coldfusion seems to automatically add a header call TE, whose value
    is
    > "trailers, deflate, gzip, compress". What does this do and can I get rid
    of it?

    It's used to signal the the client can accept compressed content. Sorry,
    don't know how to remove it.

    --
    <mack />


    Neculai Macarie Guest

  4. #3

    Default Re: CFHTTP: Imitating a Browser

    Thanks Mack... A few points I'm still confused about:

    Request a page from your own server.

    To test, I have one test page that makes a cfhttp call to another test page,
    which in turn uses GetHttpRequestData to get all the header info, and then
    writes it to file. I can then look in the file to see what header info was
    sent by <cfhttp>. But like I said, any random header variable I make up will
    also appear in the dump. What did you mean by "request a page from your own
    server"? Is there a better way for me to test?

    In the CGI scope the variables prefixed with HTTP_ are headers sent by client.

    But when I use <cfhttp>, the coldfusion server *is* the client, isn't it? So
    are you saying that I should add "HTTP_ to the name parameters of my
    <cfhttpparam> tags? But then you also said "connection" was correct, so I was
    confused....

    Thanks for any more info,
    lurisia

    lurisia Guest

  5. #4

    Default Re: CFHTTP: Imitating a Browser

    > Thanks Mack... A few points I'm still confused about:
    >
    > Request a page from your own server.
    >
    > To test, I have one test page that makes a cfhttp call to another test
    page,
    > which in turn uses GetHttpRequestData to get all the header info, and then
    > writes it to file. I can then look in the file to see what header info
    was
    > sent by <cfhttp>. But like I said, any random header variable I make up
    will
    > also appear in the dump. What did you mean by "request a page from your
    own
    > server"? Is there a better way for me to test?
    That is the expected result... I'm not sure what your expectations are
    here...
    > In the CGI scope the variables prefixed with HTTP_ are headers sent by
    client.
    >
    > But when I use <cfhttp>, the coldfusion server *is* the client, isn't it?
    So
    > are you saying that I should add "HTTP_ to the name parameters of my
    > <cfhttpparam> tags? But then you also said "connection" was correct, so I
    was
    > confused....
    The name of the header is correct. What I'm saying is that if you send a
    header called X-Command:
    <cfhttpparam type = "cgi" name="X-Command" value="testing testing">

    on the receiving page you'll have HTTP_X_COMMAND equal "testing testing"

    HTH,
    --
    <mack />


    Neculai Macarie Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139