| 149 | } while(0) |
| 150 | |
| 151 | static int |
| 152 | sohashttpget(struct socket *so, void *arg, int waitflag) |
| 153 | { |
| 154 | |
| 155 | if ((so->so_rcv.sb_state & SBS_CANTRCVMORE) == 0 && |
| 156 | !sbfull(&so->so_rcv)) { |
| 157 | struct mbuf *m; |
| 158 | char *cmp; |
| 159 | int cmplen, cc; |
| 160 | |
| 161 | m = so->so_rcv.sb_mb; |
| 162 | cc = sbavail(&so->so_rcv) - 1; |
| 163 | if (cc < 1) |
| 164 | return (SU_OK); |
| 165 | switch (*mtod(m, char *)) { |
| 166 | case 'G': |
| 167 | STRSETUP(cmp, cmplen, "ET "); |
| 168 | break; |
| 169 | case 'H': |
| 170 | STRSETUP(cmp, cmplen, "EAD "); |
| 171 | break; |
| 172 | default: |
| 173 | goto fallout; |
| 174 | } |
| 175 | if (cc < cmplen) { |
| 176 | if (mbufstrncmp(m, m->m_nextpkt, 1, cc, cmp) == 1) { |
| 177 | DPRINT("short cc (%d) but mbufstrncmp ok", cc); |
| 178 | return (SU_OK); |
| 179 | } else { |
| 180 | DPRINT("short cc (%d) mbufstrncmp failed", cc); |
| 181 | goto fallout; |
| 182 | } |
| 183 | } |
| 184 | if (mbufstrcmp(m, m->m_nextpkt, 1, cmp) == 1) { |
| 185 | DPRINT("mbufstrcmp ok"); |
| 186 | if (parse_http_version == 0) |
| 187 | return (soishttpconnected(so, arg, waitflag)); |
| 188 | else |
| 189 | return (soparsehttpvers(so, arg, waitflag)); |
| 190 | } |
| 191 | DPRINT("mbufstrcmp bad"); |
| 192 | } |
| 193 | |
| 194 | fallout: |
| 195 | DPRINT("fallout"); |
| 196 | return (SU_ISCONNECTED); |
| 197 | } |
| 198 | |
| 199 | static int |
| 200 | soparsehttpvers(struct socket *so, void *arg, int waitflag) |
nothing calls this directly
no test coverage detected